public void updateCharInfo() { string t = input.text; if (t.Length >= 3 && t.Length - lenTime > 0) { if (t.Length == 3) { t = t.Insert(1, ":"); input.text = t; input.MoveToEndOfLine(false, false); } else if (t.Length == 5) { lenTime = t.Length; string[] tArr = t.Split(':'); t = tArr[0] + tArr[1].Substring(0, 1) + ":" + tArr[1].Substring(1); input.text = t; input.MoveToEndOfLine(false, false); } } else if (t.Length >= 2 && t.Length - lenTime < 0) { if (t.Length == 4) { lenTime = t.Length; string[] tArr = t.Split(':'); t = tArr[0].Substring(0, 1) + ":" + tArr[0].Substring(1, 1) + tArr[1].Substring(0); input.text = t; input.MoveToEndOfLine(false, false); } else if (t.Length == 3) { lenTime = t.Length; t = t.Remove(1, 1); input.text = t; input.MoveToEndOfLine(false, false); } } lenTime = t.Length; }
private void AutoComplete() { m_isAutoCompleting = true; ++m_autoCompleteCandidateIndex; if (m_autoCompleteCandidateIndex >= m_autoCompleteCandidateList.Count) { m_autoCompleteCandidateIndex = 0; } var completion = m_autoCompleteCandidateList[m_autoCompleteCandidateIndex].key + " "; m_inputField.text = completion; m_autoCompleteTextMesh.text = completion; m_inputField.MoveToEndOfLine(false, false); }
public void updateCharInfo() { string t = input.text; if (t.Length == 6 || t.Length == 3) { if (t.Substring(t.Length - 1, 1) != "/" && t.Length - lenDate > 0) { t = t.Insert(t.Length - 1, "/"); Debug.Log(t.Length - 1); input.text = t; input.MoveToEndOfLine(false, false); } } lenDate = t.Length; FindObjectOfType <TaskEditorLogic>().date = date; }
public virtual void OnTab(CallbackContext context) { if (!context.performed || this == null) { return; } var system = EventSystem.current; try { Selectable selected = system.currentSelectedGameObject.GetComponent <Selectable>(); Selectable next; if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { next = selected.FindSelectableOnUp(); } else { next = selected.FindSelectableOnDown(); } if (next != null) { TMP_InputField inputfield = next.GetComponent <TMP_InputField>(); if (inputfield != null) { inputfield.MoveToEndOfLine(false, false); //if it's an input field, also set the text caret } system.SetSelectedGameObject(next.gameObject, new BaseEventData(system)); } } catch (Exception) { // If there's an error select the default selectable system.SetSelectedGameObject(GetDefault(), new BaseEventData(system)); } }
private void Update() { if (shouldReselect) { field.Select(); } if (Input.GetKeyDown(KeyCode.F1)) { suggestions.gameObject.SetActive(!suggestions.gameObject.activeSelf); if (suggestions.gameObject.activeSelf) { OnValueChange(); } } if (Input.GetKeyDown(KeyCode.Tab) && suggestions.HasChoices) { tabbing = true; suggestions.Selected++; suggestionSelectionHandler?.Invoke(suggestions.SelectedValue); field.MoveToEndOfLine(false, false); } else { tabbing = false; } if (Input.GetKeyDown(KeyCode.Return)) { if (field.text != "") { submitHandler?.Invoke(field.text); } field.text = ""; EventSystem.current.SetSelectedGameObject(null); field.Select(); } }
public void Update() { #region Temp bypass of logging in if (Input.GetKeyDown(KeyCode.Minus)) { PlayerInformation.Instance.PlayerName = "Admin"; PlayerInformation.Instance.IsAdmin = true; //Load after our login/register and admin check LoaderManager.Instance.LoadLevel(SceneList.MAIN_MENU_SCREEN, delegate(string E) { LoaderManager.Instance.UnLoadLevel(SceneList.LOGIN); //Unload after new level is in }); } if (Input.GetKeyDown(KeyCode.Alpha0)) { PlayerInformation.Instance.PlayerName = "Admin-2"; PlayerInformation.Instance.IsAdmin = true; //Load after our login/register and admin check LoaderManager.Instance.LoadLevel(SceneList.MAIN_MENU_SCREEN, delegate(string E) { LoaderManager.Instance.UnLoadLevel(SceneList.LOGIN); //Unload after new level is in }); } #endregion //ENTER FOR LOGGING IN AND REGISTERING if (Input.GetKeyDown(KeyCode.Return)) { if (loginState == LoginState.Login && loginButton.interactable) { OnAttemptToLogin(); } else if (loginState == LoginState.Register && confirmButton.interactable) { OnAttemptToRegister(); } } //Handle Tabbing For Blackbelt and Crew if (Input.GetKeyDown(KeyCode.Tab)) { //Based on loginstate loop state back around if (loginState == LoginState.Login) { tabState = ((int)tabState + 1 < 3) ? tabState + 1 : TabState.Username; } else { tabState = ((int)tabState + 1 < 4) ? tabState + 1 : TabState.Username; } //Debug.LogFormat("{0}", tabState); //Deactivate usernameInputField.DeactivateInputField(); passwordInputField.DeactivateInputField(); emailInputField.DeactivateInputField(); switch (tabState) { case TabState.Username: usernameInputField.ActivateInputField(); usernameInputField.MoveToEndOfLine(false, false); break; case TabState.Password: passwordInputField.ActivateInputField(); break; case TabState.Email: emailInputField.ActivateInputField(); break; default: break; } } }
private IEnumerator MoveToEndOfInput() { yield return(new WaitForEndOfFrame()); _input.MoveToEndOfLine(false, false); }