From 1025f63572d661a61e95e8f14f2fffa8390a8ff0 Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Thu, 9 Apr 2026 20:11:32 +0200 Subject: [PATCH] hide hud toggle in meetings & intro --- CHANGELOG.md | 2 +- Modules/ClientControlGUI.cs | 88 ++++++++++++++++++++++--------------- 2 files changed, 53 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e6cdbb44..34f00f75f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ - Fixed King Of The Zones sometimes not registering zone domination - Fixed Asthmatic not working after the host dies - New client option: `Show Client Control GUI` (Enabled by default) -- Improved Client Control GUI (by Zypherus) +- Improved Client Control GUI (by Zypherus) + keybinds to open/close it: DELETE or CTRL + ` - Fixed Dleks button (by TommyXL) - Other internal fixes and optimizations diff --git a/Modules/ClientControlGUI.cs b/Modules/ClientControlGUI.cs index 41b4b00aa..a909ac4e3 100644 --- a/Modules/ClientControlGUI.cs +++ b/Modules/ClientControlGUI.cs @@ -458,54 +458,70 @@ public class ClientControlGUI : MonoBehaviour InGameRoleInfoMenu.Show(); } }); - - Section(ref y, "Camera"); - if (Zoom.CanZoom) + bool canZoom = Zoom.CanZoom; + bool canNoClip = canMove && (!AmongUsClient.Instance.IsGameStarted || !GameStates.IsOnlineGame); + bool canToggleHud = Main.IntroDestroyed && !inMeeting && !ExileController.Instance; + + if (canZoom || canNoClip || canToggleHud) { - // Sync slider to actual camera value so external changes (scroll wheel, touch pinch) are reflected - if (_cam) _zoomValue = _cam.orthographicSize; + Section(ref y, "Camera"); - float newZoom = Slider(ref y, $"Zoom {_zoomValue:F1}x", _zoomValue, 3.0f, 18.0f, w); - if (Mathf.Abs(newZoom - _zoomValue) > 0.01f) + if (canZoom) { - _zoomValue = newZoom; - Zoom.SetZoomSize(reset: false); - if (_cam) _cam.orthographicSize = _zoomValue; - if (HudManager.InstanceExists) HudManager.Instance.UICamera.orthographicSize = _zoomValue; - } + // Sync slider to actual camera value so external changes (scroll wheel, touch pinch) are reflected + if (_cam) _zoomValue = _cam.orthographicSize; - if (GUI.Button(new Rect(0, y, w, ButtonHeight), "Reset Zoom", _sAction)) + float newZoom = Slider(ref y, $"Zoom {_zoomValue:F1}x", _zoomValue, 3.0f, 18.0f, w); + if (Mathf.Abs(newZoom - _zoomValue) > 0.01f) + { + _zoomValue = newZoom; + Zoom.SetZoomSize(reset: false); + if (_cam) _cam.orthographicSize = _zoomValue; + if (HudManager.InstanceExists) HudManager.Instance.UICamera.orthographicSize = _zoomValue; + } + + if (GUI.Button(new Rect(0, y, w, ButtonHeight), "Reset Zoom", _sAction)) + { + Zoom.SetZoomSize(reset: true); + _zoomValue = 3.0f; + } + y += ButtonHeight + Padding * 0.7f; + } + else if (!Mathf.Approximately(_zoomValue, 3.0f)) { Zoom.SetZoomSize(reset: true); _zoomValue = 3.0f; } - y += ButtonHeight + Padding * 0.7f; - } - else if (!Mathf.Approximately(_zoomValue, 3.0f)) - { - Zoom.SetZoomSize(reset: true); - _zoomValue = 3.0f; - } - if (canMove && (!AmongUsClient.Instance.IsGameStarted || !GameStates.IsOnlineGame)) - { - // Reads live state every frame for correct label/colour; lambda also reads it on click to avoid stale values - bool noclipOn = ControllerManagerUpdatePatch.NoClipEnabled; - Btn(ref y, noclipOn ? "No-clip: ON" : "No-clip: OFF", noclipOn ? _sHost : _sAction, () => + if (canNoClip) { - ControllerManagerUpdatePatch.NoClipEnabled = !ControllerManagerUpdatePatch.NoClipEnabled; - if (OperatingSystem.IsAndroid()) PlayerControl.LocalPlayer.Collider.offset = ControllerManagerUpdatePatch.NoClipEnabled ? new Vector2(0f, 127f) : new Vector2(0f, -0.3636f); - }); - } - else if (OperatingSystem.IsAndroid() && PlayerControl.LocalPlayer) PlayerControl.LocalPlayer.Collider.offset = new Vector2(0f, -0.3636f); + // Reads live state every frame for correct label/colour; lambda also reads it on click to avoid stale values + bool noclipOn = ControllerManagerUpdatePatch.NoClipEnabled; + Btn(ref y, noclipOn ? "No-clip: ON" : "No-clip: OFF", noclipOn ? _sHost : _sAction, () => + { + ControllerManagerUpdatePatch.NoClipEnabled = !ControllerManagerUpdatePatch.NoClipEnabled; + if (OperatingSystem.IsAndroid()) PlayerControl.LocalPlayer.Collider.offset = ControllerManagerUpdatePatch.NoClipEnabled ? new Vector2(0f, 127f) : new Vector2(0f, -0.3636f); + }); + } + else if (OperatingSystem.IsAndroid() && PlayerControl.LocalPlayer) PlayerControl.LocalPlayer.Collider.offset = new Vector2(0f, -0.3636f); - Btn(ref y, _hudHidden ? "Show HUD" : "Hide HUD", _hudHidden ? _sHost : _sAction, () => - { - _hudHidden = !_hudHidden; - if (HudManager.InstanceExists) - HudManager.Instance.gameObject.SetActive(!_hudHidden); - }); + if (canToggleHud) + { + Btn(ref y, _hudHidden ? "Show HUD" : "Hide HUD", _hudHidden ? _sHost : _sAction, () => + { + _hudHidden = !_hudHidden; + if (HudManager.InstanceExists) + HudManager.Instance.gameObject.SetActive(!_hudHidden); + }); + } + else if (_hudHidden) + { + _hudHidden = false; + if (HudManager.InstanceExists) + HudManager.Instance.gameObject.SetActive(true); + } + } if (inLobby) {