123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using UnityEngine;
- using UnityEngine.UI;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- public class ManaInfo : Regist
- {
- public class InfoText
- {
- public float Timer;
- public Text Text;
- }
- #region 变量
- public static CanvasGroup CanvasGroup
- {
- get
- {
- if (CanvasGroup_ == null)
- {
- CanvasGroup_ = ManaReso.Get<CanvasGroup>("J_Info");
- }
- return CanvasGroup_;
- }
- set { CanvasGroup_ = value; }
- }
- public static CanvasGroup CanvasGroup_;
- public static bool Lock;
- public static float Timer;
- public static List<InfoText> TextList = new List<InfoText>();
- #endregion
- public void Update()
- {
- Timer -= Time.deltaTime;
- if (Timer <= 0 && Lock)
- {
- Lock = false;
- CanvasGroup.TweenBacCG();
- }
-
- for (int i = 0; i < TextList.Count; i++)
- {
- InfoText infoText = TextList[i];
- infoText.Timer -= Time.deltaTime;
- if (infoText.Timer < 0)
- {
- infoText.Text.TweenBacGra();
- TextList.RemoveAt(i--);
- }
- }
- }
- public static void Show(string str, float time)
- {
- CanvasGroup.TweenForCG();
- if (TextList.Count == 5)
- {
- ManaReso.Save(TextList[0].Text);
- TextList.RemoveAt(0);
- }
- Text text = ManaReso.GetInfoItem();
- InfoText infoText = new InfoText();
- text.text = str;
- text.SetAlpha(1);
- infoText.Timer = 45;
- infoText.Text = text;
- TextList.Add(infoText);
- Lock = true;
- Timer = time;
- }
- }
|