48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class MenuScript : MonoBehaviour
|
|
{
|
|
[SerializeField] private Button exitButton;
|
|
[SerializeField] private TMP_Text updateText;
|
|
[SerializeField] private Button updateButton;
|
|
[SerializeField] private Button profileButton;
|
|
[SerializeField] private ProfileMenu profilePrefab;
|
|
[SerializeField] private TMP_Text copyrightText;
|
|
|
|
void Awake()
|
|
{
|
|
LatestVersionText.Instance.text = updateText;
|
|
LatestVersionText.Instance.updateButton = updateButton;
|
|
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();
|
|
});
|
|
}
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
if (BazookaManager.Instance.GetAccountID() != null)
|
|
{
|
|
profileButton.transform.GetChild(0).GetComponent<TMP_Text>().text = BazookaManager.Instance.GetAccountName();
|
|
profileButton.onClick.AddListener(async () =>
|
|
{
|
|
var clone = Instantiate(profilePrefab.gameObject, profilePrefab.gameObject.transform.parent);
|
|
clone.SetActive(true);
|
|
await clone.GetComponent<ProfileMenu>().Init();
|
|
});
|
|
profileButton.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
} |