Add a close popup
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,19 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MenuScript : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button exitButton;
|
||||
[SerializeField] private Button closeButton;
|
||||
[SerializeField] private TMP_Text updateText;
|
||||
[SerializeField] private Button updateButton;
|
||||
[SerializeField] private Button profileButton;
|
||||
[SerializeField] private ProfileMenu profilePrefab;
|
||||
[SerializeField] private TMP_Text copyrightText;
|
||||
[SerializeField] private GameObject closePopup;
|
||||
[SerializeField] private Button closePopupCancelButton;
|
||||
[SerializeField] private Button closePopupCloseButton;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -18,17 +22,11 @@ public class MenuScript : MonoBehaviour
|
||||
LatestVersionText.Instance.RefreshText();
|
||||
copyrightText.text = $"\\u00A9 {System.DateTime.Now.Year} Lncvrt. All rights reserved.";
|
||||
|
||||
if (Application.isMobilePlatform || Application.isEditor)
|
||||
{
|
||||
exitButton.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
exitButton.onClick.AddListener(() =>
|
||||
{
|
||||
Application.Quit();
|
||||
});
|
||||
}
|
||||
if (!Application.isMobilePlatform && !Application.isEditor) closeButton.gameObject.SetActive(true);
|
||||
else closeButton.onClick.AddListener(() => closePopup.SetActive(true));
|
||||
|
||||
closePopupCancelButton.onClick.AddListener(() => closePopup.SetActive(false));
|
||||
closePopupCloseButton.onClick.AddListener(() => Application.Quit());
|
||||
}
|
||||
|
||||
void Start()
|
||||
@@ -45,4 +43,9 @@ public class MenuScript : MonoBehaviour
|
||||
profileButton.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Keyboard.current.escapeKey.wasPressedThisFrame) closePopup.SetActive(!closePopup.activeSelf);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user