//} /// <summary> /// Updates the text when the user clicks the control buttons. /// Source: https://github.com/Gris87/InputControl /// </summary> public void OnClick() { selectedButton = this; if (mKeyText == null) { mKeyText = GetComponentInChildren <Text>(); } mKeyText.text = "Press Key"; }
/// <summary> /// Pop up error-panel if user enters WASD for robot controls /// </summary> public void ShowBindedInfoPanel() { if (KeyButton.Binded()) { bindedKeyPanel.SetActive(true); } else { bindedKeyPanel.SetActive(false); ToggleHotKeys(false); } }
private void Update() { if (toolkit == null) { camera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); toolkit = GetComponent <Toolkit>(); multiplayer = GetComponent <LocalMultiplayer>(); sensorManagerGUI = GetComponent <SensorManagerGUI>(); FindElements(); } else if (camera == null) { camera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); } else { UpdateWindows(); if (UnityEngine.Input.GetKeyDown(KeyCode.Escape) && !InputControl.freeze) { if (!exitPanel.activeSelf) { if (GameObject.Find("Dropdown List")) { GameObject.Destroy(GameObject.Find("Dropdown List")); } MainMenuExit("open"); } else { MainMenuExit("cancel"); } } if (KeyButton.Binded() && inputPanelOn) { ShowBindedInfoPanel(); } } HighlightTabs(); if (State.isEmulationDownloaded) { emulationTab.SetActive(true); } }
/// <summary> /// Sets the primary or secondary input to the selected input from the user. /// Source: https://github.com/Gris87/InputControl /// </summary> /// <param name="input">Input from any device or axis (e.g. Joysticks, Mouse, Keyboard)</param> private void SetInput(CustomInput input) { switch (keyIndex) { case 0: keyMapping.primaryInput = input; break; case 1: keyMapping.secondaryInput = input; break; } UpdateText(); selectedButton = null; }