Make settings menu into a popup
This commit is contained in:
7 files changed
+9063
-9404
No files matched your search
@@ -12,12 +12,14 @@ public class MainMenu : MonoBehaviour {
|
||||
[SerializeField] private TMP_Text splashText;
|
||||
[SerializeField] private Button profileButton;
|
||||
[SerializeField] private ProfileMenu profilePrefab;
|
||||
[SerializeField] private SettingsMenu settingsPrefab;
|
||||
[SerializeField] private TMP_Text copyrightText;
|
||||
[SerializeField] private GameObject closePopup;
|
||||
[SerializeField] private Button closePopupCancelButton;
|
||||
[SerializeField] private Button closePopupCloseButton;
|
||||
[SerializeField] private Button iconMarketplaceButton;
|
||||
[SerializeField] private TMP_Text iconMarketplaceButtonText;
|
||||
[SerializeField] private Button settingsButton;
|
||||
|
||||
void Awake() {
|
||||
if (PresistentData.latestVersion != null) {
|
||||
@@ -60,6 +62,7 @@ public class MainMenu : MonoBehaviour {
|
||||
}
|
||||
profileButton.gameObject.SetActive(true);
|
||||
}
|
||||
settingsButton.onClick.AddListener(() => Instantiate(settingsPrefab.gameObject, settingsPrefab.gameObject.transform.parent).SetActive(true));
|
||||
|
||||
if (Tools.GetLevelInfo().level < 3) {
|
||||
iconMarketplaceButton.interactable = false;
|
||||
@@ -68,7 +71,7 @@ public class MainMenu : MonoBehaviour {
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame && !GameObject.Find("ProfilePrefab(Clone)")) closePopup.SetActive(!closePopup.activeSelf);
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame && !GameObject.Find("ProfilePrefab(Clone)") && !GameObject.Find("SettingsPrefab(Clone)")) closePopup.SetActive(!closePopup.activeSelf);
|
||||
}
|
||||
|
||||
public static void DoSplashText(TMP_Text text, SplashEntry splash) {
|
||||
|
||||
@@ -2,12 +2,12 @@ using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SettingsMenu : MonoBehaviour {
|
||||
[SerializeField] private GameObject settingsMenu;
|
||||
[SerializeField] private ColorPanel colorMenu;
|
||||
[SerializeField] private Button backButton;
|
||||
[SerializeField] private Button toggleButton;
|
||||
|
||||
[SerializeField] private Toggle setting1toggle;
|
||||
@@ -36,10 +36,10 @@ public class SettingsMenu : MonoBehaviour {
|
||||
|
||||
foreach (CustomColorObject customColorObject in FindObjectsByType<CustomColorObject>(FindObjectsSortMode.None)) customColorObject.SetColor();
|
||||
};
|
||||
backButton.onClick.AddListener(() => Destroy(gameObject));
|
||||
toggleButton.onClick.AddListener(() => {
|
||||
settingsMenu.SetActive(!settingsMenu.activeSelf);
|
||||
colorMenu.gameObject.SetActive(!colorMenu.gameObject.activeSelf);
|
||||
toggleButton.transform.GetChild(0).GetComponent<TMP_Text>().text = settingsMenu.activeSelf ? "Colors" : "Settings";
|
||||
SwitchColorType(4);
|
||||
foreach (CustomColorObject customColorObject in FindObjectsByType<CustomColorObject>(FindObjectsSortMode.None)) customColorObject.SetColor();
|
||||
});
|
||||
@@ -124,10 +124,10 @@ public class SettingsMenu : MonoBehaviour {
|
||||
colorCanSave = true;
|
||||
}
|
||||
|
||||
async void Update() {
|
||||
void Update() {
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame) {
|
||||
if (colorMenu.gameObject.activeSelf) toggleButton.onClick.Invoke();
|
||||
else await SceneManager.LoadSceneAsync("MainMenu");
|
||||
else backButton.onClick.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user