Beispiel #1
0
        public override void Update()
        {
            if (consoleKey.IsDown() && !consoleSizeKey.IsDown())
            {
                console.toggleVisibility();
            }

            if (consoleSizeKey.IsDown())
            {
                ChangeConsoleSize();
            }
        }
Beispiel #2
0
 public override void Update()
 {
     if (consoleKey.IsDown())
     {
         console.toggleVisibility();
     }
 }
Beispiel #3
0
 // Open menu if the key is pressed.
 public override void Update()
 {
     // Open menu
     if (menuKey.IsDown())
     {
         settings.toggleVisibility();
     }
     if (Application.loadedLevelName != "MainMenu" && (bool)modSetButton.GetValue())
     {
         if (GameObject.Find("Systems/OptionsMenu/Menu") != null)
         {
             if (!Button_ms.activeSelf)
             {
                 Button_ms.SetActive(true);
             }
         }
         else
         {
             if (Button_ms.activeSelf)
             {
                 Button_ms.SetActive(false);
             }
         }
     }
 }
Beispiel #4
0
 /// <summary>
 /// Listen for Keybind press.
 /// </summary>
 public override void Update()
 {
     if (consoleKey.IsDown())
     {
         Toggle();
     }
 }
Beispiel #5
0
 /// <summary>
 /// Open menu if the key is pressed.
 /// </summary>
 public override void Update()
 {
     // Open menu
     if (menuKey.IsDown())
     {
         settings.toggleVisibility();
     }
 }
Beispiel #6
0
        /* int conSizeStep = 0;
         * public void ChangeConsoleSize() //change to dynamic scale later
         * {
         *   conSizeStep++;
         *   switch(conSizeStep)
         *   {
         *       case 1:
         *           consoleObj.GetComponent<RectTransform>().sizeDelta = new Vector2(346, 400);
         *           logView.GetComponent<RectTransform>().sizeDelta = new Vector2(333, 370);
         *           scrollbar.GetComponent<RectTransform>().sizeDelta = new Vector2(13, 370);
         *           break;
         *       case 2:
         *           consoleObj.GetComponent<RectTransform>().sizeDelta = new Vector2(346, 500);
         *           logView.GetComponent<RectTransform>().sizeDelta = new Vector2(333, 470);
         *           scrollbar.GetComponent<RectTransform>().sizeDelta = new Vector2(13, 470);
         *           break;
         *       default:
         *           consoleObj.GetComponent<RectTransform>().sizeDelta = new Vector2(346, 150);
         *           logView.GetComponent<RectTransform>().sizeDelta = new Vector2(333, 120);
         *           scrollbar.GetComponent<RectTransform>().sizeDelta = new Vector2(13, 120);
         *           conSizeStep = 0;
         *           break;
         *
         *   }
         *
         * }*/

        public override void Update()
        {
            if (consoleKey.IsDown() /* && !consoleSizeKey.IsDown()*/)
            {
                console.toggleVisibility();
            }

            /*if (consoleSizeKey.IsDown())
             * {
             *  ChangeConsoleSize();
             * }*/
        }
Beispiel #7
0
        /// <summary>
        /// Open menu if the key is pressed.
        /// </summary>
        public override void Update()
        {
            // Open menu
            if (menuKey.IsDown())
            {
                Toggle();
            }

            // Rebinds
            if (awaitingInput)
            {
                // Cancel rebind
                if (Input.GetKeyDown(KeyCode.Escape))
                {
                    if (awaitingKeyID == 0)
                    {
                        awaitingKey.Modifier = KeyCode.None;
                    }
                    else if (awaitingKeyID == 1)
                    {
                        awaitingKey.Key = KeyCode.None;
                    }

                    awaitingInput = false;
                    awaitingKeyID = -1;
                    awaitingKey   = null;
                }

                if (Input.anyKeyDown)
                {
                    if (awaitingKeyID == 0)
                    {
                        if (Event.current.keyCode != KeyCode.None)
                        {
                            awaitingKey.Modifier = Event.current.keyCode;
                        }
                        else
                        {
                            if (Event.current.shift)
                            {
                                awaitingKey.Modifier = KeyCode.LeftShift;
                            }
                        }
                    }
                    else if (awaitingKeyID == 1)
                    {
                        string  input = Input.inputString.ToUpper();
                        KeyCode code  = KeyCode.None;

                        try
                        {
                            code = (KeyCode)Enum.Parse(typeof(KeyCode), input);
                        }
                        catch (Exception e)
                        {
                            if (input == "`")
                            {
                                code = KeyCode.BackQuote;
                            }
                            else
                            {
                                ModConsole.Error("Invalid key");
                            }
                        }

                        awaitingKey.Key = code;
                    }

                    awaitingInput = false;
                    awaitingKey   = null;
                    awaitingKeyID = -1;
                }
            }
        }