Beispiel #1
0
 // Token: 0x06001D5A RID: 7514 RVA: 0x0008BEB4 File Offset: 0x0008A0B4
 public void SetMessageFade(float time)
 {
     if (this.TextBox.textRenderers != null)
     {
         foreach (TextRenderer textRenderer in this.TextBox.textRenderers)
         {
             MoonTextMeshRenderer moonTextMeshRenderer = textRenderer as MoonTextMeshRenderer;
             if (moonTextMeshRenderer != null)
             {
                 Renderer component = moonTextMeshRenderer.GetComponent <Renderer>();
                 if (component)
                 {
                     float val = time / this.FadeSpread;
                     UberShaderAPI.SetFloat(component, val, "_TxtTime", true);
                 }
             }
         }
     }
 }
Beispiel #2
0
 // Token: 0x06001D5C RID: 7516
 public void RefreshText()
 {
     if (this.m_forceLanguage)
     {
         this.TextBox.SetStyleCollection(this.LanguageStyles.GetStyle(this.m_language));
     }
     else
     {
         this.TextBox.SetStyleCollection(this.LanguageStyles.Current);
     }
     if (this.MessageProvider)
     {
         this.m_messageDescriptors = this.MessageProvider.GetMessages().ToArray <MessageDescriptor>();
         this.MessageIndex         = Mathf.Clamp(this.MessageIndex, 0, this.m_messageDescriptors.Length);
         this.m_currentMessage     = this.m_messageDescriptors[this.MessageIndex];
         string text = this.m_currentMessage.Message;
         if (text.StartsWith("ALIGNLEFT"))
         {
             this.TextBox.alignment = AlignmentMode.Left;
             text = text.Substring(9);
         }
         else if (text.StartsWith("ALIGNRIGHT"))
         {
             this.TextBox.alignment = AlignmentMode.Right;
             text = text.Substring(10);
         }
         if (text.StartsWith("ANCHORTOP"))
         {
             this.TextBox.verticalAnchor = VerticalAnchorMode.Top;
             text = text.Substring(9);
         }
         else if (text.StartsWith("ANCHORBOT"))
         {
             this.TextBox.verticalAnchor = VerticalAnchorMode.Bottom;
             text = text.Substring(9);
         }
         if (text.StartsWith("ANCHORLEFT"))
         {
             this.TextBox.horizontalAnchor = HorizontalAnchorMode.Left;
             text = text.Substring(10);
         }
         else if (text.StartsWith("ANCHORRIGHT"))
         {
             this.TextBox.horizontalAnchor = HorizontalAnchorMode.Right;
             text = text.Substring(11);
         }
         if (text.StartsWith("PADDING"))
         {
             Queue <string> p = new Queue <string>(text.Split(new char[] { '_' }));
             p.Dequeue();
             this.TextBox.paddingBottom = float.Parse(p.Dequeue());
             this.TextBox.paddingLeft   = float.Parse(p.Dequeue());
             this.TextBox.paddingRight  = float.Parse(p.Dequeue());
             this.TextBox.paddingTop    = float.Parse(p.Dequeue());
             text = string.Join("_", p.ToArray());
         }
         if (text.StartsWith("PARAMS"))
         {
             Queue <string> p = new Queue <string>(text.Split(new char[] { '_' }));
             p.Dequeue();
             this.TextBox.maxHeight = float.Parse(p.Dequeue());
             this.TextBox.width     = float.Parse(p.Dequeue());
             this.TextBox.TabSize   = float.Parse(p.Dequeue());
             text = string.Join("_", p.ToArray());
         }
         if (text.StartsWith("SHOWINFO"))
         {
             text = string.Concat(new string[]
             {
                 text.Substring(8),
                 "\nHeight: ",
                 this.TextBox.maxHeight.ToString(),
                 " width: ",
                 this.TextBox.width.ToString(),
                 "TabSize ",
                 this.TextBox.size.ToString(),
                 "\n Anchors ",
                 this.TextBox.horizontalAnchor.ToString(),
                 " ",
                 this.TextBox.verticalAnchor.ToString(),
                 "\nPadding: ",
                 this.TextBox.paddingBottom.ToString(),
                 "/",
                 this.TextBox.paddingLeft.ToString(),
                 "/",
                 this.TextBox.paddingRight.ToString(),
                 "/",
                 this.TextBox.paddingTop.ToString()
             });
         }
         if (this.FormatText)
         {
             text = MessageParserUtility.ProcessString(text);
             this.TextBox.SetText(text);
         }
         else
         {
             this.TextBox.SetText(text);
         }
     }
     else if (this.OverrideText != string.Empty)
     {
         if (this.FormatText)
         {
             this.TextBox.SetText(MessageParserUtility.ProcessString(this.OverrideText));
         }
         else
         {
             this.TextBox.SetText(this.OverrideText);
         }
     }
     this.TextBox.CreateRendersIfThereAreNone();
     TextRenderer[] textRenderers = this.TextBox.textRenderers;
     for (int i = 0; i < textRenderers.Length; i++)
     {
         MoonTextMeshRenderer moonTextMeshRenderer = textRenderers[i] as MoonTextMeshRenderer;
         if (moonTextMeshRenderer)
         {
             moonTextMeshRenderer.FadeSpread = this.FadeSpread;
         }
     }
     this.TextBox.size = this.ScaleOverLetterCount.Evaluate((float)TextBoxExtended.CountLetters(this.TextBox));
     this.TextBox.RenderText();
     if (this.WriteOutTextBox)
     {
         this.WriteOutTextBox.OnTextChange();
     }
     else
     {
         this.RemoveMessageFade();
     }
     if (this.m_avatarPrefabs != null)
     {
         this.SetAvatar(this.m_avatarPrefabs[this.MessageIndex]);
     }
     if (!Application.isPlaying)
     {
         this.RemoveMessageFade();
     }
 }