UIAnimManager.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using UnityEngine;
  2. using System.Collections;
  3. using System;
  4. public class UIAnimManager : MonoBehaviour
  5. {
  6. //开始调用进入动画
  7. public void StartEnterAnim(UIWindowBase UIbase, UICallBack callBack, params object[] objs)
  8. {
  9. UISystemEvent.Dispatch(UIbase, UIEvent.OnStartEnterAnim);
  10. StartCoroutine(UIbase.EnterAnim(EndEnterAnim, callBack, objs));
  11. }
  12. //进入动画播放完毕回调
  13. public void EndEnterAnim(UIWindowBase UIbase, UICallBack callBack, params object[] objs)
  14. {
  15. UISystemEvent.Dispatch(UIbase, UIEvent.OnCompleteEnterAnim);
  16. UIbase.OnCompleteEnterAnim();
  17. UIbase.windowStatus = UIWindowBase.WindowStatus.Open;
  18. try
  19. {
  20. if (callBack!= null)
  21. {
  22. callBack(UIbase, objs);
  23. }
  24. }
  25. catch (Exception e)
  26. {
  27. Debug.LogError(e.ToString());
  28. }
  29. }
  30. //开始调用退出动画
  31. public void StartExitAnim(UIWindowBase UIbase, UICallBack callBack, params object[] objs)
  32. {
  33. UISystemEvent.Dispatch(UIbase, UIEvent.OnStartExitAnim);
  34. StartCoroutine(UIbase.ExitAnim(EndExitAnim, callBack, objs));
  35. }
  36. //退出动画播放完毕回调
  37. public void EndExitAnim(UIWindowBase UIbase, UICallBack callBack, params object[] objs)
  38. {
  39. UISystemEvent.Dispatch(UIbase, UIEvent.OnCompleteExitAnim);
  40. UIbase.OnCompleteExitAnim();
  41. UIbase.windowStatus = UIWindowBase.WindowStatus.Close;
  42. try
  43. {
  44. if (callBack != null)
  45. {
  46. callBack(UIbase, objs);
  47. }
  48. }
  49. catch(Exception e)
  50. {
  51. Debug.LogError(e.ToString());
  52. }
  53. }
  54. }