public void Awake() { Instance = this; useGUILayout = false; #if DEBUG isActive = true; #endif UpdateTitle(); warpSound = ScriptableObject.CreateInstance <FMODAsset>(); warpSound.path = "event:/tools/gravcannon/fire"; techMatrix = new TechnologyMatrix(); tMatrix = new List <TechTypeData> [techMatrix.baseTechMatrix.Count]; techMatrix.InitTechMatrixList(ref tMatrix); if (Main.isExistsSMLHelperV2) { techMatrix.IsExistsModdersTechTypes(ref tMatrix, techMatrix.Known_Modded_TechTypes); } else { SNLogger.Log($"[{Config.PROGRAM_NAME}] Warning: 'SMLHelper.V2' not found! Some functions are not available!"); } techMatrix.SortTechLists(ref tMatrix); buttonText = new ButtonText(); drawRect = SNWindow.InitWindowRect(windowRect, true); List <Rect> commandRects = drawRect.SetGridItemsRect(4, 2, ITEMSIZE, SPACE, SPACE, true, true); commands.CreateGuiItemsGroup(buttonText.Buttons, commandRects, GuiItemType.NORMALBUTTON, new GuiItemColor()); commands.SetGuiItemsGroupLabel("Commands", commandRects.GetLast(), new GuiItemColor(GuiColor.White)); List <Rect> toggleCommandRects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref commandRects), drawRect.width, drawRect.height).SetGridItemsRect(4, 5, ITEMSIZE, SPACE, SPACE, true, true); toggleCommands.CreateGuiItemsGroup(buttonText.ToggleButtons, toggleCommandRects, GuiItemType.TOGGLEBUTTON, new GuiItemColor(GuiColor.Red, GuiColor.Green)); toggleCommands.SetGuiItemsGroupLabel("Toggle Commands", toggleCommandRects.GetLast(), new GuiItemColor(GuiColor.White)); List <Rect> daynightTabrects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref toggleCommandRects), drawRect.width, drawRect.height).SetGridItemsRect(6, 1, ITEMSIZE, SPACE, SPACE, true, true); daynightTab.CreateGuiItemsGroup(buttonText.DayNightTab, daynightTabrects, GuiItemType.TAB, new GuiItemColor()); daynightTab.SetGuiItemsGroupLabel("Day/Night Speed:", daynightTabrects.GetLast(), new GuiItemColor(GuiColor.White)); List <Rect> categoriesTabrects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref daynightTabrects), drawRect.width, drawRect.height).SetGridItemsRect(4, 5, ITEMSIZE, SPACE, SPACE, true, true); categoriesTab.CreateGuiItemsGroup(buttonText.CategoriesTab, categoriesTabrects, GuiItemType.TAB, new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White)); categoriesTab.SetGuiItemsGroupLabel("Categories:", categoriesTabrects.GetLast(), new GuiItemColor(GuiColor.White)); float nextYpos = SNWindow.GetNextYPos(ref categoriesTabrects); scrollRect = new Rect(drawRect.x + SPACE, nextYpos, drawRect.width - (SPACE * 2), drawRect.height - nextYpos); List <Rect>[] scrollItemRects = new List <Rect> [tMatrix.Length + 1]; for (int i = 0; i < tMatrix.Length; i++) { float width = drawRect.width; if (i == 0 && tMatrix[0].Count > MAXSHOWITEMS) { width -= 20; } if (tMatrix[i].Count * 26 > scrollRect.height) { width -= 20; } scrollItemRects[i] = SNWindow.SetGridItemsRect(new Rect(0, 0, width, tMatrix[i].Count * (ITEMSIZE + SPACE)), 1, tMatrix[i].Count, ITEMSIZE, SPACE, 2, false, false, true); } scrollItemRects[tMatrix.Length] = SNWindow.SetGridItemsRect(new Rect(0, 0, drawRect.width - 20, warpTargets.Targets.Count * (ITEMSIZE + SPACE)), 1, warpTargets.Targets.Count, ITEMSIZE, SPACE, 2, false, false, true); scrollItemsList = new List <GuiItem> [tMatrix.Length + 1]; for (int i = 0; i < tMatrix.Length; i++) { scrollItemsList[i] = new List <GuiItem>(); CreateTechGroup(tMatrix[i], scrollItemRects[i], GuiItemType.NORMALBUTTON, ref scrollItemsList[i], new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White), GuiItemState.NORMAL, true, FontStyle.Normal, TextAnchor.MiddleLeft); } scrollItemsList[tMatrix.Length] = new List <GuiItem>(); AddListToGroup(warpTargets.Targets, scrollItemRects[tMatrix.Length], GuiItemType.NORMALBUTTON, ref scrollItemsList[tMatrix.Length], new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White), GuiItemState.NORMAL, true, FontStyle.Normal, TextAnchor.MiddleLeft); var searchSeaGlide = new TechnologyMatrix.TechTypeSearch(TechType.Seaglide); string seaglideName = tMatrix[1][tMatrix[1].FindIndex(searchSeaGlide.EqualsWith)].Name; var searchSeamoth = new TechnologyMatrix.TechTypeSearch(TechType.Seamoth); seamothName = tMatrix[0][tMatrix[0].FindIndex(searchSeamoth.EqualsWith)].Name; var searchExosuit = new TechnologyMatrix.TechTypeSearch(TechType.Exosuit); exosuitName = tMatrix[0][tMatrix[0].FindIndex(searchExosuit.EqualsWith)].Name; var searchCyclops = new TechnologyMatrix.TechTypeSearch(TechType.Cyclops); cyclopsName = tMatrix[0][tMatrix[0].FindIndex(searchCyclops.EqualsWith)].Name; string[] vehicleSetButtons = { $"{seamothName} Can Fly", $"{seaglideName} Speed Fast" }; float scrollRectheight = 5 * (scrollItemsList[0][0].Rect.height + 2); float y = scrollRect.y + scrollRectheight + SPACE; List <Rect> vehicleSettingsRects = new Rect(drawRect.x, y, drawRect.width, drawRect.height).SetGridItemsRect(2, 1, ITEMSIZE, SPACE, SPACE, false, true); vehicleSettings.CreateGuiItemsGroup(vehicleSetButtons, vehicleSettingsRects, GuiItemType.TOGGLEBUTTON, new GuiItemColor(GuiColor.Red, GuiColor.Green)); vehicleSettings.SetGuiItemsGroupLabel("Vehicle settings:", vehicleSettingsRects.GetLast(), new GuiItemColor(GuiColor.White)); string[] sliderLabels = { $"{seamothName} speed multiplier:", $"{exosuitName} speed multiplier:", $"{cyclopsName} speed multiplier:" }; List <Rect> slidersRects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref vehicleSettingsRects), drawRect.width, drawRect.height).SetGridItemsRect(1, 3, SLIDERHEIGHT, SPACE, SPACE, false, false); sliders.CreateGuiItemsGroup(sliderLabels, slidersRects, GuiItemType.HORIZONTALSLIDER, new GuiItemColor()); sliders[0].OnChangedEvent = onSeamothSpeedValueChanged; sliders[1].OnChangedEvent = onExosuitSpeedValueChanged; sliders[2].OnChangedEvent = onCyclopsSpeedValueChanged; commands[(int)Commands.BackWarp].Enabled = false; commands[(int)Commands.BackWarp].State = GuiItemState.PRESSED; daynightTab.SetStateInverseTAB(4); categoriesTab[0].State = GuiItemState.PRESSED; seamothSpeedMultiplier = 1; exosuitSpeedMultiplier = 1; cyclopsSpeedMultiplier = 1; buttonControl = new ButtonControl(); }
public void Update() { if (Player.main != null) { if (Input.GetKeyDown(Config.Config.KEYBINDINGS[0])) { isActive = !isActive; } if (isActive) { windowTitle = $"CheatManager v.{Config.Config.VERSION}, {Config.Config.KEYBINDINGS[0]} Toggle Window, {Config.Config.KEYBINDINGS[1]} Toggle Mouse"; if (Input.GetKeyDown(Config.Config.KEYBINDINGS[1])) { UWE.Utils.lockCursor = !UWE.Utils.lockCursor; } if (!initToggleButtons) { ReadGameValues(); initToggleButtons = true; } if (normalButtonID != -1) { ButtonControl.NormalButtonControl(normalButtonID, ref Buttons, ref toggleButtons); } if (toggleButtonID != -1) { ButtonControl.ToggleButtonControl(toggleButtonID, ref toggleButtons); } if (daynightTabID != -1) { ButtonControl.DayNightButtonControl(daynightTabID, ref currentdaynightTab, ref daynightTab); } if (categoriesTabID != -1) { if (categoriesTabID != currentTab) { categoriesTab[currentTab].Pressed = false; categoriesTab[categoriesTabID].Pressed = true; currentTab = categoriesTabID; scrollPos = Vector2.zero; } } if (vehicleSettingsID != -1) { if (vehicleSettingsID == 0) { if (SeamothOverDrive.Main != null) { seamothCanFly = !seamothCanFly; vehicleSettings[0].Pressed = seamothCanFly; } else { ErrorMessage.AddMessage("CheatManager Error!\nYou do not have a Seamoth!"); } } if (vehicleSettingsID == 1) { if (SeaglideOverDrive.Main != null) { isSeaglideFast.Update(!isSeaglideFast.value); vehicleSettings[1].Pressed = isSeaglideFast.value; } else { ErrorMessage.AddMessage("CheatManager Error!\nYou do not have a Seaglide!"); } } } } if (toggleButtons[18].Pressed) { Player.main.infectedMixin.SetInfectedAmount(0f); } } }