static void TextMesh_alignment(JSVCall vc) { if (vc.bGet) { UnityEngine.TextMesh _this = (UnityEngine.TextMesh)vc.csObj; var result = _this.alignment; JSApi.setEnum((int)JSApi.SetType.Rval, (int)result); } else { UnityEngine.TextAlignment arg0 = (UnityEngine.TextAlignment)JSApi.getEnum((int)JSApi.GetType.Arg); UnityEngine.TextMesh _this = (UnityEngine.TextMesh)vc.csObj; _this.alignment = arg0; } }
private void renderText(dfRenderData textBuffer) { int num; float units = base.PixelsToUnits(); Vector2 vector2 = new Vector2(this.size.x - (float)this.padding.horizontal, this.size.y - (float)this.padding.vertical); Vector3 upperLeft = this.pivot.TransformToUpperLeft(base.Size); Vector3 vector3 = new Vector3(upperLeft.x + (float)this.padding.left, upperLeft.y - (float)this.padding.top, 0f) * units; string str = (!this.IsPasswordField || string.IsNullOrEmpty(this.passwordChar) ? this.text : this.passwordDisplayText()); Color32 color32 = (!base.IsEnabled ? base.DisabledColor : this.TextColor); float textScaleMultiplier = this.getTextScaleMultiplier(); using (dfFontRendererBase textScale = this.font.ObtainRenderer()) { textScale.WordWrap = false; textScale.MaxSize = vector2; textScale.PixelRatio = units; textScale.TextScale = this.TextScale * textScaleMultiplier; textScale.VectorOffset = vector3; textScale.MultiLine = false; textScale.TextAlign = UnityEngine.TextAlignment.Left; textScale.ProcessMarkup = false; textScale.DefaultColor = color32; textScale.BottomColor = new Color32?(color32); textScale.OverrideMarkupColors = false; textScale.Opacity = base.CalculateOpacity(); textScale.Shadow = this.Shadow; textScale.ShadowColor = this.ShadowColor; textScale.ShadowOffset = this.ShadowOffset; this.cursorIndex = Mathf.Min(this.cursorIndex, str.Length); this.scrollIndex = Mathf.Min(Mathf.Min(this.scrollIndex, this.cursorIndex), str.Length); this.charWidths = textScale.GetCharacterWidths(str); Vector2 vector21 = vector2 * units; this.leftOffset = 0f; if (this.textAlign != UnityEngine.TextAlignment.Left) { this.scrollIndex = Mathf.Max(0, Mathf.Min(this.cursorIndex, str.Length - 1)); float single = 0f; float fontSize = (float)this.font.FontSize * 1.25f * units; while (this.scrollIndex > 0 && single < vector21.x - fontSize) { float[] singleArray = this.charWidths; dfTextbox _dfTextbox = this; int num1 = _dfTextbox.scrollIndex; num = num1; _dfTextbox.scrollIndex = num1 - 1; single = single + singleArray[num]; } float single1 = (str.Length <= 0 ? 0f : textScale.GetCharacterWidths(str.Substring(this.scrollIndex)).Sum()); UnityEngine.TextAlignment textAlignment = this.textAlign; if (textAlignment == UnityEngine.TextAlignment.Center) { this.leftOffset = Mathf.Max(0f, (vector21.x - single1) * 0.5f); } else if (textAlignment == UnityEngine.TextAlignment.Right) { this.leftOffset = Mathf.Max(0f, vector21.x - single1); } vector3.x = vector3.x + this.leftOffset; textScale.VectorOffset = vector3; } else { float single2 = 0f; for (int i = this.scrollIndex; i < this.cursorIndex; i++) { single2 = single2 + this.charWidths[i]; } while (single2 >= vector21.x && this.scrollIndex < this.cursorIndex) { float[] singleArray1 = this.charWidths; dfTextbox _dfTextbox1 = this; int num2 = _dfTextbox1.scrollIndex; num = num2; _dfTextbox1.scrollIndex = num2 + 1; single2 = single2 - singleArray1[num]; } } if (this.selectionEnd != this.selectionStart) { this.renderSelection(this.scrollIndex, this.charWidths, this.leftOffset); } else if (this.cursorShown) { this.renderCursor(this.scrollIndex, this.cursorIndex, this.charWidths, this.leftOffset); } textScale.Render(str.Substring(this.scrollIndex), textBuffer); } }