51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using System.Diagnostics;
|
|
using System.IO;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using ZXKFramework;
|
|
using Debug = UnityEngine.Debug;
|
|
namespace YiLiao.Main
|
|
{
|
|
public class HomePanel : UIBase
|
|
{
|
|
Button shutBtn;
|
|
public Button backBtn;
|
|
public override string GroupName => "HomePanel";
|
|
public override string Name => "HomePanel";
|
|
public override void Init(IUIManager uictrl)
|
|
{
|
|
base.Init(uictrl);
|
|
shutBtn = transform.FindFirst<Button>("ShutBtn");
|
|
if (Game.Instance.platformType == PlatformType.WebGL)
|
|
{
|
|
shutBtn.gameObject.SetActive(false);
|
|
}
|
|
backBtn = transform.FindFirst<Button>("BackBtn");
|
|
shutBtn.onClick.AddListener(() => {
|
|
#if UNITY_EDITOR //ÔÚ±à¼Æ÷ģʽÏÂ
|
|
EditorApplication.isPlaying = false;
|
|
#else
|
|
Application.Quit();
|
|
#endif
|
|
});
|
|
backBtn.onClick.AddListener(() =>
|
|
{
|
|
if (uictrl.GetUI<ProjectPanel>().gameObject.activeSelf && !uictrl.GetUI<PatternPanel>().gameObject.activeSelf)
|
|
{
|
|
uictrl.ShowUI<LoginPanel>();
|
|
uictrl.CloseUI<ProjectPanel>();
|
|
uictrl.CloseUI<PatternPanel>();
|
|
} else if (uictrl.GetUI<ProjectPanel>().gameObject.activeSelf && uictrl.GetUI<PatternPanel>().gameObject.activeSelf)
|
|
{
|
|
uictrl.ShowUI<ProjectPanel>();
|
|
uictrl.CloseUI<PatternPanel>();
|
|
}
|
|
else
|
|
{
|
|
Game.Instance.fsm.ChangeState<GameProjectState>();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
} |