Esempio n. 1
0
        public void OnGUI()
        {
            if (!initStyles)
            {
                initStyles = GUIHelper.SetCustomStyles();
            }

            windowRect = GUIHelper.CreatePopupWindow(new Rect(0, 0, 310, 200), "CheatManager: Hotkey Settings", false, true);

            GUI.FocusControl("CheatManager.HotKeys");

            GUIHelper.CreateItemsGrid(new Rect(windowRect.x, windowRect.y, 150, windowRect.height), 10, 1, hotkeyLabels, GUIHelper.GUI_ITEM.TEXTFIELD);

            int sBtn = GUIHelper.CreateButtonsGrid(new Rect(windowRect.x + 160, windowRect.y, 150, windowRect.height), 10, 1, buttonInfos, out float lastY);

            if (sBtn != -1)
            {
                StartAssignment(hotkeyButtons[sBtn]);
                selected = sBtn;
                buttonInfos[sBtn].Name = "Press any key!";
            }

            if (GUI.Button(new Rect(windowRect.x + 5, lastY + 20, 142.5f, 40), "Save & Close"))
            {
                SaveAndExit();
            }
            else if (GUI.Button(new Rect(windowRect.x + 152.5f, lastY + 20, 142.5f, 40), "Cancel"))
            {
                Destroy(Instance);
            }

            keyEvent = Event.current;

            if (keyEvent.isKey && waitingForKey)
            {
                newKey        = keyEvent.keyCode;
                waitingForKey = false;
            }
        }