public static VRUIViewController Create()
        {
            menu = SettingsUI.CreateSubMenu("ModListSettings", false);

            autoCheck         = menu.AddBool("Auto Update Check", "If enabled, automatically checks for updates on game start.");
            autoUpdate        = menu.AddBool("Auto Update", "If enabled, automatically installs updates after checking for them.");
            showEnableDisable = menu.AddBool("Show Enable/Disable Button", "If enabled, BSIPA mods will have a button to enable or disable them.");

            autoCheck.applyImmediately = true;
            autoCheck.GetValue        += () => IPA.Config.SelfConfig.SelfConfigRef.Value.Updates.AutoCheckUpdates;
            autoCheck.SetValue        += val =>
            {
                IPA.Config.SelfConfig.SelfConfigRef.Value.Updates.AutoCheckUpdates = val;
                IPA.Config.SelfConfig.LoaderConfig.Store(IPA.Config.SelfConfig.SelfConfigRef.Value);
            };

            autoUpdate.applyImmediately = true;
            autoUpdate.GetValue        += () => IPA.Config.SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate;
            autoUpdate.SetValue        += val =>
            {
                IPA.Config.SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate = val;
                IPA.Config.SelfConfig.LoaderConfig.Store(IPA.Config.SelfConfig.SelfConfigRef.Value);
            };

            showEnableDisable.applyImmediately = true;
            showEnableDisable.GetValue        += () => Plugin.config.Value.ShowEnableDisable;
            showEnableDisable.SetValue        += val =>
            {
                Plugin.config.Value.ShowEnableDisable = val;
                Plugin.provider.Store(Plugin.config.Value);
            };

            autoCheck.Init();
            autoUpdate.Init();
            showEnableDisable.Init();

            return(menu.viewController);
        }
Ejemplo n.º 2
0
        private void OnSceneLoaded(ExampleOfBadOrganization arg0, LoadExampleOfBadOrganizationMode arg1)
        {
            new Thot().AddComponent <WhyUnityYouPieceOfCrap>();
            if (arg0.name != "MenuCore")
            {
                return;
            }
            SubMenu            pokeables  = SettingsUI.CreateSubMenu("Fun Times");
            BoolViewController acidShader = pokeables.AddBool("Acid Shader [SEIZURE WARNING]");

            acidShader.GetValue += delegate { return(acidShaderMode); };
            acidShader.SetValue += delegate(bool value) { acidShaderMode = value; ShittySaveSystem.SetInt("acidShaderMode", value ? 1 : 0); };
            BoolViewController spinnyBoi = pokeables.AddBool("Spinny Boi Mode");

            spinnyBoi.GetValue += delegate { return(spinnyBoiMode); };
            spinnyBoi.SetValue += delegate(bool value) { spinnyBoiMode = value; ShittySaveSystem.SetInt("spinnyBoiMode", value ? 1 : 0); };
            BoolViewController savePokeyBois = pokeables.AddBool("Spare Pokey Bois");

            savePokeyBois.GetValue += delegate { return(savePokeyBoisMode); };
            savePokeyBois.SetValue += delegate(bool value) { savePokeyBoisMode = value; ShittySaveSystem.SetInt("savePokeyBoisMode", value ? 1 : 0); };
            //BoolViewController endlessDespair = pokeables.AddBool("Void of Despair");
            //endlessDespair.GetValue += delegate { return endlessDespairMode; };
            //endlessDespair.SetValue += delegate (bool value) { endlessDespairMode = value; ShittySaveSystem.SetInt("endlessDespairMode", value ? 1 : 0); };
        }
Ejemplo n.º 3
0
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            _maxResultsShownStagingValue = PluginConfig.MaxSearchResults;
            _stripSymbolsStagingValue    = PluginConfig.StripSymbols;
            _splitQueryStagingValue      = PluginConfig.SplitQueryByWords;
            _songFieldsStagingValue      = PluginConfig.SongFieldsToSearch;
            _compactModeStagingValue     = PluginConfig.CompactSearchMode;

            if (firstActivation)
            {
                var headerRectTransform = Instantiate(Resources.FindObjectsOfTypeAll <RectTransform>()
                                                      .First(x => x.name == "HeaderPanel" && x.parent.name == "PlayerSettingsViewController"), this.rectTransform);
                headerRectTransform.gameObject.SetActive(true);
                TextMeshProUGUI titleText = headerRectTransform.GetComponentInChildren <TextMeshProUGUI>();
                titleText.text = "Options";

                _submenu = new SubMenu(this.transform);

                // have to use the ListViewController because IntViewController doesn't seem to work outside of the settings menu
                float[] maxResultsShownValues =
                    Enumerable.Range(PluginConfig.MaxSearchResultsMinValue, PluginConfig.MaxSearchResultsMaxValue + 1)
                    .Select((x) => (float)x).ToArray();
                _maxResultsShownSetting = _submenu.AddList("Maximum # of Results Shown", maxResultsShownValues,
                                                           "The maximum number of songs found before a search result is shown.\n" +
                                                           "<color=#11FF11>A lower number is less distracting and only displays results when most irrelevant songs are removed.</color>\n" +
                                                           "<color=#FFFF11>You can force a search result to be shown using the button on the center screen.</color>");
                _maxResultsShownSetting.GetTextForValue += x => ((int)x).ToString();
                _maxResultsShownSetting.GetValue        += () => _maxResultsShownStagingValue;
                _maxResultsShownSetting.SetValue        += delegate(float value)
                {
                    _maxResultsShownStagingValue = (int)value;
                    _resetButton.interactable    = true;
                    _applyButton.interactable    = true;
                };
                SetSettingElementPosition(_maxResultsShownSetting.transform as RectTransform);
                _maxResultsShownSetting.Init();
                _maxResultsShownSetting.applyImmediately = true;        // applyImmediately is after Init(), otherwise it calls SetValue once

                _splitQuerySetting = _submenu.AddBool("Search Each Word Individually",
                                                      "Split up the search query into words and searches the song details for those words individually. " +
                                                      "A song will only appear in the results if it contains all the words typed.\n" +
                                                      "<color=#11FF11>'ON' - For when you know some words or names in the song details, but not the specific order.</color>\n" +
                                                      "<color=#11FF11>'OFF' - Useful if you want to search for a particular phrase.</color>");
                _splitQuerySetting.GetValue += () => _splitQueryStagingValue;
                _splitQuerySetting.SetValue += delegate(bool value)
                {
                    _splitQueryStagingValue   = value;
                    _resetButton.interactable = true;
                    _applyButton.interactable = true;
                };
                SetSettingElementPosition(_splitQuerySetting.transform as RectTransform);
                _splitQuerySetting.Init();
                _splitQuerySetting.applyImmediately = true;

                float[] songFieldsValues = new float[3]
                {
                    (float)SearchableSongFields.All, (float)SearchableSongFields.TitleAndAuthor, (float)SearchableSongFields.TitleOnly
                };
                _songFieldsSetting = _submenu.AddList("Song Fields to Search", songFieldsValues,
                                                      "A query will only search in these particular details of a song.\n" +
                                                      "<color=#11FF11>Can get relevant results quicker if you never search for song artist or beatmap creator.</color>\n" +
                                                      "Options - 'All', 'Title and Author', 'Title Only'");
                _songFieldsSetting.GetTextForValue += delegate(float value)
                {
                    switch (value)
                    {
                    case (float)SearchableSongFields.All:
                        return("All");

                    case (float)SearchableSongFields.TitleAndAuthor:
                        return("<size=80%>Title and Author</size>");

                    //case (float)SearchableSongFields.TitleOnly:
                    default:
                        return("Title Only");
                    }
                };
                _songFieldsSetting.GetValue += () => (float)_songFieldsStagingValue;
                _songFieldsSetting.SetValue += delegate(float value)
                {
                    _songFieldsStagingValue   = (SearchableSongFields)value;
                    _resetButton.interactable = true;
                    _applyButton.interactable = true;
                };
                SetSettingElementPosition(_songFieldsSetting.transform as RectTransform);
                _songFieldsSetting.Init();
                _songFieldsSetting.applyImmediately = true;

                _stripSymbolsSetting = _submenu.AddBool("Strip Symbols from Song Details",
                                                        "Removes symbols from song title, subtitle, artist, etc. fields when performing search.\n" +
                                                        "<color=#11FF11>Can be useful when searching for song remixes and titles with apostrophes, quotations, or hyphens.</color>");
                _stripSymbolsSetting.GetValue += () => _stripSymbolsStagingValue;
                _stripSymbolsSetting.SetValue += delegate(bool value)
                {
                    _stripSymbolsStagingValue = value;
                    _resetButton.interactable = true;
                    _applyButton.interactable = true;
                };
                SetSettingElementPosition(_stripSymbolsSetting.transform as RectTransform);
                _stripSymbolsSetting.Init();
                _stripSymbolsSetting.applyImmediately = true;

                _compactModeSetting = _submenu.AddBool("Use Compact Mode",
                                                       "Removes the keyboard on the right screen, replacing it with a smaller keyboard on the center screen.");
                _compactModeSetting.GetValue += () => _compactModeStagingValue;
                _compactModeSetting.SetValue += delegate(bool value)
                {
                    _compactModeStagingValue  = value;
                    _resetButton.interactable = true;
                    _applyButton.interactable = true;
                };
                SetSettingElementPosition(_compactModeSetting.transform as RectTransform);
                _compactModeSetting.Init();
                _compactModeSetting.applyImmediately = true;

                _defaultButton = BeatSaberUI.CreateUIButton(this.rectTransform, "CancelButton",
                                                            new Vector2(-37f, -32f), new Vector2(36f, 10f),
                                                            DefaultButtonPressed, "Use Defaults");
                _defaultButton.ToggleWordWrapping(false);
                _resetButton = BeatSaberUI.CreateUIButton(this.rectTransform, "CancelButton",
                                                          new Vector2(16f, -32f), new Vector2(24f, 9f),
                                                          ResetButtonPressed, "Reset");
                _resetButton.ToggleWordWrapping(false);
                _applyButton = BeatSaberUI.CreateUIButton(this.rectTransform, "CancelButton",
                                                          new Vector2(43f, -32f), new Vector2(24f, 9f),
                                                          ApplyButtonPressed, "Apply");
                _applyButton.ToggleWordWrapping(false);
            }
            else
            {
                // force show current value in config
                RefreshUI();
            }

            _resetButton.interactable = false;
            _applyButton.interactable = false;
        }
Ejemplo n.º 4
0
        public static void Settings()
        {
            SubMenu            befitSettings = SettingsUI.CreateSubMenu("BeFit Settings");
            BoolViewController pluginEnabled = befitSettings.AddBool("Plugin Enabled?");

            pluginEnabled.GetValue += delegate {
                return(Plugin.Instance.mainConfig.BeFitPluginEnabled);
            };
            pluginEnabled.SetValue += delegate(bool plug) {
                Plugin.Instance.mainConfig.BeFitPluginEnabled = plug;
            };
            IntViewController calCountAccuracy = befitSettings.AddInt("FPS Drop Reduction ", 1, 65, 1);

            calCountAccuracy.GetValue += delegate {
                return(Plugin.Instance.mainConfig.calorieCounterAccuracy);
            };
            calCountAccuracy.SetValue += delegate(int acc) {
                Plugin.Instance.mainConfig.calorieCounterAccuracy = acc;
            };

            BoolViewController viewInGame = befitSettings.AddBool("Show Calories In Game");

            viewInGame.GetValue += delegate {
                return(Plugin.Instance.mainConfig.inGameCaloriesDisplay);
            };
            viewInGame.SetValue += delegate(bool dcig) {
                Plugin.Instance.mainConfig.inGameCaloriesDisplay = dcig;
            };

            BoolViewController viewCurrent = befitSettings.AddBool("Show Current Session Calories");

            viewCurrent.GetValue += delegate {
                return(Plugin.Instance.mainConfig.sessionCaloriesDisplay);
            };
            viewCurrent.SetValue += delegate(bool csv) {
                Plugin.Instance.mainConfig.sessionCaloriesDisplay = csv;
                MenuDisplay.visibleCurrentCalories = csv;
            };

            BoolViewController viewDaily = befitSettings.AddBool("Show Daily Calories");

            viewDaily.GetValue += delegate {
                return(Plugin.Instance.mainConfig.dailyCaloriesDisplay);
            };
            viewDaily.SetValue += delegate(bool dcv) {
                Plugin.Instance.mainConfig.dailyCaloriesDisplay = dcv;
                MenuDisplay.visibleDailyCalories = dcv;
            };

            BoolViewController viewLife = befitSettings.AddBool("Show All Calories");

            viewLife.GetValue += delegate {
                return(Plugin.Instance.mainConfig.lifeCaloriesDisplay);
            };
            viewLife.SetValue += delegate(bool lcv) {
                Plugin.Instance.mainConfig.lifeCaloriesDisplay = lcv;
                MenuDisplay.visibleLifeCalories = lcv;
            };
            BoolViewController viewLast = befitSettings.AddBool("Show Last Song Calories");

            viewLast.GetValue += delegate {
                return(Plugin.Instance.mainConfig.lastGameCaloriesDisplay);
            };
            viewLast.SetValue += delegate(bool lgv) {
                Plugin.Instance.mainConfig.lastGameCaloriesDisplay = lgv;
                MenuDisplay.visibleLastGameCalories = lgv;
            };
        }
Ejemplo n.º 5
0
        public static void InitializeMenu()
        {
            InitializePresetList();

            MenuButtonUI.AddButton("Reload Chroma", OnReloadClick);
            MenuButtonUI.AddButton("Show Release Notes", "Shows the Release Notes and other info from the Beat Saber developers", delegate { SidePanelUtil.ResetPanel(); });
            MenuButtonUI.AddButton("Chroma Notes", "Shows the Release Notes and other info for Chroma", delegate { SidePanelUtil.SetPanel("chroma"); });
            MenuButtonUI.AddButton("Safety Waiver", "Shows the Chroma Safety Waiver", delegate { SidePanelUtil.SetPanel("chromaWaiver"); });

            /*
             * SETTINGS
             */
            SubMenu            ctSettings             = SettingsUI.CreateSubMenu("Chroma Settings");
            BoolViewController hideSubMenusController = ctSettings.AddBool("Hide CT Menus", "If true, hides all other Chroma menus.  This has a lot of options, I know.");

            hideSubMenusController.GetValue += delegate { return(ChromaConfig.HideSubMenus); };
            hideSubMenusController.SetValue += delegate(bool value) { ChromaConfig.HideSubMenus = value; };

            BoolViewController ctSettingsMapCheck = ctSettings.AddBool("Enabled Map Checking", "If false, Chroma and its extensions will not check for special maps.  Recommended to leave on.");

            ctSettingsMapCheck.GetValue += delegate { return(ChromaConfig.CustomMapCheckingEnabled); };
            ctSettingsMapCheck.SetValue += delegate(bool value) { ChromaConfig.CustomMapCheckingEnabled = value; };

            ListViewController ctSettingsMasterVolume = ctSettings.AddList("Chroma Sounds Volume", new float[] { 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f }, "Master volume control for sounds made by Chroma");

            ctSettingsMasterVolume.GetValue    += delegate { return(ChromaConfig.MasterVolume); };
            ctSettingsMasterVolume.SetValue    += delegate(float value) { ChromaConfig.MasterVolume = value; };
            ctSettingsMasterVolume.FormatValue += delegate(float value) { return(value * 100 + "%"); };

            BoolViewController ctSettingsDebugMode = ctSettings.AddBool("Debug Mode", "Very performance heavy - only do this if you are bug chasing.");

            ctSettingsDebugMode.GetValue += delegate { return(ChromaConfig.DebugMode); };
            ctSettingsDebugMode.SetValue += delegate(bool value) { ChromaConfig.DebugMode = value; };

            ListViewController ctLogSettings = ctSettings.AddList("Logging Level", new float[] { 0, 1, 2, 3 }, "The further to the left this is, the more will be logged.");

            ctLogSettings.applyImmediately = true;
            ctLogSettings.GetValue        += delegate { return((int)ChromaLogger.LogLevel); };
            ctLogSettings.SetValue        += delegate(float value) { ChromaLogger.LogLevel = (ChromaLogger.Level)(int) value; ChromaConfig.SetInt("Logger", "loggerLevel", (int)value); };
            ctLogSettings.FormatValue     += delegate(float value) { return(((ChromaLogger.Level)(int) value).ToString()); };

            StringViewController ctPassword = ctSettings.AddString("Secrets", "What could it mean?!?!");

            ctPassword.GetValue += delegate { return(""); };
            ctPassword.SetValue += delegate(string value) {
                if (value.ToUpper() == "SAFETYHAZARD")
                {
                    ChromaConfig.WaiverRead = true;
                    AudioUtil.Instance.PlayOneShotSound("NightmareMode.wav");
                }
                else if (value.ToUpper() == "CREDITS")
                {
                    AudioUtil.Instance.PlayOneShotSound("ConfigReload.wav");
                }
            };

            SettingsMenuCreatedEvent?.Invoke(ctSettings);

            ChromaLogger.Log("Sub-menus " + (ChromaConfig.HideSubMenus ? "are" : "are not") + " hidden.");

            /*
             * SUB-MENUS
             */
            if (!ChromaConfig.HideSubMenus)
            {
                float[] presets = new float[colourPresets.Count];
                for (int i = 0; i < colourPresets.Count; i++)
                {
                    presets[i] = i;
                }

                /*
                 * NOTES COLOURS
                 */
                SubMenu ctNotes = SettingsUI.CreateSubMenu("Chroma Notes");

                //A
                ListViewController ctAColour = ctNotes.AddList("Left Notes", presets);
                ctAColour.applyImmediately = true;
                ctAColour.GetValue        += delegate {
                    String name = ChromaConfig.GetString("Notes", "colourA", "DEFAULT");
                    for (int i = 0; i < colourPresets.Count; i++)
                    {
                        if (colourPresets[i].name == name)
                        {
                            return(i);
                        }
                    }
                    return(0);
                };
                ctAColour.SetValue += delegate(float value) {
                    ColourManager.A = colourPresets[(int)value].color;
                    ChromaConfig.SetString("Notes", "colourA", colourPresets[(int)value].name);
                };
                ctAColour.FormatValue += delegate(float value) {
                    return(colourPresets[(int)value].name);
                };

                //B
                ListViewController ctBColour = ctNotes.AddList("Right Notes", presets);
                ctBColour.applyImmediately = true;
                ctBColour.GetValue        += delegate {
                    String name = ChromaConfig.GetString("Notes", "colourB", "DEFAULT");
                    for (int i = 0; i < colourPresets.Count; i++)
                    {
                        if (colourPresets[i].name == name)
                        {
                            return(i);
                        }
                    }
                    return(0);
                };
                ctBColour.SetValue += delegate(float value) {
                    ColourManager.B = colourPresets[(int)value].color;
                    ChromaConfig.SetString("Notes", "colourB", colourPresets[(int)value].name);
                };
                ctBColour.FormatValue += delegate(float value) {
                    return(colourPresets[(int)value].name);
                };

                SettingsNoteMenuAddedEvent?.Invoke(ctNotes, presets, colourPresets);

                /*
                 * LIGHTS COLOURS
                 */
                SubMenu ctLights = SettingsUI.CreateSubMenu("Chroma Lights");

                ListViewController ctLightAmbientColour = ctLights.AddList("Ambient (bg) Lights", presets);
                ctLightAmbientColour.applyImmediately = true;
                ctLightAmbientColour.GetValue        += delegate {
                    String name = ChromaConfig.GetString("Lights", "lightAmbient", "DEFAULT");
                    for (int i = 0; i < colourPresets.Count; i++)
                    {
                        if (colourPresets[i].name == name)
                        {
                            return(i);
                        }
                    }
                    return(0);
                };
                ctLightAmbientColour.SetValue += delegate(float value) {
                    ColourManager.LightAmbient = colourPresets[(int)value].color;
                    ChromaConfig.SetString("Lights", "lightAmbient", colourPresets[(int)value].name);
                    ColourManager.RecolourAmbientLights(ColourManager.LightAmbient);
                };
                ctLightAmbientColour.FormatValue += delegate(float value) {
                    return(colourPresets[(int)value].name);
                };

                //LightA
                ListViewController ctLightAColour = ctLights.AddList("Warm (red) Lights", presets);
                ctLightAColour.applyImmediately = true;
                ctLightAColour.GetValue        += delegate {
                    String name = ChromaConfig.GetString("Lights", "lightColourA", "DEFAULT");
                    for (int i = 0; i < colourPresets.Count; i++)
                    {
                        if (colourPresets[i].name == name)
                        {
                            return(i);
                        }
                    }
                    return(0);
                };
                ctLightAColour.SetValue += delegate(float value) {
                    ColourManager.LightA = colourPresets[(int)value].color;
                    ChromaConfig.SetString("Lights", "lightColourA", colourPresets[(int)value].name);
                };
                ctLightAColour.FormatValue += delegate(float value) {
                    return(colourPresets[(int)value].name);
                };

                //LightB
                ListViewController ctLightBColour = ctLights.AddList("Cold (blue) Lights", presets);
                ctLightBColour.applyImmediately = true;
                ctLightBColour.GetValue        += delegate {
                    String name = ChromaConfig.GetString("Lights", "lightColourB", "DEFAULT");
                    for (int i = 0; i < colourPresets.Count; i++)
                    {
                        if (colourPresets[i].name == name)
                        {
                            return(i);
                        }
                    }
                    return(0);
                };
                ctLightBColour.SetValue += delegate(float value) {
                    ColourManager.LightB = colourPresets[(int)value].color;
                    ChromaConfig.SetString("Lights", "lightColourB", colourPresets[(int)value].name);
                };
                ctLightBColour.FormatValue += delegate(float value) {
                    return(colourPresets[(int)value].name);
                };

                SettingsLightsMenuAddedEvent?.Invoke(ctLights, presets, colourPresets);

                /*
                 * OTHERS COLOURS
                 */
                SubMenu ctOthers = SettingsUI.CreateSubMenu("Chroma Aesthetics");

                //Barriers
                ListViewController ctBarrier = ctOthers.AddList("Barriers", presets);
                ctBarrier.applyImmediately = true;
                ctBarrier.GetValue        += delegate {
                    String name = ChromaConfig.GetString("Aesthetics", "barrierColour", "Barrier Red");
                    for (int i = 0; i < colourPresets.Count; i++)
                    {
                        if (colourPresets[i].name == name)
                        {
                            return(i);
                        }
                    }
                    return(0);
                };
                ctBarrier.SetValue += delegate(float value) {
                    ColourManager.BarrierColour = colourPresets[(int)value].color;
                    ChromaConfig.SetString("Aesthetics", "barrierColour", colourPresets[(int)value].name);
                };
                ctBarrier.FormatValue += delegate(float value) {
                    return(colourPresets[(int)value].name);
                };

                //BarrierCorrection
                ListViewController ctBarrierCorrection = ctOthers.AddList("Barrier Col. Correction", new float[] { 0, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2f });
                ctBarrierCorrection.GetValue += delegate {
                    return(ColourManager.barrierColourCorrectionScale);
                };
                ctBarrierCorrection.SetValue += delegate(float value) {
                    ColourManager.barrierColourCorrectionScale = value;
                    ChromaConfig.SetFloat("Aesthetics", "barrierColourCorrectionScale", value);
                };
                ctBarrierCorrection.FormatValue += delegate(float value) { return(value * 100 + "%"); };

                //SignB
                ListViewController ctSignB = ctOthers.AddList("Neon Sign Top", presets);
                ctSignB.applyImmediately = true;
                ctSignB.GetValue        += delegate {
                    String name = ChromaConfig.GetString("Aesthetics", "signColourB", "Notes Blue");
                    for (int i = 0; i < colourPresets.Count; i++)
                    {
                        if (colourPresets[i].name == name)
                        {
                            return(i);
                        }
                    }
                    return(0);
                };
                ctSignB.SetValue += delegate(float value) {
                    ColourManager.SignB = colourPresets[(int)value].color;
                    ChromaConfig.SetString("Aesthetics", "signColourB", colourPresets[(int)value].name);
                    ColourManager.RecolourNeonSign(ColourManager.SignA, ColourManager.SignB);
                };
                ctSignB.FormatValue += delegate(float value) {
                    return(colourPresets[(int)value].name);
                };

                //SignA
                ListViewController ctSignA = ctOthers.AddList("Neon Sign Bottom", presets);
                ctSignA.applyImmediately = true;
                ctSignA.GetValue        += delegate {
                    String name = ChromaConfig.GetString("Aesthetics", "signColourA", "Notes Red");
                    for (int i = 0; i < colourPresets.Count; i++)
                    {
                        if (colourPresets[i].name == name)
                        {
                            return(i);
                        }
                    }
                    return(0);
                };
                ctSignA.SetValue += delegate(float value) {
                    ColourManager.SignA = colourPresets[(int)value].color;
                    ChromaConfig.SetString("Aesthetics", "signColourA", colourPresets[(int)value].name);
                    ColourManager.RecolourNeonSign(ColourManager.SignA, ColourManager.SignB);
                };
                ctSignA.FormatValue += delegate(float value) {
                    return(colourPresets[(int)value].name);
                };

                //LaserPointer
                ListViewController ctLaserColour = ctOthers.AddList("Laser Pointer", presets);
                ctLaserColour.applyImmediately = true;
                ctLaserColour.GetValue        += delegate {
                    String name = ChromaConfig.GetString("Aesthetics", "laserPointerColour", "Notes Blue");
                    for (int i = 0; i < colourPresets.Count; i++)
                    {
                        if (colourPresets[i].name == name)
                        {
                            return(i);
                        }
                    }
                    return(0);
                };
                ctLaserColour.SetValue += delegate(float value) {
                    ColourManager.LaserPointerColour = colourPresets[(int)value].color;
                    ChromaConfig.SetString("Aesthetics", "laserPointerColour", colourPresets[(int)value].name);
                    //ColourManager.RecolourLaserPointer(ColourManager.LaserPointerColour);
                    ColourManager.RecolourMenuStuff(ColourManager.A, ColourManager.B, ColourManager.LightA, ColourManager.LightB, ColourManager.Platform, ColourManager.LaserPointerColour);
                };
                ctLaserColour.FormatValue += delegate(float value) {
                    return(colourPresets[(int)value].name);
                };

                ListViewController ctPlatform = ctOthers.AddList("Platform Accoutrements", presets);
                ctPlatform.applyImmediately = true;
                ctPlatform.GetValue        += delegate {
                    String name = ChromaConfig.GetString("Aesthetics", "platformAccoutrements", "DEFAULT");
                    for (int i = 0; i < colourPresets.Count; i++)
                    {
                        if (colourPresets[i].name == name)
                        {
                            return(i);
                        }
                    }
                    return(0);
                };
                ctPlatform.SetValue += delegate(float value) {
                    ColourManager.Platform = colourPresets[(int)value].color;
                    ChromaConfig.SetString("Aesthetics", "platformAccoutrements", colourPresets[(int)value].name);
                    ColourManager.RecolourMenuStuff(ColourManager.A, ColourManager.B, ColourManager.LightA, ColourManager.LightB, ColourManager.Platform, ColourManager.LaserPointerColour);
                };
                ctPlatform.FormatValue += delegate(float value) {
                    return(colourPresets[(int)value].name);
                };

                SettingsOthersMenuAddedEvent?.Invoke(ctOthers, presets, colourPresets);

                ExtensionSubMenusEvent?.Invoke(presets, colourPresets);
            }

            GameplaySettingsUISetup();
        }
Ejemplo n.º 6
0
        private static void SetupChromaSparksMenu(float[] presets, List <NamedColor> colourPresets)
        {
            /*
             * PARTICLES
             */
            SubMenu ctParticles = SettingsUI.CreateSubMenu("Chroma Sparks");

            float[] particleMults = new float[] { 0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2f,
                                                  2.25f, 2.5f, 2.75f, 3f, 3.25f, 3.5f, 3.75f, 4f, 4.25f, 4.5f, 4.75f, 5f,
                                                  5.5f, 6f, 6.5f, 7f, 7.5f, 8f, 8.5f, 9f, 9.5f, 10f,
                                                  11f, 12f, 13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f,
                                                  22.5f, 25f, 27.5f, 30f, 32.5f, 35f, 37.5f, 40f, 42.5f, 45f, 47.5f, 50f,
                                                  55f, 60f, 65f, 70f, 75f, 80f, 85f, 90f, 100f,
                                                  110f, 120f, 130f, 140f, 150f, 160f, 170f, 180f, 190f, 200f };

            //Completely disable particle affecting
            BoolViewController ctParticlesEnabled = ctParticles.AddBool("Override Particles");

            ctParticlesEnabled.GetValue += delegate { return(ChromaSparksConfig.ParticleManipulationEnabled); };
            ctParticlesEnabled.SetValue += delegate(bool value) { ChromaSparksConfig.ParticleManipulationEnabled = value; };

            //global Particles Mult
            ListViewController ctParticlesMax = ctParticles.AddList("Global Particle Max", particleMults);

            ctParticlesMax.GetValue    += delegate { return(ChromaSparksConfig.ParticlesGlobalMaxMult); };
            ctParticlesMax.SetValue    += delegate(float value) { ChromaSparksConfig.ParticlesGlobalMaxMult = value; };
            ctParticlesMax.FormatValue += delegate(float value) { return(value * 100 + "%"); };

            //slash Particles Mult
            ListViewController ctSlashAmt = ctParticles.AddList("Slash Part. Amount", particleMults);

            ctSlashAmt.GetValue    += delegate { return(ChromaSparksConfig.SlashParticlesMult); };
            ctSlashAmt.SetValue    += delegate(float value) { ChromaSparksConfig.SlashParticlesMult = value; };
            ctSlashAmt.FormatValue += delegate(float value) { return(value * 100 + "%"); };

            /*//slash Particles Life
             * ListViewController ctSlashLife = ctParticles.AddList("Slash Part. Lifetime", particleMults);
             * ctSlashLife.GetValue += delegate { return Plugin.slashParticlesLifeMult; };
             * ctSlashLife.SetValue += delegate (float value) { Plugin.slashParticlesLifeMult = value; Plugin.didChangeSettings = true; };
             * ctSlashLife.FormatValue += delegate (float value) { return value * 100 + "%"; };*/

            //slash Particles Life
            ListViewController ctSlashSpeed = ctParticles.AddList("Slash Part. Speed", particleMults);

            ctSlashSpeed.GetValue    += delegate { return(ChromaSparksConfig.SlashParticlesSpeedMult); };
            ctSlashSpeed.SetValue    += delegate(float value) { ChromaSparksConfig.SlashParticlesSpeedMult = value; };
            ctSlashSpeed.FormatValue += delegate(float value) { return(value * 100 + "%"); };

            ListViewController ctSlashTimeScale = ctParticles.AddList("Slash Part. TimeScale", particleMults);

            ctSlashTimeScale.GetValue    += delegate { return(ChromaSparksConfig.SlashParticlesTimeScale); };
            ctSlashTimeScale.SetValue    += delegate(float value) { ChromaSparksConfig.SlashParticlesTimeScale = value; };
            ctSlashTimeScale.FormatValue += delegate(float value) {
                if (value == 1)
                {
                    return("Unchanged");
                }
                return(value + "/s");
            };


            //explosions Particles Mult
            ListViewController ctExplosionsAmt = ctParticles.AddList("Explosion Part. Amount", particleMults);

            ctExplosionsAmt.GetValue    += delegate { return(ChromaSparksConfig.ExplosionParticlesMult); };
            ctExplosionsAmt.SetValue    += delegate(float value) { ChromaSparksConfig.ExplosionParticlesMult = value; };
            ctExplosionsAmt.FormatValue += delegate(float value) { return(value * 100 + "%"); };

            /*//explosions Particles Life
             * ListViewController ctExplosionsLife = ctParticles.AddList("Explosion Part. Lifetime", particleMults);
             * ctExplosionsLife.GetValue += delegate { return Plugin.explosionParticlesLifeMult; };
             * ctExplosionsLife.SetValue += delegate (float value) { Plugin.explosionParticlesLifeMult = value; Plugin.didChangeSettings = true; };
             * ctExplosionsLife.FormatValue += delegate (float value) { return value * 100 + "%"; };*/

            //explosions Particles Life
            ListViewController ctExplosionsSpeed = ctParticles.AddList("Explosion Part. Speed", particleMults);

            ctExplosionsSpeed.GetValue    += delegate { return(ChromaSparksConfig.ExplosionParticlesSpeedMult); };
            ctExplosionsSpeed.SetValue    += delegate(float value) { ChromaSparksConfig.ExplosionParticlesSpeedMult = value; };
            ctExplosionsSpeed.FormatValue += delegate(float value) { return(value * 100 + "%"); };

            ListViewController ctExplosionsTimeScale = ctParticles.AddList("Explosion Part. TimeScale", particleMults);

            ctExplosionsTimeScale.GetValue    += delegate { return(ChromaSparksConfig.ExplosionParticlesTimeScale); };
            ctExplosionsTimeScale.SetValue    += delegate(float value) { ChromaSparksConfig.ExplosionParticlesTimeScale = value; };
            ctExplosionsTimeScale.FormatValue += delegate(float value) {
                if (value == 1)
                {
                    return("Unchanged");
                }
                return(value + "/s");
            };
        }
        public void Init()
        {
            if (_isInitialized)
            {
                return;
            }

            // we're using SongDataCore's ScoreSaber data storage to find out the star rating
            if (!Tweaks.SongDataCoreTweaks.ModLoaded)
            {
                Controls = new FilterControl[1];

                var noModMessage = BeatSaberUI.CreateText(null, "<color=#FFAAAA>Sorry!\n\n<size=80%>This filter requires the SongDataCore mod to be\n installed.</size></color>", Vector2.zero);
                noModMessage.alignment = TextAlignmentOptions.Center;
                noModMessage.fontSize  = 5.5f;

                Controls[0] = new FilterControl(noModMessage.gameObject, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(80f, 50f), new Vector2(0f, 10f));

                _isInitialized = true;
                return;
            }

            var togglePrefab = Utilities.GetTogglePrefab();

            // title text
            var text = BeatSaberUI.CreateText(null, "Keep Songs Between Some Star Rating", Vector2.zero, Vector2.zero);

            text.fontSize = 5.5f;
            var rt = text.rectTransform;

            rt.anchorMin = new Vector2(0f, 1f);
            rt.anchorMax = new Vector2(0f, 1f);
            rt.pivot     = new Vector2(0f, 1f);

            Controls[0] = new FilterControl(text.gameObject, new Vector2(0f, 0.95f), new Vector2(0f, 0.95f), new Vector2(0f, 1f), new Vector2(50f, 6f), Vector2.zero);

            // min view controller
            float[] values = Enumerable.Range((int)MinValue, (int)((MaxValue - MinValue) / IncrementValue) + 1).Select(x => x * IncrementValue).ToArray();
            _minViewController = Utilities.CreateListViewController("Minimum Star Rating", values, "Filters out songs that have a lesser star difficulty rating than this value");
            _minViewController.GetTextForValue += x => x.ToString("0.00");
            _minViewController.GetValue        += () => _minStagingValue;
            _minViewController.SetValue        += delegate(float value)
            {
                if (_maxEnabledStagingValue && value > _maxStagingValue)
                {
                    _minStagingValue = _maxStagingValue;
                    RefreshUI();
                    return;
                }

                _minStagingValue = value;

                RefreshUI(false);

                SettingChanged?.Invoke();
            };
            _minViewController.Init();
            _minViewController.applyImmediately = true;

            var minToggle = Utilities.CreateToggleFromPrefab(togglePrefab.toggle, _minViewController.transform.Find("Value"));

            minToggle.name = "MinValueToggle";
            minToggle.onValueChanged.AddListener(delegate(bool value)
            {
                _minEnabledStagingValue = value;

                if (value && _maxEnabledStagingValue && _minStagingValue > _maxStagingValue)
                {
                    _minStagingValue = _maxStagingValue;
                }

                RefreshUI(true, true);

                SettingChanged?.Invoke();
            });

            Utilities.MoveListViewControllerElements(_minViewController);
            Utilities.CreateHorizontalDivider(_minViewController.transform);

            Controls[1] = new FilterControl(_minViewController.gameObject, new Vector2(0f, 0.95f), new Vector2(1f, 0.95f), new Vector2(0.5f, 1f), new Vector2(0f, 12f), new Vector2(0f, -8f),
                                            delegate()
            {
                // disabling buttons needs to be done after the view controller is enabled to override the interactable assignments of ListSettingsController:OnEnable()
                _minViewController.GetComponentsInChildren <Button>().First(x => x.name == "DecButton").interactable = _minEnabledStagingValue && _minStagingValue > MinValue;
                _maxViewController.GetComponentsInChildren <Button>().First(x => x.name == "IncButton").interactable = _minEnabledStagingValue && (!_maxEnabledStagingValue || _minStagingValue < _maxStagingValue) && _minStagingValue < MaxValue;
            });

            // max view controller
            _maxViewController = Utilities.CreateListViewController("Maximum Star Rating", values, "Filters out songs that have a greater star difficulty rating than this value");
            _maxViewController.GetTextForValue += x => x.ToString("0.00");
            _maxViewController.GetValue        += () => _maxStagingValue;
            _maxViewController.SetValue        += delegate(float value)
            {
                if (_minEnabledStagingValue && value < _minStagingValue)
                {
                    _maxStagingValue = _minStagingValue;
                    RefreshUI();
                    return;
                }

                _maxStagingValue = value;

                RefreshUI(false);

                SettingChanged?.Invoke();
            };
            _maxViewController.Init();
            _maxViewController.applyImmediately = true;

            var maxToggle = Utilities.CreateToggleFromPrefab(togglePrefab.toggle, _maxViewController.transform.Find("Value"));

            maxToggle.name = "MaxValueToggle";
            maxToggle.onValueChanged.AddListener(delegate(bool value)
            {
                _maxEnabledStagingValue = value;

                if (value && _minEnabledStagingValue && _maxStagingValue < _minStagingValue)
                {
                    _maxStagingValue = _minStagingValue;
                }

                RefreshUI(true, true);

                SettingChanged?.Invoke();
            });

            Utilities.MoveListViewControllerElements(_maxViewController);
            Utilities.CreateHorizontalDivider(_maxViewController.transform);

            Controls[2] = new FilterControl(_maxViewController.gameObject, new Vector2(0f, 0.95f), new Vector2(1f, 0.95f), new Vector2(0.5f, 1f), new Vector2(0f, 12f), new Vector2(0f, -20f),
                                            delegate()
            {
                // disabling buttons needs to be done after the view controller is enabled to override the interactable assignments of ListSettingsController:OnEnable()
                _maxViewController.GetComponentsInChildren <Button>().First(x => x.name == "DecButton").interactable = _maxEnabledStagingValue && (!_minEnabledStagingValue || _maxStagingValue > _minStagingValue) && _maxStagingValue > MinValue;
                _maxViewController.GetComponentsInChildren <Button>().First(x => x.name == "IncButton").interactable = _maxEnabledStagingValue && _maxStagingValue < MaxValue;
            });

            // include unrated songs toggle
            _includeUnratedViewController           = Utilities.CreateBoolViewController("Include Unrated Songs", "Do not filter out songs that do not have a star rating provided by ScoreSaber");
            _includeUnratedViewController.GetValue += () => _includeUnratedStagingValue;
            _includeUnratedViewController.SetValue += delegate(bool value)
            {
                _includeUnratedStagingValue = value;

                SettingChanged?.Invoke();
            };
            _includeUnratedViewController.Init();
            _includeUnratedViewController.applyImmediately = true;

            Utilities.MoveIncDecViewControllerElements(_includeUnratedViewController);

            Controls[3] = new FilterControl(_includeUnratedViewController.gameObject, new Vector2(0f, 0.95f), new Vector2(1f, 0.95f), new Vector2(0.5f, 1f), new Vector2(0f, 12f), new Vector2(0f, -32f));

            Object.Destroy(togglePrefab);

            _isInitialized = true;
        }
Ejemplo n.º 8
0
        public void Init()
        {
            if (_isInitialized)
            {
                return;
            }

            // title text
            var text = BeatSaberUI.CreateText(null, "Other Filters", Vector2.zero, Vector2.zero);

            text.fontSize = 5.5f;
            var rt = text.rectTransform;

            rt.anchorMin = new Vector2(0f, 1f);
            rt.anchorMax = rt.anchorMin;
            rt.pivot     = rt.anchorMin;

            Controls[0] = new FilterControl(text.gameObject, new Vector2(0f, 0.95f), new Vector2(0f, 0.95f), new Vector2(0f, 1f), new Vector2(50f, 6f), Vector2.zero);

            // one saber view controller
            _oneSaberViewController           = Utilities.CreateBoolViewController("Has One Saber Mode", "Filters out songs that don't have at least one saber map");
            _oneSaberViewController.GetValue += () => _oneSaberStagingValue;
            _oneSaberViewController.SetValue += delegate(bool value)
            {
                _oneSaberStagingValue = value;
                SettingChanged?.Invoke();
            };
            _oneSaberViewController.Init();
            _oneSaberViewController.applyImmediately = true;

            Utilities.CreateHorizontalDivider(_oneSaberViewController.transform);
            Utilities.MoveIncDecViewControllerElements(_oneSaberViewController);

            Controls[1] = new FilterControl(_oneSaberViewController.gameObject, new Vector2(0f, 0.95f), new Vector2(1f, 0.95f), new Vector2(0.5f, 1f), new Vector2(0f, 12f), new Vector2(0f, -8f));

            // lightshow view controller
            _lightshowViewController           = Utilities.CreateBoolViewController("Has Lightshow Mode", "Filters out songs that don't have a lightshow map");
            _lightshowViewController.GetValue += () => _lightshowStagingValue;
            _lightshowViewController.SetValue += delegate(bool value)
            {
                _lightshowStagingValue = value;
                SettingChanged?.Invoke();
            };
            _lightshowViewController.Init();
            _lightshowViewController.applyImmediately = true;

            Utilities.CreateHorizontalDivider(_lightshowViewController.transform);
            Utilities.MoveIncDecViewControllerElements(_lightshowViewController);

            Controls[2] = new FilterControl(_lightshowViewController.gameObject, new Vector2(0f, 0.95f), new Vector2(1f, 0.95f), new Vector2(0.5f, 1f), new Vector2(0f, 12f), new Vector2(0f, -20f));

            // mapping extensions view controller
            var values = Enumerable.Range(0, 3).Select(x => (float)x).ToArray();

            _mappingExtensionsViewController = Utilities.CreateListViewController("Requires Mapping Extensions", values, "Filters out songs that don't require the 'Mapping Extensions' mod");
            _mappingExtensionsViewController.GetTextForValue += delegate(float value)
            {
                if (value == (float)SongRequirement.Required)
                {
                    return("<size=90%>Required</size>");
                }
                else if (value == (float)SongRequirement.NotRequired)
                {
                    return("<size=70%>Not Required</size>");
                }
                else
                {
                    return("OFF");
                }
            };
            _mappingExtensionsViewController.GetValue += () => (float)_mappingExtensionsStagingValue;
            _mappingExtensionsViewController.SetValue += delegate(float value)
            {
                _mappingExtensionsStagingValue = (SongRequirement)value;
                SettingChanged?.Invoke();
            };
            _mappingExtensionsViewController.Init();
            _mappingExtensionsViewController.applyImmediately = true;

            Utilities.MoveIncDecViewControllerElements(_mappingExtensionsViewController);

            Controls[3] = new FilterControl(_mappingExtensionsViewController.gameObject, new Vector2(0f, 0.95f), new Vector2(1f, 0.95f), new Vector2(0.5f, 1f), new Vector2(0f, 12f), new Vector2(0f, -32f));

            _isInitialized = true;
        }
        public static void CreateSettingsUI()
        {
            var subMenu = SettingsUI.CreateSubMenu("Particle Overdrive");

            BoolViewController noiseEnabled = subMenu.AddBool("Camera Noise");

            noiseEnabled.GetValue += (() => Plugin._noiseController.Enabled);
            noiseEnabled.SetValue += delegate(bool value)
            {
                Plugin._noiseController.Enabled = value;
                ModPrefs.SetBool(Plugin.ModPrefsKey, "cameraNoise", value);
            };

            BoolViewController dustEnabled = subMenu.AddBool("Global Dust Particles");

            dustEnabled.GetValue += (() => Plugin._particleController.Enabled);
            dustEnabled.SetValue += delegate(bool value)
            {
                Plugin._particleController.Enabled = value;
                ModPrefs.SetBool(Plugin.ModPrefsKey, "dustParticles", value);
            };

            float[] values = new float[]
            {
                0f,
                //0.1f,
                //0.2f,
                //0.3f,
                //0.4f,
                //0.5f,
                //0.6f,
                //0.7f,
                //0.8f,
                //0.9f,
                1f,
                1.1f,
                1.2f,
                1.3f,
                1.4f,
                1.5f,
                1.6f,
                1.7f,
                1.8f,
                1.9f,
                2f,
                2.25f,
                2.5f,
                2.75f,
                3f,
                3.25f,
                3.5f,
                3.75f,
                4f,
                4.25f,
                4.5f,
                4.75f,
                5f,
                5.5f,
                6f,
                6.5f,
                7f,
                7.5f,
                8f,
                8.5f,
                9f,
                9.5f,
                10f,
                11f,
                12f,
                13f,
                14f,
                15f,
                16f,
                17f,
                18f,
                19f,
                20f,
                22.5f,
                25f,
                27.5f,
                30f,
                32.5f,
                35f,
                37.5f,
                40f,
                42.5f,
                45f,
                47.5f,
                50f,
                55f,
                60f,
                65f,
                70f,
                75f,
                80f,
                85f,
                90f,
                100f,
                110f,
                120f,
                130f,
                140f,
                150f,
                160f,
                170f,
                180f,
                190f,
                200f
            };

            ListViewController slashParticleCount = subMenu.AddList("Slash Particles", values);

            slashParticleCount.FormatValue += ((float value) => $"{value * 100f}%");
            slashParticleCount.GetValue    += (() => Plugin.SlashParticleMultiplier);
            slashParticleCount.SetValue    += delegate(float value)
            {
                Plugin.SlashParticleMultiplier = value;
                ModPrefs.SetFloat(Plugin.ModPrefsKey, "slashParticleMultiplier", value);
            };

            ListViewController exploParticleCount = subMenu.AddList("Explosion Particles", values);

            exploParticleCount.FormatValue += ((float value) => $"{value * 100f}%");
            exploParticleCount.GetValue    += (() => Plugin.ExplosionParticleMultiplier);
            exploParticleCount.SetValue    += delegate(float value)
            {
                Plugin.ExplosionParticleMultiplier = value;
                ModPrefs.SetFloat(Plugin.ModPrefsKey, "explosionParticleMultiplier", value);
            };
        }
Ejemplo n.º 10
0
        internal static void CreateMenu()
        {
            SubMenu            GeneralMenu       = SettingsUI.CreateSubMenu("Random Sabers");
            int                folderPathLength  = Plugin.SabersFolderPath.Length;
            BoolViewController enabledController = GeneralMenu.AddBool("Enable Random Sabers", "Random sabers on song startup. ");

            enabledController.GetValue += () => { return(PlayerPrefs.GetInt(PrefsModSection + PrefsModEnabled) == 1); };
            enabledController.SetValue += (val) => { PlayerPrefs.SetInt(PrefsModSection + PrefsModEnabled, val ? 1 : 0); if (!val)
                                                     {
                                                         CustomSaber.Plugin.LoadNewSaber(SelectedSaberOnStartup);
                                                     }
            };
            BoolViewController displaySelectedSaberController = GeneralMenu.AddBool("Display Selected Saber", "Displays the selected Saber's name when starting the song.");

            displaySelectedSaberController.GetValue += () => { return(PlayerPrefs.GetInt(PrefsModSection + PrefsDisplaySelectedSaberEnabled) == 1); };
            displaySelectedSaberController.SetValue += (val) => { PlayerPrefs.SetInt(PrefsModSection + PrefsDisplaySelectedSaberEnabled, val ? 1 : 0); };
            BoolViewController listsEnabledController = GeneralMenu.AddBool("Enable Saber Menus", "Enables secondary menus to add or remove sabers from the selection pool. Settings are saved even if the menus are turned off. ");

            listsEnabledController.GetValue += () => { return(PlayerPrefs.GetInt(PrefsModSection + PrefsModListsEnabled) == 1); };
            listsEnabledController.SetValue += (val) => { PlayerPrefs.SetInt(PrefsModSection + PrefsModListsEnabled, val ? 1 : 0); };
            SetAllController SetAllController = GeneralMenu.AddIntSetting <SetAllController>("Set All Sabers To ", "Turn all sabers on, off, or do nothing.");

            SetAllController.SetValues(0, 2, 1);
            SetAllController.GetValue += () => { return(0); };
            SetAllController.SetValue += (val) => {
                setAllValue = val;
                if (1 == val)
                {
                    for (int i = 0; i < Plugin.SaberCount; i++)
                    {
                        PlayerPrefs.SetInt(PrefsEnabledSabersSection + Plugin.GetSaberName(i), 1);
                        isSaberEnabled[Plugin.GetSaberName(i)] = true;
                    }
                }
                else if (2 == val)
                {
                    for (int i = 0; i < Plugin.SaberCount; i++)
                    {
                        PlayerPrefs.SetInt(PrefsEnabledSabersSection + Plugin.GetSaberName(i), 0);
                        isSaberEnabled[Plugin.GetSaberName(i)] = false;
                    }
                }
            };
            //Add option lists in groups of SabersPerMenu.
            if (1 == PlayerPrefs.GetInt(PrefsModSection + PrefsModListsEnabled))
            {
                int sabersCount = Plugin.SaberCount;
                //Console.WriteLine("------------------------------------Random Sabers Menu Setup-----------------------------------");
                int MenuCount = Mathf.CeilToInt((float)sabersCount / SabersPerMenu);
                //Console.WriteLine(sabersCount + " Sabers, " + MenuCount + " Menus. ");
                for (int i = 0; i < MenuCount; i++)
                {
                    int    startingSaberIndex = i * SabersPerMenu;
                    string menuName           = "Random Sabers (";
                    if (0 != i)
                    {
                        string StartSaberName    = Plugin.GetSaberName(startingSaberIndex);
                        string previousSabername = Plugin.GetSaberName(startingSaberIndex - 1);
                        string firstLetter       = StartSaberName.Substring(0, 1).ToUpper();
                        menuName += firstLetter;
                        if (previousSabername.Substring(0, 1).ToUpper() == firstLetter)
                        {
                            menuName += StartSaberName.Substring(1, 1).ToUpper();
                        }
                    }
                    else
                    {
                        menuName += Plugin.GetSaberName(startingSaberIndex).Substring(0, 1).ToUpper();
                    }
                    menuName += " - ";
                    menuName += Plugin.GetSaberName(Mathf.Min(sabersCount - 1, (i + 1) * SabersPerMenu)).Substring(0, 1).ToUpper();
                    menuName += ")";
                    //Console.WriteLine("Added Menu: " + menuName);
                    SubMenu subMenu = SettingsUI.CreateSubMenu(menuName);
                    for (int j = 0; j < SabersPerMenu && startingSaberIndex + j < sabersCount; j++)
                    {
                        string             saberName  = Plugin.GetSaberName(startingSaberIndex + j);
                        BoolViewController controller = subMenu.AddBool(saberName, "Add or remove " + saberName + " from the random sabers options. ");
                        controller.GetValue += () => {
                            if (1 == setAllValue)
                            {
                                return(true);
                            }
                            else if (2 == setAllValue)
                            {
                                return(false);
                            }
                            else
                            {
                                return(isSaberEnabled[saberName]);
                            }
                        };
                        controller.SetValue += (val) =>
                        {
                            isSaberEnabled[saberName] = val;
                            PlayerPrefs.SetInt(PrefsEnabledSabersSection + saberName, val ? 1 : 0);
                            //controller.ApplySettings();
                            Console.WriteLine("Set " + saberName + " to " + PlayerPrefs.GetInt(PrefsEnabledSabersSection + saberName));
                        };
                    }
                }
                //Console.WriteLine("------------------------------------Random Sabers Menu Setup-----------------------------------");
            }
        }