// Button activated private void OnMouseUpAsButton() { this.GetComponent <SpriteRenderer>().sprite = hoverSprite; // Notify our timer script that the pick has been confirmed timerScript.PickConfirmed(); }
// Update is called once per frame void Update() { if (gameObject.GetComponent <InputField>().IsInteractable()) { // Auto complete with hitting tab. if (Input.GetKeyUp(KeyCode.Tab)) { int numMatches = timerScript.playerDatabase.NumMatchingPlayers(gameObject.GetComponent <InputField>().text); // Player Found if (numMatches == 1) { gameObject.GetComponent <InputField>().text = timerScript.playerDatabase.GetSearchResult(); gameObject.GetComponent <InputField>().caretPosition = gameObject.GetComponent <InputField>().text.Length; } } // Enter the draft pick with return. if (Input.GetKeyUp(KeyCode.Return)) { int numMatches = timerScript.playerDatabase.NumMatchingPlayers(gameObject.GetComponent <InputField>().text); // Player Found if (numMatches == 1) { if (gameObject.GetComponent <InputField>().text == timerScript.playerDatabase.GetSearchResult()) { timerScript.PickConfirmed(); } } else { gameObject.GetComponent <InputField>().ActivateInputField(); gameObject.GetComponent <InputField>().caretPosition = gameObject.GetComponent <InputField>().text.Length; gameObject.GetComponent <InputField>().selectionAnchorPosition = gameObject.GetComponent <InputField>().text.Length; gameObject.GetComponent <InputField>().MoveTextEnd(false); } } } }