Ejemplo n.º 1
0
    protected void Start()
    {
        if (this.loginBonus == null)
        {
            return;
        }
        int num = 0;

        foreach (Transform transform in this.stamps)
        {
            GameObject gameObject = transform.gameObject;
            this.InitStamps(gameObject, num);
            if (this.IsAnimationStamp(num))
            {
                this.animStamps.Add(transform);
            }
            num++;
        }
        this.naviLabel         = base.transform.Find(this.NAVI_LABEL_PATH).gameObject.GetComponent <UILabel>();
        this.naviLabel.enabled = true;
        this.twEff             = this.naviLabel.GetComponent <CustomTypewriterEffect>();
        this.twEff.customText  = this.GetNaviMassage(this.REWARD_TODAY) + "\n" + this.GetNaviMassage(this.REWARD_NEXT);
        this.twEff.enabled     = false;
        base.StartCoroutine(this.TextAnimationDelay());
    }
 public void Finish()
 {
     if (this.mActive)
     {
         this.mActive = false;
         if (!this.mReset)
         {
             this.mCurrentOffset = this.mFullText.Length;
             this.mFade.Clear();
             this.mLabel.text = this.mFullText;
         }
         if (this.keepFullDimensions && this.scrollView != null)
         {
             this.scrollView.UpdatePosition();
         }
         CustomTypewriterEffect.current = this;
         EventDelegate.Execute(this.onFinished);
         CustomTypewriterEffect.current = null;
     }
 }
 private void Update()
 {
     if (!this.mActive)
     {
         return;
     }
     if (this.mReset)
     {
         this.mCurrentOffset = 0;
         this.mReset         = false;
         this.mLabel         = base.GetComponent <UILabel>();
         if (this.customText != null && this.customText != string.Empty)
         {
             this.mFullText = this.customText;
         }
         else
         {
             this.mFullText = this.mLabel.processedText;
         }
         this.mFade.Clear();
         if (this.keepFullDimensions && this.scrollView != null)
         {
             this.scrollView.UpdatePosition();
         }
     }
     while (this.mCurrentOffset < this.mFullText.Length && this.mNextChar <= RealTime.time)
     {
         int num = this.mCurrentOffset;
         this.charsPerSecond = Mathf.Max(1, this.charsPerSecond);
         while (NGUIText.ParseSymbol(this.mFullText, ref this.mCurrentOffset))
         {
         }
         this.mCurrentOffset++;
         if (this.mCurrentOffset > this.mFullText.Length)
         {
             break;
         }
         float num2 = 1f / (float)this.charsPerSecond;
         char  c    = (num >= this.mFullText.Length) ? '\n' : this.mFullText[num];
         if (c == '\n')
         {
             num2 += this.delayOnNewLine;
         }
         else if (num + 1 == this.mFullText.Length || this.mFullText[num + 1] <= ' ')
         {
             if (c == '.')
             {
                 if (num + 2 < this.mFullText.Length && this.mFullText[num + 1] == '.' && this.mFullText[num + 2] == '.')
                 {
                     num2 += this.delayOnPeriod * 3f;
                     num  += 2;
                 }
                 else
                 {
                     num2 += this.delayOnPeriod;
                 }
             }
             else if (c == '!' || c == '?')
             {
                 num2 += this.delayOnPeriod;
             }
         }
         if (this.mNextChar == 0f)
         {
             this.mNextChar = RealTime.time + num2;
         }
         else
         {
             this.mNextChar += num2;
         }
         if (this.fadeInTime != 0f)
         {
             CustomTypewriterEffect.FadeEntry item = default(CustomTypewriterEffect.FadeEntry);
             item.index = num;
             item.alpha = 0f;
             item.text  = this.mFullText.Substring(num, this.mCurrentOffset - num);
             this.mFade.Add(item);
         }
         else
         {
             this.mLabel.text = ((!this.keepFullDimensions) ? this.mFullText.Substring(0, this.mCurrentOffset) : (this.mFullText.Substring(0, this.mCurrentOffset) + "[00]" + this.mFullText.Substring(this.mCurrentOffset)));
             if (!this.keepFullDimensions && this.scrollView != null)
             {
                 this.scrollView.UpdatePosition();
             }
         }
     }
     if (this.mFade.size != 0)
     {
         int i = 0;
         while (i < this.mFade.size)
         {
             CustomTypewriterEffect.FadeEntry value = this.mFade[i];
             value.alpha += RealTime.deltaTime / this.fadeInTime;
             if (value.alpha < 1f)
             {
                 this.mFade[i] = value;
                 i++;
             }
             else
             {
                 this.mFade.RemoveAt(i);
             }
         }
         if (this.mFade.size == 0)
         {
             if (this.keepFullDimensions)
             {
                 this.mLabel.text = this.mFullText.Substring(0, this.mCurrentOffset) + "[00]" + this.mFullText.Substring(this.mCurrentOffset);
             }
             else
             {
                 this.mLabel.text = this.mFullText.Substring(0, this.mCurrentOffset);
             }
         }
         else
         {
             StringBuilder stringBuilder = new StringBuilder();
             for (int j = 0; j < this.mFade.size; j++)
             {
                 CustomTypewriterEffect.FadeEntry fadeEntry = this.mFade[j];
                 if (j == 0)
                 {
                     stringBuilder.Append(this.mFullText.Substring(0, fadeEntry.index));
                 }
                 stringBuilder.Append('[');
                 stringBuilder.Append(NGUIText.EncodeAlpha(fadeEntry.alpha));
                 stringBuilder.Append(']');
                 stringBuilder.Append(fadeEntry.text);
             }
             if (this.keepFullDimensions)
             {
                 stringBuilder.Append("[00]");
                 stringBuilder.Append(this.mFullText.Substring(this.mCurrentOffset));
             }
             this.mLabel.text = stringBuilder.ToString();
         }
     }
     else if (this.mCurrentOffset == this.mFullText.Length)
     {
         CustomTypewriterEffect.current = this;
         EventDelegate.Execute(this.onFinished);
         CustomTypewriterEffect.current = null;
         this.mActive = false;
     }
 }