12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- public class Toast : Regist
- {
- #region 变量
- public static bool On;
- public static float Timer;
- public static Text Text;
- public static Transform Transform;
- #endregion
- public void Update()
- {
- if (On)
- {
- Timer -= Time.deltaTime;
- if (Timer <= 0)
- {
- On = false;
- transform.TweenBacCG();
- transform.TweenBacVec();
- }
- }
- }
- public override bool InitAtOnce()
- {
- if (base.InitAtOnce())
- {
- return true;
- }
- Text = GetComponentInChildren<Text>();
- Transform = transform;
- transform.CreateTweenCG(0, 1, 0.25f, false, true, Curve.EaseOutQuad);
- transform.CreateTweenVec2D(ResourceManager.Get(CanvasLabel.O_Pos).position, 0.25f, false, false, true, Curve.EaseOutQuad);
- return false;
- }
- public static void Show(float time, string str)
- {
- AudioManager.PlayClip(AudioLabel.Error);
- On = true;
- Text.text = str;
- Timer = time;
- Transform.TweenForCG();
- Transform.TweenForVec();
- }
- }
|