12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using Mono.UI.Core;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- namespace Mono
- {
- [UIBinding(prefab = "MainScenePanel")]
- public class MainScenePanel : UIPanel
- {
- public Button Btn_Home;
- public Button Btn_Visit;
- public Button Btn_My;
- public Button Btn_CSG;
- public Button Btn_Return;
- public override void GetUIData()
- {
- Btn_Home = UIData.Get<Button>("Btn_Home");
- Btn_Visit = UIData.Get<Button>("Btn_Visit");
- Btn_My = UIData.Get<Button>("Btn_My");
- Btn_CSG = UIData.Get<Button>("Btn_CSG");
- Btn_Return = UIData.Get<Button>("Btn_Return");
- }
- public override void AddButtonEvent()
- {
- Btn_Home.onClick.AddListener(() => { Debug.Log("点击家园"); });
- Btn_Visit.onClick.AddListener(() => { Debug.Log("点击游览"); });
- Btn_My.onClick.AddListener(() => { Debug.Log("点击我的"); });
- Btn_CSG.onClick.AddListener(() =>
- {
- SceneManager.LoadScene("dabaojian");
- UIManager.Instance.HideUIPanel<MainScenePanel>();
- TimeComponent.Instance.AddTimer(0.5f, () => { UIManager.Instance.LoadAndOpenPanel<TipPanel>(UIManager.UILayer.Middle); });
- });
- Btn_Return.onClick.AddListener(() =>
- {
- UIManager.Instance.StopBGM();
- UIManager.Instance.HideUIPanel<MainScenePanel>();
- UIManager.Instance.LoadAndOpenPanel<StartPanel>(UIManager.UILayer.Middle);
- UIManager.Instance.PlayAudioClip("UI_Close");
- });
- }
- public override void Show()
- {
- base.Show();
- UIManager.Instance.PlayBGM("scene01");
- }
- }
- }
|