Ejemplo n.º 1
0
        private static void Postfix(IngameMenu __instance)
        {
            if (GameModeUtils.IsPermadeath())
            {
                return;
            }

            if (__instance != null && quitButton == null)
            {
                var prefab = __instance.quitToMainMenuButton.transform.parent.GetChild(0).gameObject.GetComponent <Button>();
                quitButton      = GameObject.Instantiate(prefab, __instance.quitToMainMenuButton.transform.parent);
                quitButton.name = "ButtonQuitToDesktop";
                quitButton.onClick.RemoveAllListeners();
                quitButton.onClick.AddListener(() => { __instance.QuitGame(true); });

                IEnumerable <Text> texts = quitButton.GetComponents <Text>().Concat(quitButton.GetComponentsInChildren <Text>());
                foreach (Text text in texts)
                {
                    text.text = "Quit to Desktop";
                }

                texts = __instance.quitToMainMenuButton.GetComponents <Text>().Concat(__instance.quitToMainMenuButton.GetComponentsInChildren <Text>());
                foreach (Text text in texts)
                {
                    text.text = "Quit to Main Menu";
                }
            }
        }
Ejemplo n.º 2
0
 public static void QuitGame_Postfix(bool quitToDesktop)
 {
     if (GameModeUtils.IsPermadeath())
     {
         KnownTechFixer.SaveAddedNotifications();
         ConstructableFixer.SaveLadderDirections();
     }
 }
Ejemplo n.º 3
0
        public static void Postfix(IngameMenu __instance)
        {
            if (GameModeUtils.IsPermadeath())
            {
                return;
            }

            if (__instance != null && quitButton == null)
            {
                // make a new confirmation Menu
                var quitConfirmationPrefab = __instance.gameObject.FindChild("QuitConfirmation");
                quitConfirmation      = GameObject.Instantiate(quitConfirmationPrefab, __instance.gameObject.FindChild("QuitConfirmation").transform.parent);
                quitConfirmation.name = "QuitToDesktopConfirmation";


                // get the No Button and add the needed listeners to it
                var noButtonPrefab = quitConfirmation.gameObject.transform.Find("ButtonNo").GetComponent <Button>();
                noButtonPrefab.onClick.RemoveAllListeners();
                noButtonPrefab.onClick.AddListener(() => { __instance.Close(); });


                // get the Yes Button and add the needed listeners to it
                var yesButtonPrefab = quitConfirmation.gameObject.transform.Find("ButtonYes").GetComponent <Button>();
                yesButtonPrefab.onClick.RemoveAllListeners();
                yesButtonPrefab.onClick.AddListener(() => { __instance.QuitGame(true); });


                // make the Quit To Desktop Button
                var buttonPrefab = __instance.quitToMainMenuButton;
                quitButton      = GameObject.Instantiate(buttonPrefab, __instance.quitToMainMenuButton.transform.parent);
                quitButton.name = "ButtonQuitToDesktop";
                quitButton.onClick.RemoveAllListeners();
                quitButton.onClick.AddListener(() => { __instance.gameObject.FindChild("QuitConfirmationWithSaveWarning").SetActive(false); });  // set the confirmation with save false so it doesn't conflict
                quitButton.onClick.AddListener(() => { __instance.gameObject.FindChild("QuitConfirmation").SetActive(false); });                 // set the Quit To Main Menu confirmation to false so it doesn't conflict
                if (!QPatch.Config.ShowConfirmationDialog)
                {
                    quitButton.onClick.AddListener(() => { __instance.QuitGame(true); });
                }
                else if (QPatch.Config.ShowConfirmationDialog)
                {
                    quitButton.onClick.AddListener(() => { quitConfirmation.SetActive(true); });                     // set our new confirmation to true
                }
                IEnumerable <Text> texts = quitButton.GetComponents <Text>().Concat(quitButton.GetComponentsInChildren <Text>());
                foreach (Text text in texts)
                {
                    text.text = "Quit to Desktop";
                }

                texts = __instance.quitToMainMenuButton.GetComponents <Text>().Concat(__instance.quitToMainMenuButton.GetComponentsInChildren <Text>());
                foreach (Text text in texts)
                {
                    text.text = "Quit to Main Menu";
                }
            }
        }
Ejemplo n.º 4
0
        public static void Postfix(IngameMenu __instance)
        {
            if (GameModeUtils.IsPermadeath())
            {
                return;
            }

            if (__instance != null && quitButton == null)
            {
                // make a new Confirmation Menu
                var confirmationMenuPrefab = __instance.gameObject.FindChild("QuitConfirmation");
                quitConfirmation      = GameObject.Instantiate(confirmationMenuPrefab, __instance.gameObject.FindChild("QuitConfirmation").transform.parent);
                quitConfirmation.name = "QuitToDesktopConfirmation";

                // get the no button from the confirmation menu and add the needed listener
                var noButtonPrefab = quitConfirmation.gameObject.transform.Find("ButtonNo").GetComponent <Button>();
                noButtonPrefab.onClick.RemoveAllListeners();
                noButtonPrefab.onClick.AddListener(() => { __instance.Close(); });

                // get the yes button from the confirmation menu and add the needed listener
                var yesButtonPrefab = quitConfirmation.gameObject.transform.Find("ButtonYes").GetComponent <Button>();
                yesButtonPrefab.onClick.RemoveAllListeners();
                yesButtonPrefab.onClick.AddListener(() => { __instance.QuitGame(true); });


                // make a new button
                var buttonPrefab = __instance.quitToMainMenuButton.gameObject.GetComponent <Button>();
                quitButton      = GameObject.Instantiate(buttonPrefab, __instance.quitToMainMenuButton.transform.parent);
                quitButton.name = "ButtonQuitToDesktop";
                quitButton.onClick.RemoveAllListeners();
                quitButton.onClick.AddListener(() => { __instance.gameObject.FindChild("QuitConfirmationWithSaveWarning").SetActive(false); });
                quitButton.onClick.AddListener(() => { __instance.gameObject.FindChild("QuitConfirmation").SetActive(false); });
                quitButton.onClick.AddListener(() => { quitConfirmation.SetActive(true); });

                IEnumerable <TextMeshProUGUI> texts = quitButton.GetComponents <TextMeshProUGUI>().Concat(quitButton.GetAllComponentsInChildren <TextMeshProUGUI>());

                foreach (var text in texts)
                {
                    text.text = "Quit to Desktop"; // change our Button text to Quit To Desktop
                }

                texts = __instance.quitToMainMenuButton.GetComponents <TextMeshProUGUI>().Concat(__instance.quitToMainMenuButton.GetAllComponentsInChildren <TextMeshProUGUI>());

                foreach (var text in texts)
                {
                    text.text = "Quit to Main Menu"; // change the Quit button text into Quit to Main Menu
                }
            }
        }
Ejemplo n.º 5
0
 internal static void ReadGameValues()
 {
     toggleButtons[0].Pressed = GameModeUtils.IsOptionActive(GameModeOption.NoSurvival);
     toggleButtons[1].Pressed = GameModeUtils.IsOptionActive(GameModeOption.NoBlueprints);
     toggleButtons[2].Pressed = GameModeUtils.RequiresSurvival();
     toggleButtons[3].Pressed = GameModeUtils.IsPermadeath();
     toggleButtons[4].Pressed = NoCostConsoleCommand.main.fastBuildCheat;
     toggleButtons[5].Pressed = NoCostConsoleCommand.main.fastScanCheat;
     toggleButtons[6].Pressed = NoCostConsoleCommand.main.fastGrowCheat;
     toggleButtons[7].Pressed = NoCostConsoleCommand.main.fastHatchCheat;
     //toggleButtons[8].Pressed = filterfast cheat
     toggleButtons[9].Pressed  = GameModeUtils.IsOptionActive(GameModeOption.NoCost);
     toggleButtons[10].Pressed = GameModeUtils.IsCheatActive(GameModeOption.NoEnergy);
     toggleButtons[11].Pressed = GameModeUtils.IsOptionActive(GameModeOption.NoSurvival);
     toggleButtons[12].Pressed = GameModeUtils.IsOptionActive(GameModeOption.NoOxygen);
     toggleButtons[13].Pressed = GameModeUtils.IsOptionActive(GameModeOption.NoRadiation);
     toggleButtons[14].Pressed = GameModeUtils.IsInvisible();
     //toggleButtons[15].Pressed = shotgun cheat
     toggleButtons[16].Pressed = NoDamageConsoleCommand.main.GetNoDamageCheat();
     //toggleButtons[17].Pressed = alwaysDay cheat
     //toggleButtons[18].Pressed = noInfect cheat
     toggleButtons[19].Enabled  = GameModeUtils.RequiresSurvival();
     vehicleSettings[0].Pressed = seamothCanFly;
 }
        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);
        }
Ejemplo n.º 7
0
 private static bool IsPlayingPermaDeath()
 {
     return(GameModeUtils.IsPermadeath());
 }
Ejemplo n.º 8
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;
             */
        }