Files
aibis-dream/Assets/Scripts/UI/Panel/StartPanel.cs
T
dingyuntian 9f20ef52d8 UI工具翻新
1. 增加UI工具
2. 增加设置页面
3. GameLoop更新
4. 导入ActionKit工具
2025-04-21 18:53:30 +08:00

69 lines
1.7 KiB
C#

using AibisDream.Utility;
using UnityEngine;
using UnityEngine.UI;
namespace AibisDream
{
public class StartPanel : MonoBehaviour, IUIPanel
{
public bool IsOpen => gameObject.activeSelf;
#region 开启和关闭
public void Show()
{
gameObject.SetActive(true);
}
public void Hide()
{
gameObject.SetActive(false);
}
#endregion
private void Awake()
{
RegisterButton();
}
private void RegisterButton()
{
// 开始界面按钮
var tabs = transform.Find("Tabs");
tabs.Find("Start").GetComponent<Button>().onClick.AddListener(StartNewGame);
tabs.Find("Select Level").GetComponent<Button>().onClick.AddListener(OpenLevelPanel);
tabs.Find("Load Save File").GetComponent<Button>().onClick.AddListener(OpenSaveFilePanel);
tabs.Find("Quit").GetComponent<Button>().onClick.AddListener(QuitApp);
// 打开链接
transform.Find("问卷").GetComponent<Button>().onClick.AddListener(() => Application.OpenURL(ConstRef.SurveyURL));
transform.Find("关注").GetComponent<Button>().onClick.AddListener(() => Application.OpenURL(ConstRef.QQURL));
}
#region 按钮对应的函数
private void StartNewGame()
{
GameManager.Instance.StartNewGame();
}
private void OpenLevelPanel()
{
// TODO 打开选关面板
}
private void OpenSaveFilePanel()
{
// TODO 打开存档面板
}
private void QuitApp()
{
GameManager.Instance.QuitApp();
}
#endregion
}
}