Exemple #1
0
 private void ProcessText()
 {
     float single;
     base.ChangedAuto();
     this.mLastText = this.mText;
     this.markups.Clear();
     string str = this.mProcessedText;
     this.mProcessedText = this.mText;
     if (this.mPassword)
     {
         this.mProcessedText = this.mFont.WrapText(this.markups, this.mProcessedText, 100000f, 1, false, UIFont.SymbolStyle.None);
         string empty = string.Empty;
         if (!this.mShowLastChar)
         {
             int num = 0;
             int length = this.mProcessedText.Length;
             while (num < length)
             {
                 empty = string.Concat(empty, "*");
                 num++;
             }
         }
         else
         {
             int num1 = 1;
             int length1 = this.mProcessedText.Length;
             while (num1 < length1)
             {
                 empty = string.Concat(empty, "*");
                 num1++;
             }
             if (this.mProcessedText.Length > 0)
             {
                 empty = string.Concat(empty, this.mProcessedText[this.mProcessedText.Length - 1]);
             }
         }
         this.mProcessedText = empty;
     }
     else if (this.mMaxLineWidth > 0)
     {
         UIFont uIFont = this.mFont;
         List<UITextMarkup> uITextMarkups = this.markups;
         string str1 = this.mProcessedText;
         float single1 = (float)this.mMaxLineWidth;
         Vector3 vector3 = base.cachedTransform.localScale;
         this.mProcessedText = uIFont.WrapText(uITextMarkups, str1, single1 / vector3.x, this.mMaxLineCount, this.mEncoding, this.mSymbols);
     }
     else if (this.mMaxLineCount > 0)
     {
         this.mProcessedText = this.mFont.WrapText(this.markups, this.mProcessedText, 100000f, this.mMaxLineCount, this.mEncoding, this.mSymbols);
     }
     this.mSize = (string.IsNullOrEmpty(this.mProcessedText) ? Vector2.one : this.mFont.CalculatePrintedSize(this.mProcessedText, this.mEncoding, this.mSymbols));
     float single2 = base.cachedTransform.localScale.x;
     float single3 = this.mSize.x;
     single = (!(this.mFont != null) || single2 <= 1f ? 1f : (float)this.lineWidth / single2);
     this.mSize.x = Mathf.Max(single3, single);
     this.mSize.y = Mathf.Max(this.mSize.y, 1f);
     if (str != this.mProcessedText)
     {
         this.mSelection = new UITextSelection();
     }
     this.ApplyChanges();
 }
Exemple #2
0
 public UITextSelection ConvertUnprocessedSelection(int carratPos, int selectPos)
 {
     UITextSelection uITextSelection = new UITextSelection();
     uITextSelection.carratPos = this.ConvertUnprocessedPosition(carratPos);
     if (carratPos != selectPos)
     {
         uITextSelection.selectPos = this.ConvertUnprocessedPosition(selectPos);
     }
     else
     {
         uITextSelection.selectPos = uITextSelection.carratPos;
     }
     return uITextSelection;
 }
 public UITextSelection.Change GetChangesTo(ref UITextSelection value)
 {
     UITextSelection.Change change;
     if (!this.carratPos.valid)
     {
         if (!value.carratPos.valid)
         {
             change = UITextSelection.Change.None;
         }
         else
         {
             change = (!value.hasSelection ? UITextSelection.Change.NoneToCarrat : UITextSelection.Change.NoneToSelection);
         }
     }
     else if (!value.carratPos.valid)
     {
         change = (!this.hasSelection ? UITextSelection.Change.CarratToNone : UITextSelection.Change.SelectionToNone);
     }
     else if (this.hasSelection)
     {
         if (value.hasSelection)
         {
             change = (value.carratPos.position != this.carratPos.position || value.selectPos.position != this.selectPos.position ? UITextSelection.Change.SelectionAdjusted : UITextSelection.Change.None);
         }
         else
         {
             change = UITextSelection.Change.SelectionToCarrat;
         }
     }
     else if (!value.hasSelection)
     {
         change = (value.carratPos.position == this.carratPos.position ? UITextSelection.Change.None : UITextSelection.Change.CarratMove);
     }
     else
     {
         change = UITextSelection.Change.CarratToSelection;
     }
     return change;
 }