internal override void DoRepaint(IStylePainter painter) { if (this.touchScreenTextField) { TouchScreenTextEditorEventHandler touchScreenTextEditorEventHandler = this.editorEventHandler as TouchScreenTextEditorEventHandler; if (touchScreenTextEditorEventHandler != null && this.editorEngine.keyboardOnScreen != null) { this.UpdateText(this.CullString(this.editorEngine.keyboardOnScreen.text)); if (this.editorEngine.keyboardOnScreen.status != TouchScreenKeyboard.Status.Visible) { this.editorEngine.keyboardOnScreen = null; GUI.changed = true; } } string text = this.text; if (touchScreenTextEditorEventHandler != null && !string.IsNullOrEmpty(touchScreenTextEditorEventHandler.secureText)) { text = "".PadRight(touchScreenTextEditorEventHandler.secureText.Length, this.maskChar); } base.DoRepaint(painter); this.text = text; } else if (!this.hasFocus) { base.DoRepaint(painter); } else { this.DrawWithTextSelectionAndCursor(painter, this.text); } }
public TextInputFieldBase(int maxLength, char maskChar) { this.maxLength = maxLength; this.maskChar = maskChar; editorEngine = new TextEditorEngine(this); if (touchScreenTextField) { editorEventHandler = new TouchScreenTextEditorEventHandler(editorEngine, this); } else { // TODO: Default values should come from GUI.skin.settings doubleClickSelectsWord = true; tripleClickSelectsLine = true; editorEventHandler = new KeyboardTextEditorEventHandler(editorEngine, this); } // Make the editor style unique across all textfields editorEngine.style = new GUIStyle(editorEngine.style); // TextField are focusable by default. focusIndex = 0; }
public TextInputFieldBase(int maxLength, char maskChar) { requireMeasureFunction = true; m_Text = ""; this.maxLength = maxLength; this.maskChar = maskChar; editorEngine = new TextEditorEngine(OnDetectFocusChange, OnCursorIndexChange); if (touchScreenTextField) { editorEventHandler = new TouchScreenTextEditorEventHandler(editorEngine, this); } else { // TODO: Default values should come from GUI.skin.settings doubleClickSelectsWord = true; tripleClickSelectsLine = true; editorEventHandler = new KeyboardTextEditorEventHandler(editorEngine, this); } // Make the editor style unique across all textfields editorEngine.style = new GUIStyle(editorEngine.style); }
internal override void DoRepaint(IStylePainter painter) { // When this is used, we can get rid of the content.text trick and use mask char directly in the text to print if (touchScreenTextField) { TouchScreenTextEditorEventHandler touchScreenEditor = editorEventHandler as TouchScreenTextEditorEventHandler; if (touchScreenEditor != null && editorEngine.keyboardOnScreen != null) { UpdateText(CullString(editorEngine.keyboardOnScreen.text)); if (editorEngine.keyboardOnScreen.status != TouchScreenKeyboard.Status.Visible) { editorEngine.keyboardOnScreen = null; GUI.changed = true; } } // if we use system keyboard we will have normal text returned (hiding symbols is done inside os) // so before drawing make sure we hide them ourselves string drawText = text; if (touchScreenEditor != null && !string.IsNullOrEmpty(touchScreenEditor.secureText)) { drawText = "".PadRight(touchScreenEditor.secureText.Length, maskChar); } base.DoRepaint(painter); text = drawText; } else { if (!hasFocus) { base.DoRepaint(painter); } else { DrawWithTextSelectionAndCursor(painter, text); } } }