From 07b555bbc6f3222e7db8febf0ea0c1cdd7717a15 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Sat, 11 Oct 2025 12:33:47 -0700 Subject: [PATCH] Make it so you can press escape in any place in berrydash (almost any) --- Assets/Scripts/AccountMenu/AccountHandler.cs | 12 ++++++++++++ Assets/Scripts/ChatroomMenu.cs | 11 ++++++++++- .../IconMarketplace/IconMarketplaceManager.cs | 11 +++++++++++ Assets/Scripts/IconsMenu.cs | 7 +++++++ Assets/Scripts/LeaderboardsMenu.cs | 10 ++++++++++ Assets/Scripts/PlayMenu.cs | 10 ++++++++++ Assets/Scripts/ProfileMenu.cs | 6 ++++++ Assets/Scripts/SettingsMenu.cs | 11 +++++++++++ Assets/Scripts/StatsMenu.cs | 7 +++++++ 9 files changed, 84 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/AccountMenu/AccountHandler.cs b/Assets/Scripts/AccountMenu/AccountHandler.cs index 0a228be..458226c 100644 --- a/Assets/Scripts/AccountMenu/AccountHandler.cs +++ b/Assets/Scripts/AccountMenu/AccountHandler.cs @@ -1,4 +1,6 @@ using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.SceneManagement; public class AccountHandler : MonoBehaviour { @@ -98,4 +100,14 @@ public class AccountHandler : MonoBehaviour } foreach (CustomColorObject customColorObject in FindObjectsByType(FindObjectsSortMode.None)) customColorObject.SetColor(); } + + async void Update() + { + if (Keyboard.current.escapeKey.wasPressedThisFrame) + { + if (accountChangePassword.gameObject.activeSelf || accountChangeUsername.gameObject.activeSelf || accountRefreshLogin.gameObject.activeSelf) SwitchPanel(0); + else if (accountLogin.gameObject.activeSelf || accountRegister.gameObject.activeSelf) SwitchPanel(1); + else await SceneManager.LoadSceneAsync("MainMenu"); + } + } } \ No newline at end of file diff --git a/Assets/Scripts/ChatroomMenu.cs b/Assets/Scripts/ChatroomMenu.cs index 31757c1..a20c989 100644 --- a/Assets/Scripts/ChatroomMenu.cs +++ b/Assets/Scripts/ChatroomMenu.cs @@ -8,7 +8,9 @@ using System.Threading.Tasks; using Newtonsoft.Json.Linq; using TMPro; using UnityEngine; +using UnityEngine.InputSystem; using UnityEngine.Networking; +using UnityEngine.SceneManagement; using UnityEngine.UI; public class ChatroomMenu : MonoBehaviour @@ -301,11 +303,18 @@ public class ChatroomMenu : MonoBehaviour statusRoutine = StartCoroutine(StatusRoutine()); } - void Update() + async void Update() { var max = content.GetComponent().sizeDelta.y; var current = content.transform.localPosition.y; downButton.gameObject.SetActive(Mathf.Abs(max - current) > 0.1f * max); + if (Keyboard.current.escapeKey.wasPressedThisFrame && FindFirstObjectByType() == null) + { + if (optionsPanel.activeSelf) optionsPanelExitButton.onClick.Invoke(); + else if (reportMessagePanel.activeSelf) reportMessagePanelExitButton.onClick.Invoke(); + else if (editMessagePanelCurrent != null) editMessagePanelCurrent.transform.GetChild(0).GetChild(0).GetComponent