예제 #1
0
 // Token: 0x06000403 RID: 1027 RVA: 0x0002C58C File Offset: 0x0002A78C
 protected void Add(string text, bool updateVisible)
 {
     UITextList.Paragraph paragraph;
     if (this.mParagraphs.Count < this.maxEntries)
     {
         paragraph = new UITextList.Paragraph();
     }
     else
     {
         paragraph = this.mParagraphs[0];
         this.mParagraphs.RemoveAt(0);
     }
     paragraph.text = text;
     this.mParagraphs.Add(paragraph);
     if (this.textLabel != null && this.textLabel.font != null)
     {
         paragraph.lines  = this.textLabel.font.WrapText(paragraph.text, this.maxWidth / this.textLabel.transform.localScale.y, this.textLabel.maxLineCount, this.textLabel.supportEncoding, this.textLabel.symbolStyle).Split(this.mSeparator);
         this.mTotalLines = 0;
         int i     = 0;
         int count = this.mParagraphs.Count;
         while (i < count)
         {
             this.mTotalLines += this.mParagraphs[i].lines.Length;
             i++;
         }
     }
     if (updateVisible)
     {
         this.UpdateVisibleText();
     }
 }
예제 #2
0
 // Token: 0x06000406 RID: 1030 RVA: 0x0002C7A8 File Offset: 0x0002A9A8
 protected void UpdateVisibleText()
 {
     if (this.textLabel != null)
     {
         UIFont font = this.textLabel.font;
         if (font != null)
         {
             int num  = 0;
             int num2 = (this.maxHeight <= 0f) ? 100000 : Mathf.FloorToInt(this.maxHeight / this.textLabel.cachedTransform.localScale.y);
             int num3 = Mathf.RoundToInt(this.mScroll);
             if (num2 + num3 > this.mTotalLines)
             {
                 num3         = Mathf.Max(0, this.mTotalLines - num2);
                 this.mScroll = (float)num3;
             }
             if (this.style == UITextList.Style.Chat)
             {
                 num3 = Mathf.Max(0, this.mTotalLines - num2 - num3);
             }
             StringBuilder stringBuilder = new StringBuilder();
             int           i             = 0;
             int           count         = this.mParagraphs.Count;
             while (i < count)
             {
                 UITextList.Paragraph paragraph = this.mParagraphs[i];
                 int j    = 0;
                 int num4 = paragraph.lines.Length;
                 while (j < num4)
                 {
                     string value = paragraph.lines[j];
                     if (num3 > 0)
                     {
                         num3--;
                     }
                     else
                     {
                         if (stringBuilder.Length > 0)
                         {
                             stringBuilder.Append("\n");
                         }
                         stringBuilder.Append(value);
                         num++;
                         if (num >= num2)
                         {
                             break;
                         }
                     }
                     j++;
                 }
                 if (num >= num2)
                 {
                     break;
                 }
                 i++;
             }
             this.textLabel.text = stringBuilder.ToString();
         }
     }
 }
예제 #3
0
 // Token: 0x0600090F RID: 2319 RVA: 0x00047EFC File Offset: 0x000460FC
 protected void Add(string text, bool updateVisible)
 {
     UITextList.Paragraph paragraph;
     if (this.paragraphs.size < this.paragraphHistory)
     {
         paragraph = new UITextList.Paragraph();
     }
     else
     {
         paragraph = this.mParagraphs.buffer[0];
         this.mParagraphs.RemoveAt(0);
     }
     paragraph.text = text;
     this.mParagraphs.Add(paragraph);
     this.Rebuild();
 }
예제 #4
0
 // Token: 0x06000911 RID: 2321 RVA: 0x000480B8 File Offset: 0x000462B8
 protected void UpdateVisibleText()
 {
     if (this.isValid)
     {
         if (this.mTotalLines == 0)
         {
             this.textLabel.text = "";
             return;
         }
         int num  = Mathf.FloorToInt((float)this.textLabel.height / this.lineHeight);
         int num2 = Mathf.Max(0, this.mTotalLines - num);
         int num3 = Mathf.RoundToInt(this.mScroll * (float)num2);
         if (num3 < 0)
         {
             num3 = 0;
         }
         StringBuilder stringBuilder = new StringBuilder();
         int           num4          = 0;
         int           size          = this.paragraphs.size;
         while (num > 0 && num4 < size)
         {
             UITextList.Paragraph paragraph = this.mParagraphs.buffer[num4];
             int num5 = 0;
             int num6 = paragraph.lines.Length;
             while (num > 0 && num5 < num6)
             {
                 string value = paragraph.lines[num5];
                 if (num3 > 0)
                 {
                     num3--;
                 }
                 else
                 {
                     if (stringBuilder.Length > 0)
                     {
                         stringBuilder.Append("\n");
                     }
                     stringBuilder.Append(value);
                     num--;
                 }
                 num5++;
             }
             num4++;
         }
         this.textLabel.text = stringBuilder.ToString();
     }
 }
예제 #5
0
 protected void Rebuild()
 {
     if (this.isValid)
     {
         this.textLabel.UpdateNGUIText();
         NGUIText.rectHeight = 1000000;
         this.mTotalLines    = 0;
         bool flag = true;
         for (int i = 0; i < this.mParagraphs.size; i++)
         {
             UITextList.Paragraph paragraph = this.mParagraphs.buffer[i];
             string text;
             if (!NGUIText.WrapText(paragraph.text, out text))
             {
                 flag = false;
                 break;
             }
             paragraph.lines = text.Split(new char[]
             {
                 '\n'
             });
             this.mTotalLines += paragraph.lines.Length;
         }
         this.mTotalLines = 0;
         if (flag)
         {
             int j    = 0;
             int size = this.mParagraphs.size;
             while (j < size)
             {
                 this.mTotalLines += this.mParagraphs.buffer[j].lines.Length;
                 j++;
             }
         }
         if (this.scrollBar != null)
         {
             UIScrollBar uIScrollBar = this.scrollBar as UIScrollBar;
             if (uIScrollBar != null)
             {
                 uIScrollBar.barSize = ((this.mTotalLines != 0) ? (1f - (float)this.scrollHeight / (float)this.mTotalLines) : 1f);
             }
         }
         this.UpdateVisibleText();
     }
 }
예제 #6
0
 // Token: 0x06000910 RID: 2320 RVA: 0x00047F5C File Offset: 0x0004615C
 protected void Rebuild()
 {
     if (this.isValid)
     {
         this.mLastWidth  = this.textLabel.width;
         this.mLastHeight = this.textLabel.height;
         this.textLabel.UpdateNGUIText();
         NGUIText.rectHeight   = 1000000;
         NGUIText.regionHeight = 1000000;
         this.mTotalLines      = 0;
         for (int i = 0; i < this.paragraphs.size; i++)
         {
             UITextList.Paragraph paragraph = this.mParagraphs.buffer[i];
             string text;
             NGUIText.WrapText(paragraph.text, out text, false, true, false);
             paragraph.lines = text.Split(new char[]
             {
                 '\n'
             });
             this.mTotalLines += paragraph.lines.Length;
         }
         this.mTotalLines = 0;
         int j    = 0;
         int size = this.mParagraphs.size;
         while (j < size)
         {
             this.mTotalLines += this.mParagraphs.buffer[j].lines.Length;
             j++;
         }
         if (this.scrollBar != null)
         {
             UIScrollBar uiscrollBar = this.scrollBar as UIScrollBar;
             if (uiscrollBar != null)
             {
                 uiscrollBar.barSize = ((this.mTotalLines == 0) ? 1f : (1f - (float)this.scrollHeight / (float)this.mTotalLines));
             }
         }
         this.UpdateVisibleText();
     }
 }
예제 #7
0
 protected void Rebuild()
 {
     if (this.isValid)
     {
         this.mLastWidth  = this.textLabel.width;
         this.mLastHeight = this.textLabel.height;
         this.textLabel.UpdateNGUIText();
         NGUIText.rectHeight   = 1000000;
         NGUIText.regionHeight = 1000000;
         this.mTotalLines      = 0;
         for (Int32 i = 0; i < this.paragraphs.size; i++)
         {
             UITextList.Paragraph paragraph = this.mParagraphs.buffer[i];
             String text;
             NGUIText.WrapText(paragraph.text, out text, false, true);
             paragraph.lines = text.Split(new Char[]
             {
                 '\n'
             });
             this.mTotalLines += (Int32)paragraph.lines.Length;
         }
         this.mTotalLines = 0;
         Int32 j    = 0;
         Int32 size = this.mParagraphs.size;
         while (j < size)
         {
             this.mTotalLines += (Int32)this.mParagraphs.buffer[j].lines.Length;
             j++;
         }
         if (this.scrollBar != (UnityEngine.Object)null)
         {
             UIScrollBar uiscrollBar = this.scrollBar as UIScrollBar;
             if (uiscrollBar != (UnityEngine.Object)null)
             {
                 uiscrollBar.barSize = ((this.mTotalLines != 0) ? (1f - (Single)this.scrollHeight / (Single)this.mTotalLines) : 1f);
             }
         }
         this.UpdateVisibleText();
     }
 }
예제 #8
0
 protected void Add(string text, bool updateVisible)
 {
     UITextList.Paragraph item = null;
     if (this.mParagraphs.Count >= this.maxEntries)
     {
         item = this.mParagraphs[0];
         this.mParagraphs.RemoveAt(0);
     }
     else
     {
         item = new UITextList.Paragraph();
     }
     item.text = text;
     this.mParagraphs.Add(item);
     if (this.textLabel != null && this.textLabel.font != null)
     {
         UIFont uIFont = this.textLabel.font;
         List<UITextMarkup> uITextMarkups = UIFont.tempMarkup;
         string str = item.text;
         float single = this.maxWidth;
         Vector3 vector3 = this.textLabel.transform.localScale;
         item.lines = uIFont.WrapText(uITextMarkups, str, single / vector3.y, this.textLabel.maxLineCount, this.textLabel.supportEncoding, this.textLabel.symbolStyle).Split(this.mSeparator);
         this.mTotalLines = 0;
         int num = 0;
         int count = this.mParagraphs.Count;
         while (num < count)
         {
             UITextList length = this;
             length.mTotalLines = length.mTotalLines + (int)this.mParagraphs[num].lines.Length;
             num++;
         }
     }
     if (updateVisible)
     {
         this.UpdateVisibleText();
     }
 }
예제 #9
0
 protected void Add(string text, bool updateVisible)
 {
     UITextList.Paragraph item = null;
     if (this.mParagraphs.Count >= this.maxEntries)
     {
         item = this.mParagraphs[0];
         this.mParagraphs.RemoveAt(0);
     }
     else
     {
         item = new UITextList.Paragraph();
     }
     item.text = text;
     this.mParagraphs.Add(item);
     if (this.textLabel != null && this.textLabel.font != null)
     {
         UIFont uIFont = this.textLabel.font;
         List <UITextMarkup> uITextMarkups = UIFont.tempMarkup;
         string  str     = item.text;
         float   single  = this.maxWidth;
         Vector3 vector3 = this.textLabel.transform.localScale;
         item.lines       = uIFont.WrapText(uITextMarkups, str, single / vector3.y, this.textLabel.maxLineCount, this.textLabel.supportEncoding, this.textLabel.symbolStyle).Split(this.mSeparator);
         this.mTotalLines = 0;
         int num   = 0;
         int count = this.mParagraphs.Count;
         while (num < count)
         {
             UITextList length = this;
             length.mTotalLines = length.mTotalLines + (int)this.mParagraphs[num].lines.Length;
             num++;
         }
     }
     if (updateVisible)
     {
         this.UpdateVisibleText();
     }
 }
예제 #10
0
 protected void Add(string text, bool updateVisible)
 {
     UITextList.Paragraph paragraph;
     if (this.mParagraphs.size < this.paragraphHistory)
     {
         paragraph = new UITextList.Paragraph();
     }
     else
     {
         paragraph = this.mParagraphs[0];
         this.mParagraphs.RemoveAt(0);
     }
     paragraph.text = text;
     this.mParagraphs.Add(paragraph);
     this.Rebuild();
 }
예제 #11
0
    protected void UpdateVisibleText()
    {
        int num;

        if (this.textLabel != null && this.textLabel.font != null)
        {
            int num1 = 0;
            if (this.maxHeight <= 0f)
            {
                num = 100000;
            }
            else
            {
                float   single  = this.maxHeight;
                Vector3 vector3 = this.textLabel.cachedTransform.localScale;
                num = Mathf.FloorToInt(single / vector3.y);
            }
            int num2 = num;
            int num3 = Mathf.RoundToInt(this.mScroll);
            if (num2 + num3 > this.mTotalLines)
            {
                num3         = Mathf.Max(0, this.mTotalLines - num2);
                this.mScroll = (float)num3;
            }
            if (this.style == UITextList.Style.Chat)
            {
                num3 = Mathf.Max(0, this.mTotalLines - num2 - num3);
            }
            string empty = string.Empty;
            int    num4  = 0;
            int    count = this.mParagraphs.Count;
            while (num4 < count)
            {
                UITextList.Paragraph item = this.mParagraphs[num4];
                int num5   = 0;
                int length = (int)item.lines.Length;
                while (num5 < length)
                {
                    string str = item.lines[num5];
                    if (num3 <= 0)
                    {
                        if (empty.Length > 0)
                        {
                            empty = string.Concat(empty, "\n");
                        }
                        empty = string.Concat(empty, str);
                        num1++;
                        if (num1 >= num2)
                        {
                            break;
                        }
                    }
                    else
                    {
                        num3--;
                    }
                    num5++;
                }
                if (num1 < num2)
                {
                    num4++;
                }
                else
                {
                    break;
                }
            }
            this.textLabel.text = empty;
        }
    }