void OnLostFocus(EventCallBack eventCall, UserAction action) { TextInput text = eventCall as TextInput; if (text == InputEvent) { if (InputEvent.OnSubmit != null) { InputEvent.OnSubmit(InputEvent); } InputEvent = null; } Editing = false; SetShowText(); ThreadMission.InvokeToMain((o) => { Keyboard.EndInput(); }, null); }
public static void SetCurrentInput(TextInput input, UserAction action) { if (input == null) { return; } if (InputEvent == input) { return; } if (InputEvent != null) { InputEvent.LostFocus(InputEvent, action); } InputEvent = input; InputEvent.Editing = true; }
void OnClick(EventCallBack eventCall, UserAction action) { TextInput input = eventCall as TextInput; if (input == null) { return; } InputEvent = input; textInfo.startSelect = GetPressIndex(textInfo, this, action, ref textInfo.startDock); textInfo.endSelect = -1; textInfo.CaretStyle = 1; ChangePoint(textInfo); bool pass = InputEvent.contentType == ContentType.Password ? true : false; Keyboard.OnInput(textInfo.text, InputEvent.touchType, InputEvent.multiLine, pass, CharacterLimit); InputCaret.SetParent(Target); InputCaret.ChangeCaret(textInfo); }
void OnClick(EventCallBack eventCall, UserAction action) { TextInput input = eventCall as TextInput; if (input == null) { return; } InputEvent = input; textInfo.startSelect = GetPressIndex(textInfo, this, action, ref textInfo.startDock) + textInfo.StartIndex; textInfo.endSelect = -1; textInfo.CaretStyle = 1; selectChanged = true; ThreadMission.InvokeToMain((o) => { bool pass = InputEvent.contentType == ContentType.Password ? true : false; Keyboard.OnInput(textInfo.text, InputEvent.touchType, InputEvent.multiLine, pass, CharacterLimit); InputCaret.SetParent(Context.Context); InputCaret.ChangeCaret(textInfo); }, null); }
static void ChangePoint(TextInfo info, TextInput input) { int index = info.startSelect - info.StartIndex; if (index < 0) { index = 0; } var text = info.buffer.FilterString; if (text == null | text == "") { index = 0; } else if (index > text.Length) { index = text.Length; } Vector3 Point = Vector3.zero; var o = GetIndexPoint(info, index, ref Point); var vert = info.selectVertex; var tri = info.selectTri; vert.Clear(); tri.Clear(); if (o) { float left = Point.x - 1; float right = Point.x + 1; float h = Point.z; h *= 0.4f; float top = Point.y + h; float down = Point.y - h; var v = new UIVertex(); v.position.x = left; v.position.y = down; v.color = info.caretColor; vert.Add(v); v.position.x = left; v.position.y = top; v.color = info.caretColor; vert.Add(v); v.position.x = right; v.position.y = down; v.color = info.caretColor; vert.Add(v); v.position.x = right; v.position.y = top; v.color = info.caretColor; vert.Add(v); } else { var v = new UIVertex(); vert.Add(v); vert.Add(v); vert.Add(v); vert.Add(v); } tri.Add(0); tri.Add(1); tri.Add(2); tri.Add(2); tri.Add(1); tri.Add(3); }