Make it so you can press escape in any place in berrydash (almost any)
This commit is contained in:
@@ -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<CustomColorObject>(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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<RectTransform>().sizeDelta.y;
|
||||
var current = content.transform.localPosition.y;
|
||||
downButton.gameObject.SetActive(Mathf.Abs(max - current) > 0.1f * max);
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindFirstObjectByType<ProfileMenu>() == 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<Button>().onClick.Invoke();
|
||||
else await SceneManager.LoadSceneAsync("MainMenu");
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator StatusRoutine()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class IconMarketplaceManager : MonoBehaviour
|
||||
@@ -68,4 +70,13 @@ public class IconMarketplaceManager : MonoBehaviour
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
async void Update()
|
||||
{
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame)
|
||||
{
|
||||
if (downloadPanel.activeSelf || uploadPanel.activeSelf) SwitchPanel(0);
|
||||
else await SceneManager.LoadSceneAsync("MainMenu");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Iconsmenu : MonoBehaviour
|
||||
@@ -281,4 +283,9 @@ public class Iconsmenu : MonoBehaviour
|
||||
customIcons[loopIcon.UUID].interactable = loopIcon.UUID != icon.UUID;
|
||||
}
|
||||
}
|
||||
|
||||
async void Update()
|
||||
{
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame) await SceneManager.LoadSceneAsync("MainMenu");
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Numerics;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
@@ -868,4 +869,13 @@ public class LeaderboardsMenu : MonoBehaviour
|
||||
statusText.gameObject.SetActive(enabled);
|
||||
statusText.text = message;
|
||||
}
|
||||
|
||||
async void Update()
|
||||
{
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindFirstObjectByType<ProfileMenu>() == null)
|
||||
{
|
||||
if (!selectionPanel.activeSelf) SwitchMenu(0);
|
||||
else await SceneManager.LoadSceneAsync("MainMenu");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -272,4 +273,13 @@ public class PlayMenu : MonoBehaviour
|
||||
inputField.stringPosition = inputField.text.Length;
|
||||
}
|
||||
}
|
||||
|
||||
async void Update()
|
||||
{
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame)
|
||||
{
|
||||
if (customMenu.activeSelf) customBackButton.onClick.Invoke();
|
||||
else await SceneManager.LoadSceneAsync("MainMenu");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -393,4 +394,9 @@ public class ProfileMenu : MonoBehaviour
|
||||
Debug.LogError("Failed to upload post");
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame) Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SettingsMenu : MonoBehaviour
|
||||
@@ -134,4 +136,13 @@ public class SettingsMenu : MonoBehaviour
|
||||
colorMenu.SetColor(new Color((int)colorToSet[0] / 255f, (int)colorToSet[1] / 255f, (int)colorToSet[2] / 255f));
|
||||
colorCanSave = true;
|
||||
}
|
||||
|
||||
async void Update()
|
||||
{
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame)
|
||||
{
|
||||
if (colorMenu.gameObject.activeSelf) toggleButton.onClick.Invoke();
|
||||
else await SceneManager.LoadSceneAsync("MainMenu");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class StatsMenu : MonoBehaviour
|
||||
{
|
||||
@@ -22,4 +24,9 @@ public class StatsMenu : MonoBehaviour
|
||||
text.AppendLine("Total Attempts: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalAttepts()));
|
||||
statText.text = text.ToString();
|
||||
}
|
||||
|
||||
async void Update()
|
||||
{
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame) await SceneManager.LoadSceneAsync("MainMenu");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user