public void OnGUI()
        {
            SNWindow.CreateWindow(windowRect, $"CheatManagerZer\u00F8 Configuration interface", false, true);

            GUI.FocusControl("CheatManagerZer0.ConfigUI");

            SNGUI.DrawGuiItemsGroup(ref itemInfo);

            int sBtn = SNGUI.DrawGuiItemsGroup(ref buttonInfo);

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

            if (GUI.Button(new Rect(windowRect.x + space, buttonsRect.GetLast().y + space * 2, windowRect.width / 2 - space * 2, 40), "Save"))
            {
                SaveAndExit();
            }
            else if (GUI.Button(new Rect(windowRect.x + space + windowRect.width / 2, buttonsRect.GetLast().y + space * 2, windowRect.width / 2 - space * 2, 40), "Cancel"))
            {
                Destroy(Instance);
            }

            keyEvent = Event.current;

            if (keyEvent.isKey && waitingForKey)
            {
                newKey        = keyEvent.keyCode;
                waitingForKey = false;
            }
        }
        internal void UpdateButtonsState()
        {
            toggleCommands[(int)ToggleCommands.freedom].State    = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoSurvival));
            toggleCommands[(int)ToggleCommands.creative].State   = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoBlueprints));
            toggleCommands[(int)ToggleCommands.survival].State   = SNGUI.ConvertBoolToState(GameModeUtils.RequiresSurvival());
            toggleCommands[(int)ToggleCommands.hardcore].State   = SNGUI.ConvertBoolToState(GameModeUtils.IsPermadeath());
            toggleCommands[(int)ToggleCommands.fastbuild].State  = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastBuildCheat);
            toggleCommands[(int)ToggleCommands.fastscan].State   = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastScanCheat);
            toggleCommands[(int)ToggleCommands.fastgrow].State   = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastGrowCheat);
            toggleCommands[(int)ToggleCommands.fasthatch].State  = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastHatchCheat);
            toggleCommands[(int)ToggleCommands.filterfast].State = SNGUI.ConvertBoolToState(filterFast);
            toggleCommands[(int)ToggleCommands.nocost].State     = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoCost));
            toggleCommands[(int)ToggleCommands.noenergy].State   = SNGUI.ConvertBoolToState(GameModeUtils.IsCheatActive(GameModeOption.NoEnergy));
            toggleCommands[(int)ToggleCommands.nosurvival].State = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoSurvival));
            toggleCommands[(int)ToggleCommands.oxygen].State     = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoOxygen));
            toggleCommands[(int)ToggleCommands.radiation].State  = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoRadiation));
            toggleCommands[(int)ToggleCommands.invisible].State  = SNGUI.ConvertBoolToState(GameModeUtils.IsInvisible());
            //toggleCommands[(int)ToggleCommands.shotgun].State = shotgun cheat
            toggleCommands[(int)ToggleCommands.nodamage].State    = SNGUI.ConvertBoolToState(NoDamageConsoleCommand.main.GetNoDamageCheat());
            toggleCommands[(int)ToggleCommands.noinfect].State    = SNGUI.ConvertBoolToState(NoInfectConsoleCommand.main.GetNoInfectCheat());
            toggleCommands[(int)ToggleCommands.alwaysday].State   = SNGUI.ConvertBoolToState(AlwaysDayConsoleCommand.main.GetAlwaysDayCheat());
            toggleCommands[(int)ToggleCommands.overpower].Enabled = GameModeUtils.RequiresSurvival();

            if (toggleCommands[(int)ToggleCommands.overpower].Enabled)
            {
                toggleCommands[(int)ToggleCommands.overpower].State = SNGUI.ConvertBoolToState(OverPowerConsoleCommand.main.GetOverPowerCheat());
            }

            vehicleSettings[0].State = SNGUI.ConvertBoolToState(isSeamothCanFly.value);
            vehicleSettings[1].State = SNGUI.ConvertBoolToState(isSeaglideFast.value);
        }
        public void OnGUI()
        {
            if (!isActive)
            {
                return;
            }

            SNWindow.CreateWindow(windowRect, windowTitle);

            normalButtonID  = SNGUI.DrawGuiItemsGroup(ref commands);
            toggleButtonID  = SNGUI.DrawGuiItemsGroup(ref toggleCommands);
            daynightTabID   = SNGUI.DrawGuiItemsGroup(ref daynightTab);
            weatherTabID    = SNGUI.DrawGuiItemsGroup(ref weatherTab);
            categoriesTabID = SNGUI.DrawGuiItemsGroup(ref categoriesTab);

            if (currentTab == 0)
            {
                scrollviewID = SNScrollView.CreateScrollView(scrollRect, ref scrollPos, ref scrollItemsList[currentTab], "Select Item in Category:", categoriesTab[currentTab].Name, MAXSHOWITEMS);

                vehicleSettingsID = SNGUI.DrawGuiItemsGroup(ref vehicleSettings);

                SNHorizontalSlider.CreateHorizontalSlider(sliders[0].Rect, ref seamothSpeedMultiplier, 1f, 5f, sliders[0].Name, sliders[0].OnChangedEvent);
                SNHorizontalSlider.CreateHorizontalSlider(sliders[1].Rect, ref exosuitSpeedMultiplier, 1f, 5f, sliders[1].Name, sliders[1].OnChangedEvent);
                SNHorizontalSlider.CreateHorizontalSlider(sliders[2].Rect, ref hoverbikeSpeedMultiplier, 1f, 5f, sliders[2].Name, sliders[2].OnChangedEvent);
            }
            else
            {
                scrollviewID = SNScrollView.CreateScrollView(scrollRect, ref scrollPos, ref scrollItemsList[currentTab], "Select Item in Category:", categoriesTab[currentTab].Name);
            }
        }
        private void InitItems()
        {
            foreach (KeyValuePair <string, string> key in Config.Section_hotkeys)
            {
                HotkeyLabels.Add(key.Key);
                HotkeyButtons.Add(key.Value);
            }

            foreach (KeyValuePair <string, string> key in Config.Section_settings)
            {
                SettingLabels.Add(key.Key);
            }

            drawRect = SNWindow.InitWindowRect(windowRect, true);

            List <Rect> itemsRect = SNWindow.SetGridItemsRect(new Rect(drawRect.x, drawRect.y, drawRect.width / 2, drawRect.height),
                                                              1, HotkeyLabels.Count, Screen.height / 45, 10, 10);

            buttonsRect = SNWindow.SetGridItemsRect(new Rect(drawRect.x + drawRect.width / 2, drawRect.y, drawRect.width / 2, drawRect.height),
                                                    1, HotkeyButtons.Count + 1, Screen.height / 45, 10, 10);

            SNGUI.CreateGuiItemsGroup(HotkeyLabels.ToArray(), itemsRect, GuiItemType.TEXTFIELD, ref itemInfo, new GuiItemColor());

            SNGUI.CreateGuiItemsGroup(HotkeyButtons.ToArray(), buttonsRect, GuiItemType.NORMALBUTTON, ref buttonInfo, new GuiItemColor(GuiColor.Gray, GuiColor.White, GuiColor.Green), GuiItemState.NORMAL, true, FontStyle.Bold, TextAnchor.MiddleCenter);
        }
Esempio n. 5
0
        private void InitItems()
        {
            foreach (KeyValuePair <string, string> key in Config.Section_hotkeys)
            {
                labels.Add(key.Key);
                buttons.Add(key.Value);
            }

            windowRect = new Rect(0, 0, Screen.width / 6, buttons.Count * 48);
            drawrect   = SNWindow.InitWindowRect(windowRect);

            List <Rect> labelRects = SNWindow.SetGridItemsRect(new Rect(drawrect.x, drawrect.y, drawrect.width / 2, drawrect.height), 1, labels.Count, 24, 10, 10, false);

            SNGUI.CreateGuiItemsGroup(labels.ToArray(), labelRects, GuiItemType.TEXTFIELD, ref labelInfo, new GuiItemColor(normal: GuiColor.White));
            buttonRects = SNWindow.SetGridItemsRect(new Rect(drawrect.x + drawrect.width / 2, drawrect.y, drawrect.width / 2, drawrect.height), 1, buttons.Count, 24, 10, 10, false);
            SNGUI.CreateGuiItemsGroup(buttons.ToArray(), buttonRects, GuiItemType.NORMALBUTTON, ref buttonInfo, new GuiItemColor(normal: GuiColor.White));
        }
        public void OnGUI()
        {
            SNWindow.CreateWindow(new Rect(0, 0, Screen.width / 6, hotkeyLabels.Count * 47), "SlotExtenderZero Configuration Window", false, false);

            GUI.FocusControl("SlotExtenderZero.ConfigUI");

            SNGUI.DrawGuiItemsGroup(ref itemInfo);

            int sBtn = SNGUI.DrawGuiItemsGroup(ref buttonInfo);

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

            SNDropDown.CreateDropdown(buttonsRect[buttonsRect.Count - 2], ref isVisible, ref dropdownSelection, dropDownContent);

            float y = itemsRect[itemsRect.Count - 2].y + space * 2 + itemsRect[0].height;

            if (GUI.Button(new Rect(itemsRect[0].x, y, itemsRect[0].width, Screen.height / 22.5f), "Save", SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON)))
            {
                SaveAndExit();
            }

            if (!isVisible)
            {
                if (GUI.Button(new Rect(buttonsRect[0].x, y, buttonsRect[0].width, Screen.height / 22.5f), "Cancel", SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON)))
                {
                    Destroy(Instance);
                }
            }

            keyEvent = Event.current;

            if (keyEvent.isKey && waitingForKey)
            {
                newKey        = InputHelper.GetKeyCodeAsInputName(keyEvent.keyCode);
                waitingForKey = false;
            }
        }
Esempio n. 7
0
        internal void UpdateButtonsState()
        {
            toggleCommands[(int)ToggleCommands.freedom].State    = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoSurvival));
            toggleCommands[(int)ToggleCommands.creative].State   = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoBlueprints));
            toggleCommands[(int)ToggleCommands.survival].State   = SNGUI.ConvertBoolToState(GameModeUtils.RequiresSurvival());
            toggleCommands[(int)ToggleCommands.hardcore].State   = SNGUI.ConvertBoolToState(GameModeUtils.IsPermadeath());
            toggleCommands[(int)ToggleCommands.fastbuild].State  = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastBuildCheat);
            toggleCommands[(int)ToggleCommands.fastscan].State   = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastScanCheat);
            toggleCommands[(int)ToggleCommands.fastgrow].State   = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastGrowCheat);
            toggleCommands[(int)ToggleCommands.fasthatch].State  = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastHatchCheat);
            toggleCommands[(int)ToggleCommands.filterfast].State = SNGUI.ConvertBoolToState(filterFast);
            toggleCommands[(int)ToggleCommands.nocost].State     = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoCost));
            toggleCommands[(int)ToggleCommands.noenergy].State   = SNGUI.ConvertBoolToState(GameModeUtils.IsCheatActive(GameModeOption.NoEnergy));
            toggleCommands[(int)ToggleCommands.nosurvival].State = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoSurvival));
            toggleCommands[(int)ToggleCommands.oxygen].State     = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoOxygen));
            //toggleCommands[(int)ToggleCommands.radiation].State = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoRadiation));
            toggleCommands[(int)ToggleCommands.invisible].State = SNGUI.ConvertBoolToState(GameModeUtils.IsInvisible());
            //toggleCommands[(int)ToggleCommands.shotgun].State = shotgun cheat
            toggleCommands[(int)ToggleCommands.nodamage].State = SNGUI.ConvertBoolToState(NoDamageConsoleCommand.main.GetNoDamageCheat());
            //toggleCommands[(int)ToggleCommands.noinfect].State = SNGUI.ConvertBoolToState(NoInfectConsoleCommand.main.GetNoInfectCheat());
            toggleCommands[(int)ToggleCommands.alwaysday].State   = SNGUI.ConvertBoolToState(AlwaysDayConsoleCommand.main.GetAlwaysDayCheat());
            toggleCommands[(int)ToggleCommands.overpower].Enabled = GameModeUtils.RequiresSurvival();
            toggleCommands[(int)ToggleCommands.weather].State     = isWeatherEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED;
            toggleCommands[(int)ToggleCommands.resistcold].State  = SNGUI.ConvertBoolToState(ResistColdConsoleCommand.main.GetResistColdCheat());
            toggleCommands[(int)ToggleCommands.noiceworm].State   = noIceWorm ?  GuiItemState.PRESSED : GuiItemState.NORMAL;
            if (toggleCommands[(int)ToggleCommands.overpower].Enabled)
            {
                toggleCommands[(int)ToggleCommands.overpower].State = SNGUI.ConvertBoolToState(OverPowerConsoleCommand.main.GetOverPowerCheat());
            }

            //vehicleSettings[0].State = SNGUI.ConvertBoolToState(isSeamothCanFly.value);
            vehicleSettings[0].State = SNGUI.ConvertBoolToState(isSeaglideFast.value);

            /*
             * weatherTab[(int)Weather.weather].State = isWeatherEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED;
             * weatherTab[(int)Weather.lightning].State = VFXWeatherManager.main.lightningsEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED;
             * weatherTab[(int)Weather.precipitation].State = VFXWeatherManager.main.precipitationEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED;
             * weatherTab[(int)Weather.wind].State = WeatherManager.main.debugWindEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED;
             * weatherTab[(int)Weather.cold].State = GameModeUtils.IsOptionActive(GameModeOption.NoCold) ? GuiItemState.PRESSED : GuiItemState.NORMAL;
             */
        }
        private void InitItems()
        {
            foreach (KeyValuePair <string, string> key in Config.Section_hotkeys)
            {
                hotkeyLabels.Add(key.Key);
                hotkeyButtons.Add(key.Value);
            }

            hotkeyLabels.Add("MaxSlots");

            windowRect = SNWindow.InitWindowRect(new Rect(0, 0, Screen.width / 6, hotkeyLabels.Count * 47));

            itemsRect = SNWindow.SetGridItemsRect(new Rect(windowRect.x, windowRect.y, windowRect.width / 2, windowRect.height), 1, hotkeyLabels.Count, Screen.height / 45, space, space, false, true);

            buttonsRect = SNWindow.SetGridItemsRect(new Rect(windowRect.x + windowRect.width / 2, windowRect.y, windowRect.width / 2, windowRect.height), 1, hotkeyButtons.Count + 1, Screen.height / 45, space, space, false, true);

            SNGUI.CreateGuiItemsGroup(hotkeyLabels.ToArray(), itemsRect, GuiItemType.LABEL, ref itemInfo, new GuiItemColor(), fontStyle: FontStyle.Bold, textAnchor: TextAnchor.MiddleLeft);

            SNGUI.CreateGuiItemsGroup(hotkeyButtons.ToArray(), buttonsRect, GuiItemType.NORMALBUTTON, ref buttonInfo, new GuiItemColor(), fontStyle: FontStyle.Bold, textAnchor: TextAnchor.MiddleCenter);

            SNGUI.SetGuiItemsGroupLabel("Functions", itemsRect.GetLast(), ref itemInfo, new GuiItemColor());

            SNGUI.SetGuiItemsGroupLabel("Hotkeys", buttonsRect.GetLast(), ref buttonInfo, new GuiItemColor());
        }
Esempio n. 9
0
        public void OnGUI()
        {
            SNWindow.CreateWindow(windowRect, "QuickSlot Extender Zero Configuration Window", false, false);

            GUI.FocusControl("QuickSlotExtenderZero.ConfigUI");

            SNGUI.DrawGuiItemsGroup(ref labelInfo);

            int sBtn = SNGUI.DrawGuiItemsGroup(ref buttonInfo);

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

            float lastY = SNWindow.GetNextYPos(ref buttonRects);

            if (GUI.Button(new Rect(windowRect.x + space, lastY + space * 2, windowRect.width / 2 - space * 2, Screen.height / 22.5f), "Save"))
            {
                SaveAndExit();
            }
            else if (GUI.Button(new Rect(windowRect.x + space + windowRect.width / 2, lastY + space * 2, windowRect.width / 2 - space * 2, Screen.height / 22.5f), "Cancel"))
            {
                Destroy(Instance);
            }

            keyEvent = Event.current;

            if (keyEvent.isKey && waitingForKey)
            {
                newKey        = InputHelper.GetKeyCodeAsInputName(keyEvent.keyCode);
                waitingForKey = false;
            }
        }
        public void Update()
        {
            if (Player.main != null)
            {
                if (Input.GetKeyDown(Config.KEYBINDINGS["ToggleWindow"]))
                {
                    isActive = !isActive;
                }

                if (!isActive)
                {
                    return;
                }

                if (Input.GetKeyDown(Config.KEYBINDINGS["ToggleMouse"]))
                {
                    UWE.Utils.lockCursor = !UWE.Utils.lockCursor;
                }

                if (!initToggleButtons && !uGUI.main.loading.IsLoading)
                {
                    SetToggleButtons();
                    initToggleButtons = true;
                    UpdateButtonsState();
                }

                if (CommandsGroup.ItemID != -1 && CommandsGroup.MouseButton == 0)
                {
                    buttonControl.NormalButtonControl(CommandsGroup.ItemID, ref commands, ref toggleCommands);
                }

                if (ToggleCommandsGroup.ItemID != -1 && ToggleCommandsGroup.MouseButton == 0)
                {
                    buttonControl.ToggleButtonControl(ToggleCommandsGroup.ItemID, ref toggleCommands);
                }

                if (DayNightGroup.ItemID != -1 && DayNightGroup.MouseButton == 0)
                {
                    buttonControl.DayNightButtonControl(DayNightGroup.ItemID, ref currentdaynightTab, ref daynightTab);
                }

                if (CategoriesGroup.ItemID != -1 && CategoriesGroup.MouseButton == 0)
                {
                    if (CategoriesGroup.ItemID != currentTab)
                    {
                        //categoriesTab[currentTab].State = SNGUI.SetStateInverse(categoriesTab[currentTab].State);
                        //categoriesTab[categoriesTabID].State = SNGUI.SetStateInverse(categoriesTab[categoriesTabID].State);
                        currentTab = CategoriesGroup.ItemID;
                        scrollPos  = Vector2.zero;
                    }
                }

                if (ScrollViewGroup.ItemID != -1 && ScrollViewGroup.MouseButton == 0)
                {
                    buttonControl.ScrollViewControl(currentTab, ScrollViewGroup.ItemID, ref scrollItemsList[currentTab], ref tMatrix, ref commands);
                }

                if (VehicleSettingsGroup.ItemID != -1 && VehicleSettingsGroup.MouseButton == 0)
                {
                    if (VehicleSettingsGroup.ItemID == 0)
                    {
                        isSeamothCanFly.Update(!isSeamothCanFly.value);
                        vehicleSettings[0].State = SNGUI.ConvertBoolToState(isSeamothCanFly.value);
                    }

                    if (VehicleSettingsGroup.ItemID == 1)
                    {
                        isSeaglideFast.Update(!isSeaglideFast.value);
                        vehicleSettings[1].State = SNGUI.ConvertBoolToState(isSeaglideFast.value);
                    }
                }
            }
        }
        public void Update()
        {
            if (Player.main != null)
            {
                if (Input.GetKeyDown(CmConfig.KEYBINDINGS["ToggleWindow"]))
                {
                    isActive = !isActive;
                }

                if (!isActive)
                {
                    return;
                }

                if (Input.GetKeyDown(CmConfig.KEYBINDINGS["ToggleMouse"]))
                {
                    UWE.Utils.lockCursor = !UWE.Utils.lockCursor;
                }

                if (!initToggleButtons && !uGUI.main.loading.IsLoading)
                {
                    SetToggleButtons();
                    initToggleButtons = true;
                    UpdateButtonsState();
                }

                if (CommandsGroup.ItemID != -1 && CommandsGroup.MouseButton == 0)
                {
                    NormalButtonControl(CommandsGroup.ItemID, ref commands, ref toggleCommands);
                }

                if (ToggleCommandsGroup.ItemID != -1 && ToggleCommandsGroup.MouseButton == 0)
                {
                    ToggleButtonControl(ToggleCommandsGroup.ItemID, ref toggleCommands);
                }

                if (DayNightGroup.ItemID != -1 && DayNightGroup.MouseButton == 0)
                {
                    DayNightButtonControl(DayNightGroup.ItemID, ref currentdaynightTab, ref daynightTab);
                }

                if (CategoriesGroup.ItemID != -1 && CategoriesGroup.MouseButton == 0)
                {
                    if (CategoriesGroup.ItemID != currentTab)
                    {
                        //categoriesTab[currentTab].State = SNGUI.SetStateInverse(categoriesTab[currentTab].State);
                        //categoriesTab[categoriesTabID].State = SNGUI.SetStateInverse(categoriesTab[categoriesTabID].State);
                        currentTab = CategoriesGroup.ItemID;
                        scrollPos  = Vector2.zero;
                    }
                }

                if (ScrollViewGroup.ItemID != -1)
                {
                    if (ScrollViewGroup.MouseButton == 0)
                    {
                        ScrollViewControl(currentTab, ScrollViewGroup.ItemID, ref scrollItemsList[currentTab], ref tMatrix, ref commands);
                    }
                    else if (currentTab == 19 && ScrollViewGroup.MouseButton == 1)
                    {
                        if (ScrollViewGroup.ItemID < WarpTargets_Internal.Count)
                        {
                            ErrorMessage.AddMessage($"CheatManager Warning!\nInternal list items cannot be selected!");
                            return;
                        }

                        scrollItemsList[currentTab].UnmarkAll();
                        scrollItemsList[currentTab][ScrollViewGroup.ItemID].SetStateInverse();
                    }
                }

                if (VehicleSettingsGroup.ItemID != -1 && VehicleSettingsGroup.MouseButton == 0)
                {
                    if (VehicleSettingsGroup.ItemID == 0)
                    {
                        isSeamothCanFly.Update(!isSeamothCanFly.value);
                        vehicleSettings[0].State = SNGUI.ConvertBoolToState(isSeamothCanFly.value);
                    }

                    if (VehicleSettingsGroup.ItemID == 1)
                    {
                        isSeaglideFast.Update(!isSeaglideFast.value);
                        vehicleSettings[1].State = SNGUI.ConvertBoolToState(isSeaglideFast.value);
                    }
                }

                if (WarpExtrasGroup.ItemID != -1 && WarpExtrasGroup.MouseButton == 0)
                {
                    if (WarpExtrasGroup.ItemID == 0)
                    {
                        IntVector position = new IntVector(Player.main.transform.position);

                        if (IsPositionWithinRange(position, out string nearestWarpName))
                        {
                            ErrorMessage.AddMessage($"CheatManagerZero Warning!\nThis position cannot be added to the Warp list\nbecause it is very close to:\n{nearestWarpName} warp point!");
                        }
                        else
                        {
                            AddToList(position);
                        }
                    }

                    if (WarpExtrasGroup.ItemID == 1)
                    {
                        int item = scrollItemsList[currentTab].GetMarkedItem();

                        if (item == -1)
                        {
                            ErrorMessage.AddMessage("CheatManagerZero Error!\nNo item selected from the user Warp list!");
                            return;
                        }

                        isDirty = true;

                        int userIndex = item - WarpTargets_Internal.Count;

                        IntVector intVector = WarpTargets_User.Keys.ElementAt(userIndex);


                        //WarpTargets_User.TryGetValue(intVector, out string value);

                        //print($"item: {item}, userIndex: {userIndex}, Internal.Count: {WarpTargets_Internal.Count}, User.Count: {WarpTargets_User.Count}");
                        //print($"Key: {intVector}, Value: {value}");
                        //print($"scrollItemsList[currentTab].Count: {scrollItemsList[currentTab].Count}");

                        RemoveFormList(intVector);

                        scrollItemsList[currentTab].RemoveGuiItemFromGroup(item);

                        isDirty = false;
                    }
                }
            }
        }
        public void Awake()
        {
            Instance     = this;
            useGUILayout = false;

#if DEBUG_PROGRAM
            isActive = true;
#endif
            UpdateTitle();
            warpSound      = ScriptableObject.CreateInstance <FMODAsset>();
            warpSound.path = "event:/tools/gravcannon/fire";

            techMatrix = new TechnologyMatrix();
            tMatrix    = new List <TechTypeData> [18];
            techMatrix.InitTechMatrixList(ref tMatrix);

            techMatrix.InitFullTechMatrixList(ref FullTechMatrix);
            FullTechMatrix.Sort();

            /*
             * if (Main.isExistsSMLHelperV2)
             * {
             *  techMatrix.IsExistsModdersTechTypes(ref tMatrix, techMatrix.Known_Modded_TechTypes);
             * }
             * else
             * {
             *  Debug.LogWarning("[CheatManager] 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 = SNWindow.SetGridItemsRect(drawRect, 4, 3, ITEMSIZE, SPACE, SPACE, true, true);

            SNGUI.CreateGuiItemsGroup(buttonText.Buttons, commandRects, GuiItemType.NORMALBUTTON, ref commands, new GuiItemColor());
            SNGUI.SetGuiItemsGroupLabel("Commands", commandRects.GetLast(), ref commands, new GuiItemColor(GuiColor.White));

            List <Rect> toggleCommandRects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, SNWindow.GetNextYPos(ref commandRects), drawRect.width, drawRect.height), 4, 5, ITEMSIZE, SPACE, SPACE, true, true);
            SNGUI.CreateGuiItemsGroup(buttonText.ToggleButtons, toggleCommandRects, GuiItemType.TOGGLEBUTTON, ref toggleCommands, new GuiItemColor(GuiColor.Red, GuiColor.Green));
            SNGUI.SetGuiItemsGroupLabel("Toggle Commands", toggleCommandRects.GetLast(), ref toggleCommands, new GuiItemColor(GuiColor.White));

            List <Rect> daynightTabrects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, SNWindow.GetNextYPos(ref toggleCommandRects), drawRect.width, drawRect.height), 6, 1, 24, SPACE, SPACE, true, true);
            SNGUI.CreateGuiItemsGroup(buttonText.DayNightTab, daynightTabrects, GuiItemType.TAB, ref daynightTab, new GuiItemColor());
            SNGUI.SetGuiItemsGroupLabel("Day/Night Speed:", daynightTabrects.GetLast(), ref daynightTab, new GuiItemColor(GuiColor.White));

            List <Rect> weatherTabrects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, SNWindow.GetNextYPos(ref daynightTabrects), drawRect.width, drawRect.height), 5, 1, ITEMSIZE, SPACE, SPACE, true, true);
            SNGUI.CreateGuiItemsGroup(buttonText.WeatherCommands, weatherTabrects, GuiItemType.TOGGLEBUTTON, ref weatherTab, new GuiItemColor(GuiColor.Red, GuiColor.Green));
            SNGUI.SetGuiItemsGroupLabel("Weather Settings:", weatherTabrects.GetLast(), ref weatherTab, new GuiItemColor(GuiColor.White));

            List <Rect> categoriesTabrects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, SNWindow.GetNextYPos(ref weatherTabrects), drawRect.width, drawRect.height), 4, 5, ITEMSIZE, SPACE, SPACE, true, true);
            SNGUI.CreateGuiItemsGroup(buttonText.CategoriesTab, categoriesTabrects, GuiItemType.TAB, ref categoriesTab, new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White));
            SNGUI.SetGuiItemsGroupLabel("Categories:", categoriesTabrects.GetLast(), ref categoriesTab, 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 + 2];

            for (int i = 0; i < tMatrix.Length; i++)
            {
                float width = drawRect.width;

                if (i == 0 && tMatrix[0].Count > MAXSHOWITEMS)
                {
                    width -= 20;
                }

                else if (tMatrix[i].Count * (ITEMSIZE + SPACE) > 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);
            scrollItemRects[tMatrix.Length + 1] = SNWindow.SetGridItemsRect(new Rect(0, 0, drawRect.width - 20, FullTechMatrix.Count * (ITEMSIZE + SPACE)), 1, FullTechMatrix.Count, ITEMSIZE, SPACE, 2, false, false, true);

            scrollItemsList = new List <GuiItem> [tMatrix.Length + 2];

            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>();
            scrollItemsList[tMatrix.Length + 1] = 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);

            AddTechListToGroup(FullTechMatrix, scrollItemRects[tMatrix.Length + 1], GuiItemType.NORMALBUTTON, ref scrollItemsList[tMatrix.Length + 1], 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 searchHoverBike = new TechnologyMatrix.TechTypeSearch(TechType.Hoverbike);
            hoverbikeName = tMatrix[0][tMatrix[0].FindIndex(searchHoverBike.EqualsWith)].Name;

            var searchSeaTruck = new TechnologyMatrix.TechTypeSearch(TechType.SeaTruck);
            seatruckName = tMatrix[0][tMatrix[0].FindIndex(searchSeaTruck.EqualsWith)].Name;


            string[] vehicleSetButtons = { $"{seamothName} Can Fly", $"{seaglideName} Speed Fast", $"{hoverbikeName} Move on Water" };

            float scrollRectheight = (MAXSHOWITEMS + 1) * (scrollItemsList[0][0].Rect.height + 2);
            float y = scrollRect.y + scrollRectheight + SPACE;

            List <Rect> vehicleSettingsRects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, y, drawRect.width, drawRect.height), 2, 2, ITEMSIZE, SPACE, SPACE, false, true);
            SNGUI.CreateGuiItemsGroup(vehicleSetButtons, vehicleSettingsRects, GuiItemType.TOGGLEBUTTON, ref vehicleSettings, new GuiItemColor(GuiColor.Red, GuiColor.Green));
            SNGUI.SetGuiItemsGroupLabel("Vehicle settings:", vehicleSettingsRects.GetLast(), ref vehicleSettings, new GuiItemColor(GuiColor.White));

            string[] sliderLabels = { $"{seamothName} speed multiplier:", $"{exosuitName} speed multiplier:", $"{hoverbikeName} speed multiplier:" };

            List <Rect> slidersRects = SNWindow.SetGridItemsRect(new Rect(drawRect.x, SNWindow.GetNextYPos(ref vehicleSettingsRects), drawRect.width, drawRect.height), 1, 3, SLIDERHEIGHT, SPACE, SPACE, false, false);
            SNGUI.CreateGuiItemsGroup(sliderLabels, slidersRects, GuiItemType.HORIZONTALSLIDER, ref sliders, new GuiItemColor());

            sliders[0].OnChangedEvent = onSeamothSpeedValueChanged;
            sliders[1].OnChangedEvent = onExosuitSpeedValueChanged;
            sliders[2].OnChangedEvent = onHoverbikeSpeedValueChanged;

            commands[(int)Commands.BackWarp].Enabled = false;
            commands[(int)Commands.BackWarp].State   = GuiItemState.PRESSED;

            daynightTab[4].State   = GuiItemState.PRESSED;
            categoriesTab[0].State = GuiItemState.PRESSED;

            seamothSpeedMultiplier   = 1;
            exosuitSpeedMultiplier   = 1;
            hoverbikeSpeedMultiplier = 1;
            seatruckSpeedMultiplier  = 1;

            buttonControl = new ButtonControl();
        }
        public void Update()
        {
            if (Player.main != null)
            {
                if (Input.GetKeyDown(Config.KEYBINDINGS["ToggleWindow"]))
                {
                    isActive = !isActive;
                }

                if (isActive)
                {
                    if (Input.GetKeyDown(Config.KEYBINDINGS["ToggleMouse"]))
                    {
                        UWE.Utils.lockCursor = !UWE.Utils.lockCursor;
                    }

                    if (!initToggleButtons && !uGUI.main.loading.IsLoading)
                    {
                        SetToggleButtons();
                        initToggleButtons = true;
                        UpdateButtonsState();
                    }
                    if (normalButtonID != -1)
                    {
                        buttonControl.NormalButtonControl(normalButtonID, ref commands, ref toggleCommands);
                    }

                    if (toggleButtonID != -1)
                    {
                        buttonControl.ToggleButtonControl(toggleButtonID, ref toggleCommands);
                    }


                    if (daynightTabID != -1)
                    {
                        buttonControl.DayNightButtonControl(daynightTabID, ref currentdaynightTab, ref daynightTab);
                    }


                    if (weatherTabID != -1)
                    {
                        buttonControl.WeatherButtonControl(weatherTabID, ref weatherTab);
                    }

                    if (categoriesTabID != -1)
                    {
                        if (categoriesTabID != currentTab)
                        {
                            categoriesTab[currentTab].State      = GuiItemState.NORMAL;
                            categoriesTab[categoriesTabID].State = GuiItemState.PRESSED;
                            currentTab = categoriesTabID;
                            scrollPos  = Vector2.zero;
                        }
                    }

                    if (scrollviewID != -1)
                    {
                        buttonControl.ScrollViewControl(currentTab, ref scrollviewID, ref scrollItemsList[currentTab], ref tMatrix, ref commands);
                    }

                    if (vehicleSettingsID != -1)
                    {
                        if (vehicleSettingsID == 0)
                        {
                            isSeamothCanFly.Update(!isSeamothCanFly.value);
                            vehicleSettings[0].State = SNGUI.ConvertBoolToState(isSeamothCanFly.value);
                        }
                        else if (vehicleSettingsID == 1)
                        {
                            isSeaglideFast.Update(!isSeaglideFast.value);
                            vehicleSettings[1].State = SNGUI.ConvertBoolToState(isSeaglideFast.value);
                        }
                        else if (vehicleSettingsID == 2)
                        {
                            isHoverBikeMoveOnWater.Update(!isHoverBikeMoveOnWater.value);
                            vehicleSettings[2].State = SNGUI.ConvertBoolToState(isHoverBikeMoveOnWater.value);
                        }
                    }
                }
            }
        }