Exemplo n.º 1
0
 private static bool CreateTextExIfNotExist(TextMeshProUGUI textMeshPro, out TextEx textEx)
 {
     if (textMeshPro == null)
     {
         Debug.LogError("call 'CreateTextEx' function with null TextMeshPro param !");
         textEx = null;
         return(false);
     }
     else
     {
         textEx = textMeshPro.gameObject.GetComponent <UITextForTextMeshPro>();
         if (textEx == null)
         {
             var addedComponent = textMeshPro.gameObject.AddComponent <UITextForTextMeshPro>();
             addedComponent.label = textMeshPro;
             textEx = addedComponent;
         }
         return(true);
     }
 }
Exemplo n.º 2
0
        public TextCountDownWidget(TextEx textEx, float time, string[] formatStrs, Action completeAction, bool timeScaleEnable) :
            base(textEx, completeAction, time, timeScaleEnable)
        {
            this.lastLeftSeconds = int.MaxValue;
            this.numbers         = ListPool <int> .Get();

            for (int i = 0; i < Format.KEY.Count; i++)
            {
                this.numbers.Add(0);
            }
            this.minFormatIndex = int.MaxValue;
            this.formats        = ListPool <Format> .Get();

            for (int i = 0; i < formatStrs.Length; i++)
            {
                var aFormat = new Format(formatStrs[i]);
                if (this.minFormatIndex > aFormat.index)
                {
                    this.minFormatIndex = aFormat.index;
                }
                this.formats.Add(aFormat);
            }
            this.textEx = textEx;
        }