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); }
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; } }
private static void TabControl(int category) { int scrollItems; if (category == 19) { scrollItems = WarpData.Length; } else { scrollItems = TechnologyMatrix[category].Count; } float width = windowRect.width; if (scrollItems > 10 && category != 0) { width -= 20; } if (scrollItems > 4 && category == 0) { windowRect.height = 104; width -= 20; } scrollPos = GUI.BeginScrollView(windowRect, scrollPos, new Rect(windowRect.x, windowRect.y, width, scrollItems * 26)); string itemName, selectedTech; for (int i = 0; i < scrollItems; i++) { if (category == 19) { itemName = WarpData[i][1]; selectedTech = WarpData[i][0]; } else { itemName = TechnologyMatrix[category][i].Name; selectedTech = TechnologyMatrix[category][i].TechType.ToString(); } if (GUI.Button(new Rect(windowRect.x, windowRect.y + (i * 26), width, 22), itemName, GUIHelper.GetCustomStyle(false, GUIHelper.BUTTONTYPE.NORMAL_LEFTALIGN))) { switch (category) { case 0: if (!Player.main.IsInBase() && !Player.main.IsInSubmarine() && !Player.main.escapePod.value) { if (TechnologyMatrix[category][i].TechType == TechType.Cyclops) { ExecuteCommand($"{itemName} has spawned", "sub cyclops"); } else { ExecuteCommand($"{itemName} has spawned", $"spawn {selectedTech}"); } break; } ErrorMessage.AddMessage("CheatManager Error!\nVehicles cannot spawn inside Lifepod, Base or Submarine!"); break; case 1: case 2: case 3: case 4: case 5: case 6: case 11: case 12: case 13: case 14: case 15: ExecuteCommand($"{itemName} added to inventory", $"item {selectedTech}"); break; case 7: case 8: case 9: case 10: case 16: case 17: ExecuteCommand($"{itemName} has spawned", $"spawn {selectedTech}"); break; case 18: ExecuteCommand($"Blueprint: {itemName} unlocked", $"unlock {selectedTech}"); break; case 19: Teleport(itemName, selectedTech); Buttons[7].Enabled = true; break; default: break; } } } GUI.EndScrollView(); if (category == 0) { windowRect.y += (4 * 26) + 2; GUI.Box(new Rect(windowRect.x, windowRect.y, windowRect.width, 23), "Vehicle Settings:", GUIHelper.Box); vehicleSettingsID = GUIHelper.CreateButtonsGrid(new Rect(windowRect.x - 5, windowRect.y + 27, windowRect.width + 10, 22), 2, 2, vehicleSettings, out float lastYcoord); GUI.Label(new Rect(windowRect.x, windowRect.y + 53, 250, 22), seamothName + " speed multiplier: " + string.Format("{0:#.##}", seamothSpeedMultiplier)); seamothSpeedMultiplier = (GUI.HorizontalSlider(new Rect(windowRect.x, windowRect.y + 79, windowRect.width, 10), seamothSpeedMultiplier, 1f, 5f)); GUI.Label(new Rect(windowRect.x, windowRect.y + 93, 250, 22), exosuitName + " speed multiplier: " + string.Format("{0:#.##}", exosuitSpeedMultiplier)); exosuitSpeedMultiplier = GUI.HorizontalSlider(new Rect(windowRect.x, windowRect.y + 119, windowRect.width, 10), exosuitSpeedMultiplier, 1f, 5f); GUI.Label(new Rect(windowRect.x, windowRect.y + 133, 250, 22), cyclopsName + " speed multiplier: " + string.Format("{0:#.##}", cyclopsSpeedMultiplier)); cyclopsSpeedMultiplier = GUI.HorizontalSlider(new Rect(windowRect.x, windowRect.y + 159, windowRect.width, 10), cyclopsSpeedMultiplier, 1.0F, 5.0F); } }