private void OnSeatruckPositionChanged()
        {
            switch (SeatruckPosition)
            {
            case TruckPosition.AboveWater:
            case TruckPosition.AboveSurface:
                if (!isFlying.value)
                {
                    isFlying.Update(true);
                }
                break;

            case TruckPosition.BelowWater:
                if (isFlying.value)
                {
                    isFlying.Update(false);
                }
                break;
            }
#if DEBUG
            UpdateSeatruckPosition();
#endif
        }
        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);
                    }
                }
            }
        }
Пример #3
0
        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);
                }
            }
        }
Пример #4
0
        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 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);
                        }
                    }
                }
            }
        }