// Use this for initialization void Start() { input = gameObject.GetComponentsInChildren<InputField>()[0]; input.ActivateInputField(); input.onEndEdit.AddListener (OnSubmit); input.Select(); }
public void SubmitCommand(InputField inputField) { var cmd = inputField.text; AppendTextToConsole("> " + cmd + "\n"); inputField.text = ""; inputField.Select(); inputField.ActivateInputField(); ParseCommand(cmd); }
/// <summary> /// Get the `InputField` child object of this gameObject /// and activate it so the user does not have to /// click on it prior to entering a number. /// </summary> public void Start() { inputField = GetComponentInChildren<InputField>(); if (inputField == null) { throw new MissingComponentException(); } inputField.ActivateInputField(); }
// Update is called once per frame void Update() { if (activeRitual) { inputFieldObj.SetActive(true); inputField = inputFieldObj.GetComponent<InputField>(); inputField.Select(); inputField.ActivateInputField(); if (initRitual == false) { initRitual = true; inputField.text = "Enter Password; "; } if (Input.GetKeyDown(KeyCode.Return)) { if (passwordEntered == false) { passwordEntered = true; if (inputField.text.CompareTo(password) == 0) { passwordCorrect = true; inputField.text = "password correct\nplease right click"; } else { passwordCorrect = false; inputField.text = "password incorrect"; Application.LoadLevel("level"); } } else { inputField.text = DoComputerStuff(inputField.text); } } if (Input.GetMouseButtonDown(1)) { inputFieldObj.SetActive(false); activeRitual = false; Debug.Log("PC Ritual"); } } }
void Update() { if (Input.GetKeyDown(KeyCode.Tab)) { tabIndex = (tabIndex + 1) % 4; if (tabIndex == 0) { username.ActivateInputField(); } else if (tabIndex == 1) { oldPassword.ActivateInputField(); } else if (tabIndex == 2) { password.ActivateInputField(); } else if (tabIndex == 3) { passwordAgain.ActivateInputField(); } } }
void OnEndEdit(string str) { if (inputMessage.text != "") { // MessageManager manager = new MessageManager(); if (NetworkManager.Instance.isServer) { // NetworkManager.Instance.Broadcast(System.Text.ASCIIEncoding.UTF8.GetBytes(inputMessage.text)); MessageManager.Instance.SendMessage(inputMessage.text, 0); messages.text += inputMessage.text + System.Environment.NewLine; } else { // NetworkManager.Instance.Broadcast(System.Text.ASCIIEncoding.UTF8.GetBytes(inputMessage.text)); // Crear packet de texto MessageManager.Instance.SendMessage(inputMessage.text, 0); messages.text += inputMessage.text + System.Environment.NewLine; Debug.Log("soy un cliente"); } inputMessage.ActivateInputField(); inputMessage.Select(); inputMessage.text = ""; } }
public void Change_Click() { if (!inputField) { return; } if (changeButton) { changeButton.gameObject.SetActive(false); } inputField.gameObject.SetActive(true); if (playerName) { playerName.enabled = false; } SetControlActivity(false); inputField.enabled = true; inputField.interactable = true; inputField.ActivateInputField(); inputField.Select(); Debug.Log("change : " + inputField); }
private void Start() { _gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); menu = GameObject.Find("Canvas/Menu"); intro = GameObject.Find("Canvas/IntroText"); risingPlatform = GameObject.Find("Platform/Rising"); text = GameObject.Find("Canvas/IntroText/Text").GetComponent <Text>(); inputField = GameObject.Find("Canvas/Menu/InputField").GetComponent <InputField>(); inputField.ActivateInputField(); inputField.Select(); if (showStarted) { BeginShow(); } if (_gameManager.isGameOver) { QueueEllen(); } }
/// <summary> /// 비번 체크 /// </summary> public void CheckPwIF() { string curText = m_pwInputField.text; if (m_pwInputField.text.Length > 16) // 예외 발생 { openFailUI("비밀번호 제한은 16글자입니다"); m_pwInputField.text = curText.Substring(0, 16); m_pwInputField.ActivateInputField(); } else // 영어 및 숫자 제외의 문자는 경고 { for (int i = 0; i < curText.Length; ++i) { if (checkTextOnlyAscii(curText[i]) == false) { openFailUI("영어와 숫자만 가능합니다"); m_pwInputField.text = curText.Substring(0, curText.Length - 1); return; } } } }
public void ConsoleUpdate() { if (Input.GetKeyDown(KeyCode.BackQuote)) { ConsoleParent.SetActive(!Open()); if (Open()) { InputField.text = ""; } } if (Open()) { InputField.ActivateInputField(); if (Input.GetKeyDown(KeyCode.Return) && InputField.text.Length > 0) { Console.ExecCommand(InputField.text); InputField.text = ""; } } }
// Update is called once per frame void Update() { // Check if this gameObject is selected and if the Return key is pressed if (EventSystem.current.currentSelectedGameObject == gameObject && Input.GetKeyDown(KeyCode.Return)) { // Check if the target GameObject has an InputField then place text into it. if (targetGameObject != null) { InputField target = targetGameObject.GetComponent <InputField>(); if (target != null) { target.text = textInput.text; } } // Clear the text field for the next input textInput.text = string.Empty; // Keep the current gameObject selected textInput.ActivateInputField(); textInput.Select(); } }
void InputComplete() { if (inputIsEmpty) { if (controller.IsCommsTextUnravelled() && commsNav.currentLine.continues) { commsNav.ContinueLine(commsNav.currentLine); } else { controller.SkipUnravelling(); } } if (foundResponse) { controller.AssembleAndDisplayCommsText(); } //controller.AssembleAndDisplayCommsText(); inputField.ActivateInputField(); inputField.text = null; Debug.Log(foundResponse); Debug.Log(commsNav.currentLine); }
// void Start() // { // system = EventSystem.current;// EventSystemManager.currentSystem; // } // Update is called once per frame void Update() { system = EventSystem.current; if (Input.GetKeyDown(KeyCode.Tab)) { Selectable next = system.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnDown(); if (next != null) { InputField inputfield = next.GetComponent <InputField>(); if (inputfield != null) { inputfield.OnPointerClick(new PointerEventData(system)); //if it's an input field, also set the text caret } system.SetSelectedGameObject(next.gameObject, new BaseEventData(system)); } if (next == null) { inputName.ActivateInputField(); } //else Debug.Log("next nagivation element not found"); } }
protected virtual void Update() { // Ignore, if field's not wisible if (!InputField.gameObject.activeSelf) { return; } // Focus Change event handling if (InputField.isFocused != _wasFocused) { _wasFocused = InputField.isFocused; } // Focus, if return key was clicked if (FocusOnEnterClick && Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) { if (_allowFocusOnEnter) { InputField.ActivateInputField(); } } }
private void Update() { _time += Time.deltaTime; GameManager.Instance.InputMenuOpened = true; if (!_inputField.isFocused) { _inputField.Select(); _inputField.ActivateInputField(); } if (_inputField.text == _wordText.text) { Deactivate(); EventManager.Instance.Invoke("TypoSucceed", this, new TypoEventArgs(_time)); } if (Input.GetKeyDown(KeyCode.Escape)) { BuildManager.Instance.CurrentTower = null; Deactivate(); } }
public void SetPage(bool isBan, AdminPlayerEntryData playerToKick) { playerToKickCache = playerToKick; UIManager.IsInputFocus = true; UIManager.PreventChatInput = true; if (!isBan) { kickPage.SetActive(true); kickTitle.text = $"Kick Player: {playerToKick.name}"; kickReasonField.text = ""; kickReasonField.ActivateInputField(); } else { banPage.SetActive(true); banTitle.text = $"Ban Player: {playerToKick.name}"; banReasonField.text = ""; banReasonField.ActivateInputField(); minutesField.text = ""; } gameObject.SetActive(true); }
void StartPlaying() { // Show some waiting message here if (PlayerPrefs.HasKey("PlayerId") && !String.IsNullOrEmpty(PlayerPrefs.GetString("PlayerId"))) { if (GameManager.Instance.tracker.ready) { GameManager.Instance.SetGamePhase(GameManager.GamePhases.LoadScreen); } else { GameManager.Instance.tracker.StartTrackerWithCallback(StartPlayingWithLevelInformation, NoInternetError); fetchConfigInProgressOverlay.OpenPanel(); } } else { Debug.Log("missing PlayerId"); playerIdField.transform.FindChild("Text").GetComponent <Text>().color = Color.red; playerIdField.Select(); playerIdField.ActivateInputField(); } }
void Update() { if (inputTherapyId.isFocused && Input.GetKeyDown(KeyCode.Tab)) { inputPatientId.ActivateInputField(); } if (inputPatientId.isFocused && Input.GetKeyDown(KeyCode.Tab)) { inputTherapyId.ActivateInputField(); } if (inputDescription.isFocused && Input.GetKeyDown(KeyCode.Tab)) { inputObjective.ActivateInputField(); } if (inputObjective.isFocused && Input.GetKeyDown(KeyCode.Tab)) { inputDescription.ActivateInputField(); } if (inputObjective.isFocused && Input.GetKeyDown(KeyCode.Tab)) { inputDescription.ActivateInputField(); } }
private void HandleChat() { if (_chatInputField.text != "") { if (Input.GetKeyDown(KeyCode.Return)) { if (ChatHub.Instance != null) { ChatHub.Instance.BroadcastMessage(_chatInputField.text, Player.LocalPlayer.PlayerName, ChatType.Player); } _chatInputField.text = ""; _chatInputField.DeactivateInputField(); } } else { if (!_chatInputField.isFocused && Input.GetKeyDown(KeyCode.Return)) { _chatInputField.ActivateInputField(); } } }
private void Update() { if (Input.GetKeyDown(KeyCode.Return)) { if (m_inputField.text == "") { m_inputField.ActivateInputField(); m_inputField.text = ""; } else if (m_inputField.text == "\n") { m_inputField.DeactivateInputField(); m_inputField.text = ""; } else { if (m_inputField.text.Any(c => c == '\n')) { Chat(m_inputField.text); } } } }
//TODO: add a confirm button, so players can type in no name and not any failuers. void OnEnable() { inputField = GetComponent <InputField> (); inputField.ActivateInputField(); inputField.characterLimit = 24; // = Exterminator the Mad Dog var d = GameManager.PlayerDogs.FindLast(dog => true); DogImage.sprite = d.sprite; RaceText.text = d.GetGender() + " " + Dog.AsString(d.race); inputField.text = d.dogName; inputField.onEndEdit.AddListener(delegate { if (string.IsNullOrEmpty(inputField.text)) { return; } if (DogName) { GameManager.SetDogName(inputField.text); } else { GameManager.SetName(inputField.text); } foreach (var go in toToggle) { go.SetActive(!go.activeSelf); } }); }
void Update() { chatBox.interactable = true; if (chatBox.text != "") { _playerRb.isKinematic = true; if (Input.GetKeyDown(KeyCode.Return)) { SendMessageToChat(username + ": " + chatBox.text, Message.MessageType.playerMessage); chatBox.interactable = false; chatBox.text = ""; } } else { _playerRb.isKinematic = false; if (!chatBox.isFocused && Input.GetKeyDown(KeyCode.Return)) { chatBox.ActivateInputField(); } if (chatBox.isFocused && Input.GetKeyDown(KeyCode.Return)) { chatBox.DeactivateInputField(); } } if (!chatBox.isFocused) { if (Input.GetKeyDown(KeyCode.Space)) { SendMessageToChat(username + " pooted upwards", Message.MessageType.info); } } }
public void onbtnSignup() { string firstname = FirstName.text; string lastname = LastName.text; string email = Email.text; string password = Password.text; if (string.IsNullOrEmpty(firstname)) { FirstName.Select(); FirstName.ActivateInputField(); return; } if (string.IsNullOrEmpty(lastname)) { LastName.Select(); LastName.ActivateInputField(); return; } if (string.IsNullOrEmpty(email)) { Email.Select(); Email.ActivateInputField(); return; } if (string.IsNullOrEmpty(password)) { Password.Select(); Password.GetComponent <InputField>().ActivateInputField(); return; } mm.EmailSignup(firstname, lastname, email, password); }
private void Update() { if (FreezeTime) { return; } if (selected && InputField.text != "") { ResetTimer(); if (UnityEngine.Input.GetKey(KeyCode.Return)) { if (UnityEngine.Input.GetKey(KeyCode.LeftShift)) { if (!InputField.text.EndsWith("\n")) { InputField.ActivateInputField(); InputField.text += "\n"; StartCoroutine(MoveToEndOfText()); } } else { playerChatManager.SendMessage(); } } } else { timeLeftUntilAutoClose -= Time.unscaledDeltaTime; if (timeLeftUntilAutoClose <= 0) { playerChatManager.HideChat(); FreezeTime = true; } } }
// Controla si el texto ingresado en el input es correcto. void checkEstadoInput() { int maxInstancia = problemas.Length - 1; if (input.EsCorrecto()) // <--Ingreso correcto. { if (instanciaActual == maxInstancia) // <--Fin del Juego. { popUp.Bien(); } else { StartCoroutine(MoverImagenes()); popUp.cartelAcierto(); instanciaActual++; ManagerInstancia(); //setSpritesEnImagenes(); StartCoroutine(MoverImagenes()); } } else // <--Ingreso Incorrecto. { StartCoroutine(MoverImagenes()); popUp.cartelError(); if (instanciaActual > 0) { instanciaActual--; } ManagerInstancia(); //setSpritesEnImagenes(); StartCoroutine(MoverImagenes()); } inputField.ActivateInputField(); }
void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "Player" && !isCorrupted) { //Play sound AudioSource audio = GetComponent <AudioSource>(); audio.clip = this.WindowsNotif; audio.Play(); // Show PopUp popup.SetActive(true); password.ActivateInputField(); collRd2d = coll.gameObject.GetComponent <Rigidbody2D>(); collRd2d.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezePositionY | RigidbodyConstraints2D.FreezeRotation; if (passwordValue.Length != 0) { btnOk.onClick.AddListener(passwordEnter); } else { StartCoroutine(Wait()); } } }
private void Update() { //reselect after submitting if (select && consoleInputField.isFocused == false) { select = false; consoleInputField.ActivateInputField(); } //Shift up and down is good for highlighting, so break if either shift key is pressed if (!(Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))) { if (consoleInputField.isFocused && Input.GetKeyDown(KeyCode.UpArrow) && commandHistory.Count > 0) { //go back in history historyIndex = Mathf.Max(historyIndex - 1, 0); consoleInputField.text = commandHistory[historyIndex]; consoleInputField.caretPosition = consoleInputField.text.Length; } if (consoleInputField.isFocused && Input.GetKeyDown(KeyCode.DownArrow) && commandHistory.Count > 0) { //go forward in history historyIndex = Mathf.Min(historyIndex + 1, commandHistory.Count); if (historyIndex == commandHistory.Count) { consoleInputField.text = ""; } else { consoleInputField.text = commandHistory[historyIndex]; } consoleInputField.caretPosition = consoleInputField.text.Length; } } }
// Send the current message to the chat public void sendMessage() { if (isConnected) { string message = input.text; if (input.text != "") // Check if not empty { message = PhotonNetwork.NickName + ": " + message; // Send the message userChatClient.PublishMessage("global", message); // Clear the input input.text = ""; // Select the input again input.ActivateInputField(); } else { return; } } }
public void SendMessage() { if (messageToSend.Length > 0) { messageToSend = messageToSend + "[_nickname]" + PhotonNetwork.playerName; if (ChannelsSwitchMenu.value == 0) { chatClient.PublishMessage(GlobalChannelName, messageToSend); } else { string target = LocalFriendListComponent.GetIDByName(GameChannels [ChannelsSwitchMenu.value]); messageToSend = messageToSend + "[_target]" + GameChannels [ChannelsSwitchMenu.value]; Debug.Log("Sending private message to:" + target); chatClient.SendPrivateMessage(target, messageToSend); } messageToSend = ""; ChatInputField.text = ""; #if UNITY_EDITOR || UNITY_STANDALONE ChatInputField.Select(); ChatInputField.ActivateInputField(); #endif } }
void Update() { if (Input.GetKeyDown(KeyCode.Return)) { SendMessageToChat(chatBox.text, Message.MessageType.playerMessage); chatBox.text = ""; } else { if (!chatBox.isFocused && Input.GetKeyDown(KeyCode.Return)) { chatBox.ActivateInputField(); } } if (!chatBox.isFocused) { if (Input.GetKeyDown(KeyCode.Space)) { SendMessageToChat("Presionaste la barra espaciadora", Message.MessageType.otherPlayer); Debug.Log("Space"); } } }
void Update() { //Toggle visibility when tilde key pressed if (Input.GetKeyDown(";")) { toggleVisibility(); EventSystem.current.SetSelectedGameObject(inputField.gameObject); inputField.ActivateInputField(); } //Toggle visibility when 5 fingers touch. if (Input.touches.Length == 5) { if (!didShow) { toggleVisibility(); didShow = true; } } else { didShow = false; } }
void ResponsePhase() { if (!e_respCall) { inputGameobjectRef.SetActive(true); // show text input field inputRef.ActivateInputField(); // activate text input field inputRef.text = ""; // set text input field to be blank trialCounterRef.SetActive(true); // show trial counter m_TrialNumber.UpdateTrialNumber(trialNumber, m_ExpSetup.totalTrials); // update trial number Debug.Log("Waiting for subject response..."); e_respCall = true; } // Wait for the subject's response inputRef.Select(); // select text input field if (Input.GetKeyDown(KeyCode.KeypadEnter)) { if (inputRef.text == "") { Debug.Log("input is empty"); } else if (inputRef.text != "") { resp = int.Parse(inputRef.text); // convert string input to int inputRef.DeactivateInputField(); // deactivate text input field inputGameobjectRef.SetActive(false); // hide text input field // store the trial's info into the trialinfo csv m_ResponseData.WriteData(targetColor, targetOrientation, targetApperances, resp); responseDone = true; } } }
// Update is called once per frame void Update() { string input = passwordField.text; if (badgeScreen.activeSelf && page == 2 && buttonNext) { buttonNext = false; PlayerPrefs.SetString(PlayerPrefs.GetString("Username") + "." + PlayerPrefs.GetString("Password") + ".Level1", "Level 2_Scene"); SceneManager.LoadScene("Stairs2"); // return; } if (openDoor.activeSelf && page == 1 && buttonNext) { buttonNext = false; badgeScreen.SetActive(true); openDoor.SetActive(false); page++; } if (page == 0 && (Input.GetKeyDown(KeyCode.Return) || buttonNext)) { buttonNext = false; if (input == "thebestpassword") { openDoor.SetActive(true); networkDialog.SetActive(false); player.SetActive(true); chatNotice.GetComponent <Text> ().text = "Now that you're on the network, the door unlocked to let you through! " + "Keep going, and be careful! Who knows what might happen to you if they find out you hacked in!"; page++; } passwordField.text = ""; } passwordField.ActivateInputField(); }
public void PressActiveButton() { //press enter, we sohuld send a message or activate the input if (isInputActive) { //input was active, send the message, clear the inputField string message = inputField.text; if (message.Length > 0) { string username = "******"; SendMessageString(username + ": " + message); JSONObject json_message = new JSONObject(); json_message.AddField("name", username); json_message.AddField("message", message); socket.Emit("chat message", json_message); inputField.text = ""; } inputField.DeactivateInputField(); EventSystem.current.SetSelectedGameObject(contentText.gameObject); } else {//input was nonactive inputField.Select(); inputField.ActivateInputField(); } }
IEnumerator ActivateInputFieldWithoutSelection(InputField inputField) { inputField.ActivateInputField(); // wait for the activation to occur in a lateupdate yield return new WaitForEndOfFrame(); // make sure we're still the active ui if (EventSystem.current.currentSelectedGameObject == inputField.gameObject) { // To remove hilight we'll just show the caret at the end of the line inputField.MoveTextEnd(false); } }
public void OnInputEnter(InputField inputField) { // First Name only. if (Regex.IsMatch (inputField.text, "^[A-Z]?[a-z]{2,14}$")) { GameManager.Instance.SetPlayerName (inputField.text); if(GameManager.Instance.doLoadTutorial) Application.LoadLevel ("Tutorial"); else Application.LoadLevel ("Level 1"); } else { inputField.text = ""; inputField.placeholder.GetComponent<Text>().text = "Invalid Name"; inputField.ActivateInputField(); } }
public void ValChanged(InputField field) { if (field.text.Length > 0) { playerName = field.text; Application.LoadLevel(7); } else{ field.placeholder.GetComponent<Text>().text = "Please enter a name"; field.ActivateInputField(); field.Select(); } }
private IEnumerator EnsureInputFieldCoroutine(InputField inputField) { yield return null; while(!TouchScreenKeyboard.visible && inputField.text.Length == 0) { inputField.ActivateInputField(); inputField.Select(); yield return null; } }