TweenEntity.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using JetBrains.Annotations;
  2. using UnityEngine;
  3. using Utility;
  4. namespace Core.UI.UTool.UITween
  5. {
  6. [System.Serializable]
  7. public class TweenEntity
  8. {
  9. public bool Foldout;
  10. public TweenType TweenType;
  11. public float duration;
  12. public float delay;
  13. [CanBeNull] public TweenTransform TweenBasic = null;
  14. [CanBeNull] public TweenCanvasGroup TweenCanvasGroup = null;
  15. [CanBeNull] public TweenGraphic TweenGraphic = null;
  16. [CanBeNull] public TweenPlayFx TweenPlayFx = null;
  17. [HideInInspector] public Map<TweenType, TweenBasic> Map = new Map<TweenType, TweenBasic>();
  18. public void Claer()
  19. {
  20. TweenBasic = null;
  21. TweenCanvasGroup = null;
  22. TweenGraphic = null;
  23. TweenPlayFx = null;
  24. }
  25. public void Play(UITweenController UITweenController,Object RectTransform, float allTime, bool isFallBack)
  26. {
  27. switch (TweenType)
  28. {
  29. case TweenType.RectTransform:
  30. TweenBasic?.Play(UITweenController,RectTransform, allTime, isFallBack);
  31. break;
  32. case TweenType.CanvasGroup:
  33. TweenCanvasGroup?.Play(UITweenController,RectTransform, allTime, isFallBack);
  34. break;
  35. case TweenType.Graphic:
  36. TweenGraphic?.Play(UITweenController,RectTransform, allTime, isFallBack);
  37. break;
  38. case TweenType.PlayFx:
  39. TweenPlayFx?.Play(UITweenController,RectTransform, allTime, isFallBack);
  40. break;
  41. }
  42. }
  43. public void Rest(UITweenController uiTweenController,Object RectTransform)
  44. {
  45. switch (TweenType)
  46. {
  47. case TweenType.RectTransform:
  48. TweenBasic?.Rest(uiTweenController,RectTransform);
  49. break;
  50. case TweenType.CanvasGroup:
  51. TweenCanvasGroup?.Rest(uiTweenController,RectTransform);
  52. break;
  53. case TweenType.Graphic:
  54. TweenGraphic?.Rest(uiTweenController,RectTransform);
  55. break;
  56. case TweenType.PlayFx:
  57. TweenPlayFx?.Rest(uiTweenController,RectTransform);
  58. break;
  59. }
  60. }
  61. public void Prepare()
  62. {
  63. switch (TweenType)
  64. {
  65. case TweenType.RectTransform:
  66. TweenBasic?.Prepare(delay, duration);
  67. break;
  68. case TweenType.CanvasGroup:
  69. TweenCanvasGroup?.Prepare(delay, duration);
  70. break;
  71. case TweenType.Graphic:
  72. TweenGraphic?.Prepare(delay, duration);
  73. break;
  74. case TweenType.PlayFx:
  75. TweenPlayFx?.Prepare(delay, duration);
  76. break;
  77. }
  78. }
  79. }
  80. }