1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using UnityEngine;
- using UnityEngine.UI;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- public class ManaInfo : Regist
- {
- #region 变量
- public static Text Text
- {
- get
- {
- if (Text_ == null)
- {
- Text_ = ManaReso.Get<Text>("J_Info");
- }
- return Text_;
- }
- set { Text_ = value; }
- }
- public static Text Text_;
- public static bool Lock;
- public static float Timer;
- public static List<string> StrList = new List<string>();
- #endregion
- public void FixedUpdate()
- {
- Timer -= Time.fixedDeltaTime;
- if (Timer <= 0 && Lock)
- {
- 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.TweenForCG();
- Lock = true;
- Timer = time;
- }
- }
|