GameWindow.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using UnityEngine;
  2. using System.Collections;
  3. public class GameWindow : UIWindowBase
  4. {
  5. //UI的初始化请放在这里
  6. public override void OnOpen()
  7. {
  8. AddOnClickListener("Button_Return", OnClickReturnMainMenu);
  9. }
  10. //请在这里写UI的更新逻辑,当该UI监听的事件触发时,该函数会被调用
  11. public override void OnRefresh()
  12. {
  13. }
  14. //UI的进入动画
  15. public override IEnumerator EnterAnim(UIAnimCallBack l_animComplete, UICallBack l_callBack, params object[] objs)
  16. {
  17. yield return new WaitForSeconds(0.2f);
  18. AnimSystem.UguiAlpha(gameObject, 0, 1, callBack:(object[] obj)=>
  19. {
  20. StartCoroutine(base.EnterAnim(l_animComplete, l_callBack, objs));
  21. });
  22. AnimSystem.UguiMove(GetGameObject("Text_Title"), new Vector3(0, 50, 0), new Vector3(0, -50, 0));
  23. AnimSystem.UguiMove(GetGameObject("Button_Return"), new Vector3(0, -70, 0), new Vector3(0, 70, 0));
  24. yield return new WaitForEndOfFrame();
  25. }
  26. //UI的退出动画
  27. public override IEnumerator ExitAnim(UIAnimCallBack l_animComplete, UICallBack l_callBack, params object[] objs)
  28. {
  29. AnimSystem.UguiAlpha(gameObject , null, 0, callBack:(object[] obj) =>
  30. {
  31. StartCoroutine(base.ExitAnim(l_animComplete, l_callBack, objs));
  32. });
  33. AnimSystem.UguiMove(GetGameObject("Text_Title"), new Vector3(0, -50, 0), new Vector3(0, 50, 0));
  34. AnimSystem.UguiMove(GetGameObject("Button_Return"), new Vector3(0, 70, 0), new Vector3(0, -70, 0));
  35. yield return new WaitForEndOfFrame();
  36. }
  37. void OnClickReturnMainMenu(InputUIOnClickEvent e)
  38. {
  39. ApplicationStatusManager.EnterStatus<DemoStatus>();
  40. }
  41. }