MainWindow.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using UnityEngine;
  2. using System.Collections;
  3. public class MainWindow : UIWindowBase
  4. {
  5. //UI的初始化请放在这里
  6. public override void OnOpen()
  7. {
  8. AddOnClickListener("Button_Setting", OnClickSetting);
  9. AddOnClickListener("Button_Shop", OnClickShop);
  10. AddOnClickListener("Button_Start", OnGameStart);
  11. }
  12. //请在这里写UI的更新逻辑,当该UI监听的事件触发时,该函数会被调用
  13. public override void OnRefresh()
  14. {
  15. }
  16. //UI的进入动画
  17. public override IEnumerator EnterAnim(UIAnimCallBack l_animComplete, UICallBack l_callBack, params object[] objs)
  18. {
  19. AnimSystem.UguiAlpha(gameObject, 0, 1, callBack:(object[] obj)=>
  20. {
  21. StartCoroutine(base.EnterAnim(l_animComplete, l_callBack, objs));
  22. });
  23. yield return new WaitForEndOfFrame();
  24. }
  25. //UI的退出动画
  26. public override IEnumerator ExitAnim(UIAnimCallBack l_animComplete, UICallBack l_callBack, params object[] objs)
  27. {
  28. AnimSystem.UguiAlpha(gameObject , null, 0, callBack:(object[] obj) =>
  29. {
  30. StartCoroutine(base.ExitAnim(l_animComplete, l_callBack, objs));
  31. });
  32. yield return new WaitForEndOfFrame();
  33. }
  34. public void OnGameStart(InputUIOnClickEvent e)
  35. {
  36. ApplicationStatusManager.EnterStatus<GameStatus>();
  37. }
  38. public void OnClickShop(InputUIOnClickEvent e)
  39. {
  40. UIManager.OpenUIWindow<ShopWindow>();
  41. }
  42. public void OnClickSetting(InputUIOnClickEvent e)
  43. {
  44. UIManager.CloseLastUI();
  45. }
  46. }