ViewAnimationFactory.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections;
  2. using UnityEngine;
  3. using FairyGUI;
  4. namespace GFGGame
  5. {
  6. public class ViewAnimationFactory
  7. {
  8. public static void ZoomInCenter(GComponent gComponent, GTweenCallback callback = null)
  9. {
  10. Transition transition = (gComponent as Window).contentPane.GetTransition("openViewAction");
  11. if (transition != null)
  12. {
  13. transition.Play(() =>
  14. {
  15. callback?.Invoke();
  16. });
  17. }
  18. else
  19. {
  20. gComponent.visible = false;
  21. gComponent.SetScale(0.7f, 0.7f);
  22. gComponent.SetPivot(0.5f, 0.5f);
  23. gComponent.TweenFade(0f, 0).OnComplete(() =>
  24. {
  25. gComponent.visible = true;
  26. gComponent.TweenFade(1, 0.3f).SetEase(EaseType.QuadOut);
  27. gComponent.TweenScale(new Vector2(1, 1), 0.3f).SetEase(EaseType.BackOut).OnComplete(callback);
  28. });
  29. }
  30. }
  31. public static void ZoomOutCenter(GComponent gComponent, GTweenCallback callback)
  32. {
  33. callback?.Invoke();
  34. }
  35. }
  36. }