/// <summary>Initializes a new instance of the <see cref="VisualTextBox" /> class.</summary> public VisualTextBox() { SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true); // Contains another control SetStyle(ControlStyles.ContainerControl, true); // Cannot select this control, only the child and does not generate a click event SetStyle(ControlStyles.Selectable | ControlStyles.StandardClick, false); _borderButton = new BorderEdge { Visible = false }; _borderImage = new BorderEdge { Visible = false }; _textWidth = GetTextBoxWidth(); _border = new Border(); ThemeManager = new StyleManager(Settings.DefaultValue.DefaultStyle); _backColorState = new ColorState { Enabled = ThemeManager.Theme.ColorPalette.ControlEnabled }; _textBox = new TextBoxExtended { Size = new Size(125, 25), Location = new Point(_border.BorderCurve, _border.BorderCurve), Text = string.Empty, BorderStyle = BorderStyle.None, TextAlign = HorizontalAlignment.Left, Font = Font, ForeColor = ForeColor, BackColor = _backColorState.Enabled, Multiline = false }; _imageWidth = 35; _buttonFont = Font; _buttonIndent = 3; _buttontext = "visualButton"; _image = null; _imageSize = new Size(16, 16); _watermark = new Watermark(); _buttonBorder = new Border(); _textBox.KeyDown += TextBox_KeyDown; _textBox.Leave += OnLeave; _textBox.Enter += OnEnter; _textBox.GotFocus += OnEnter; _textBox.LostFocus += OnLeave; _textBox.MouseLeave += OnLeave; _textBox.TextChanged += TextBox_TextChanged; _textBox.SizeChanged += TextBox_SizeChanged; Controls.Add(_textBox); Controls.Add(_borderButton); Controls.Add(_borderImage); _waterMarkContainer = null; Size = new Size(135, 25); if (_watermark.Visible) { DrawWaterMark(); } UpdateTheme(ThemeManager.Theme); }
// 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(); } }