Example #1
0
        //}

        /// <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";
        }
Example #2
0
 /// <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);
     }
 }
Example #3
0
        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);
            }
        }
Example #4
0
        /// <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;
        }