using UnityEngine; using System.Collections; using System.Collections.Generic; using System.Text; using UnityEngine.UI; public class ManaInfo : Regist { #region 变量 public static Text Text { get { if (Text_ == null) { Text_ = ManaReso.Get("J_Info"); } return Text_; } set { Text_ = value; } } public static Text Text_; public static bool Lock; public static float Timer; public static List StrList = new List(); #endregion public void FixedUpdate() { Timer -= Time.fixedDeltaTime; if (Timer <= 0 && Lock == true) { Lock = false; Text.TweenBacCG(); } } public static void Show(string str, float time) { StrList.Insert(0, str); if (StrList.Count == 1) { Text.text = str; } else if (StrList.Count == 6) { StrList.RemoveAt(5); StringBuilder sb = new StringBuilder(); for (int i = 0; i < StrList.Count; i++) { if (i < 4) { sb.Append(StrList[i] + '\n'); } else { sb.Append(StrList[i]); } } Text.text = sb.ToString(); } else { Text.text = str + "\n" + Text.text; } Text.TweenConForCG(); Lock = true; Timer = time; } }