Toast.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4. public class Toast : Regist
  5. {
  6. #region 变量
  7. public static bool On;
  8. public static float Timer;
  9. public static Text Text;
  10. public static Transform Transform;
  11. #endregion
  12. public void FixedUpdate()
  13. {
  14. if (On)
  15. {
  16. Timer -= Time.fixedDeltaTime;
  17. if (Timer <= 0)
  18. {
  19. On = false;
  20. transform.TweenBacCG();
  21. transform.TweenBacVec();
  22. }
  23. }
  24. }
  25. public override void RegistImmed()
  26. {
  27. Text = GetComponentInChildren<Text>();
  28. Transform = transform;
  29. transform.CreateTweenCG(0, 1, 0.25f, false, true, Curve.EaseOutQuad);
  30. transform.CreateTweenVec2D(ManaReso.Get("O_Pos").position, 0.25f, false, false, true, Curve.EaseOutQuad);
  31. }
  32. public static void Show(float time, string str)
  33. {
  34. On = true;
  35. Text.text = str;
  36. Timer = time;
  37. Transform.TweenForCG();
  38. Transform.TweenForVec();
  39. }
  40. }