Example #1
0
        public void OnGUI()
        {
            if (!isShow)
            {
                return;
            }

            GUIHelper.CreatePopupWindow(windowRect, null);
            GUI.contentColor = Color.green;
            GUI.Label(new Rect(windowRect.x + 5, windowRect.y, windowRect.width, windowRect.height), stringBuilder.ToString());
        }
        public void OnGUI()
        {
            if (!isActive)
            {
                return;
            }

            if (!initStyles)
            {
                initStyles = GUIHelper.SetCustomStyles();
            }

            windowRect = GUIHelper.CreatePopupWindow(new Rect(Screen.width - 500, 0, 500, 762), windowTitle);

            float lastYcoord = windowRect.y;
            float baseHeight = windowRect.height;

            windowRect.x     += 5;
            windowRect.y     += space;
            windowRect.width -= 10;
            windowRect.height = 22;

            GUI.Label(windowRect, "Commands:");

            normalButtonID = GUIHelper.CreateButtonsGrid(new Rect(windowRect.x, windowRect.y + 22, windowRect.width, baseHeight), space, 4, Buttons, out lastYcoord);

            GUI.Label(new Rect(windowRect.x, lastYcoord + space, 150, 22), "Toggle Commands:");

            toggleButtonID = GUIHelper.CreateButtonsGrid(new Rect(windowRect.x, lastYcoord + space + 22, windowRect.width, baseHeight - (lastYcoord + 22 + space)), space, 4, toggleButtons, out lastYcoord);

            GUI.Label(new Rect(windowRect.x, lastYcoord + space, 150, 22), "Day/Night Speed:");

            daynightTabID = GUIHelper.CreateButtonsGrid(new Rect(windowRect.x, lastYcoord + space + 22, windowRect.width, baseHeight), space, 6, daynightTab, out lastYcoord);

            GUI.Label(new Rect(windowRect.x, lastYcoord + space, 100, 22), "Categories:");

            categoriesTabID = GUIHelper.CreateButtonsGrid(new Rect(windowRect.x, lastYcoord + space + 22, windowRect.width, baseHeight), space, 4, categoriesTab, out lastYcoord);

            GUI.Label(new Rect(windowRect.x, lastYcoord + space, 150, 22), "Select Item in Category:");

            GUI.Label(new Rect(windowRect.x + 150, lastYcoord + space, 100, 22), categoriesTab[currentTab].Name, GUIHelper.Label);

            windowRect.x      = windowRect.x + 5;
            windowRect.y      = lastYcoord + 22 + (space * 2);
            windowRect.width  = windowRect.width - 10;
            windowRect.height = (baseHeight - windowRect.y) + 20;

            TabControl(currentTab);
        }
Example #3
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;
            }
        }
Example #4
0
        void OnGUI()
        {
            if (!show)
            {
                return;
            }

            GUIHelper.CreatePopupWindow(windowRect, $"CheatManager Console (Press {Config.Config.KEYBINDINGS[2]} to toggle)", true, true);

            scrollPos = GUI.BeginScrollView(scrollRect, scrollPos, new Rect(scrollRect.x, scrollRect.y, scrollRect.width - 40, drawingPos - scrollRect.y));

            for (int i = 0; i < logMessage.Count; i++)
            {
                if (i == 0)
                {
                    drawingPos = scrollRect.y;
                }

                GUIStyle style = GUI.skin.GetStyle("Label");

                style.alignment = TextAnchor.MiddleLeft;
                style.wordWrap  = true;

                contentHeight = style.CalcHeight(new GUIContent(logMessage[i].message), scrollRect.width - 40);

                GUI.contentColor = logTypeColors[logMessage[i].type];

                GUI.Label(new Rect(scrollRect.x + 5, drawingPos, 15, 21), "> ");

                GUI.Label(new Rect(scrollRect.x + 20, drawingPos, scrollRect.width - 40, contentHeight), logMessage[i].message);

                drawingPos += contentHeight + 1;

                if (logMessage[i].stackTrace != "")
                {
                    contentHeight = style.CalcHeight(new GUIContent(logMessage[i].stackTrace), scrollRect.width - 40);

                    GUI.Label(new Rect(scrollRect.x + 20, drawingPos, scrollRect.width - 40, contentHeight), logMessage[i].stackTrace);
                    drawingPos += contentHeight + 1;
                }
            }

#if AUTOSCROLL
            if (messageCount != logMessage.Count)
            {
                scrollPos.y += Mathf.Infinity;
                messageCount = logMessage.Count;
            }
#endif
            GUI.EndScrollView();

            GUI.contentColor = Color.white;


            if (Event.current.Equals(Event.KeyboardEvent("return")) && inputField != "")
            {
                history.Add(inputField);
                historyIndex = history.Count;
                Log(inputField);
                DevConsole.SendConsoleCommand(inputField);
                inputField = "";
            }

            if (Event.current.Equals(Event.KeyboardEvent("up")))
            {
                if (history.Count > 0 && historyIndex >= 1)
                {
                    historyIndex--;
                    inputField = history[historyIndex];
                }
            }

            if (Event.current.Equals(Event.KeyboardEvent("down")))
            {
                if (history.Count > 0 && historyIndex < history.Count - 1)
                {
                    historyIndex++;
                    inputField = history[historyIndex];
                }
            }

            inputField = GUI.TextField(new Rect(scrollRect.x + 5, scrollRect.y + scrollRect.height + 5, 300, 22), inputField);

            if (GUI.Button(new Rect(scrollRect.x + 310, scrollRect.y + scrollRect.height + 5, scrollRect.width - 310, 22), "Clear Window"))
            {
                logMessage.Clear();
                drawingPos = scrollRect.y;
            }
        }