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."); autoCheck.applyImmediately = true; autoCheck.GetValue += () => SelfConfig.SelfConfigRef.Value.Updates.AutoCheckUpdates; autoCheck.SetValue += val => { SelfConfig.SelfConfigRef.Value.Updates.AutoCheckUpdates = val; SelfConfig.LoaderConfig.Store(SelfConfig.SelfConfigRef.Value); }; autoUpdate.applyImmediately = true; autoUpdate.GetValue += () => SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate; autoUpdate.SetValue += val => { SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate = val; SelfConfig.LoaderConfig.Store(SelfConfig.SelfConfigRef.Value); }; return(menu.viewController); }
public static void InitUI() { SubMenu menu = SettingsUI.CreateSubMenu("Beat Saber Console"); var lines = menu.AddInt("Line Count", "How many lines the Console will display.", 15, 50, 5); lines.GetValue += delegate { return(Config.lines); }; lines.SetValue += v => Config.lines = v; float[] timeOptions = new float[] { 0.1f, 0.25f, 0.5f, 0.75f, 1, 1.5f, 2, 3, 4, 5 }; var time = menu.AddList("Console Update Time", timeOptions, "The amount of time between Console updates in seconds."); time.GetValue += delegate { return(Config.updateTime); }; time.SetValue += v => Config.updateTime = v; time.FormatValue += delegate(float c) { return($"{c} Sec."); }; var cubes = menu.AddBool("Show Move Bars", "Show the bars that appear under the console.\n<color=#FF0000>Moving the console and output log by clicking under them will still work.</color>"); cubes.GetValue += delegate { return(Config.showMoveCubes); }; cubes.SetValue += v => Config.showMoveCubes = v; var clipboard = menu.AddBool("Copy Last Exception", "Automatically copies the Console's last logged Exception to your clipboard for easy pasting.\n<color=#FF0000>This will overwrite any previous clipboard entries.</color>"); clipboard.GetValue += delegate { return(Config.copyToClipboard); }; clipboard.SetValue += v => Config.copyToClipboard = v; var common = menu.AddBool("Hide Common Errors", "Hide common errors from appearing in the Output Log."); common.GetValue += delegate { return(Config.hideCommonErrors); }; common.SetValue += v => Config.hideCommonErrors = v; var showStacktrace = menu.AddBool("Show Stacktrace", "Shows stacktrace in Output Log."); showStacktrace.GetValue += delegate { return(Config.showStacktrace); }; showStacktrace.SetValue += v => Config.showStacktrace = v; var reset = menu.AddBool("Reset Positions?", "When set to true, the Console and Output log will reset to above the player."); reset.GetValue += delegate { return(false); }; reset.SetValue += v => { if (v) { Config.consolePos = new Vector3(1, 2.5f, 0); Config.consoleRot = new Vector3(-90, 0, 0); Config.outputPos = new Vector3(0, 2.5f, 0); Config.outputRot = new Vector3(-90, 0, 0); } }; }
public static void playerProperties() { SubMenu fitNessCalculating = SettingsUI.CreateSubMenu("Fitness Properties"); BoolViewController units = fitNessCalculating.AddBool("Metric Units? (Kgs, cm)"); units.GetValue += delegate { return(ModPrefs.GetBool(Plugin.alias, "lbskgs", false, true)); }; units.SetValue += delegate(bool lork) { ModPrefs.SetBool(Plugin.alias, "lbskgs", lork); }; bool lbsorkgs = ModPrefs.GetBool(Plugin.alias, "lbskgs", false, true); if (lbsorkgs) ////Converted to kgs { IntViewController weightKGS = fitNessCalculating.AddInt("Weight (kgs)", 36, 363, 1); weightKGS.GetValue += delegate { return(ModPrefs.GetInt(Plugin.alias, "weightKGS", 60, true)); }; weightKGS.SetValue += delegate(int kgs) { ModPrefs.SetInt(Plugin.alias, "weightKGS", kgs); }; }/////// Freedom Units else { IntViewController weightLBS = fitNessCalculating.AddInt("Weight (lbs)", 80, 800, 2); weightLBS.GetValue += delegate { return(ModPrefs.GetInt(Plugin.alias, "weightLBS", 132, true)); }; weightLBS.SetValue += delegate(int lbs) { ModPrefs.SetInt(Plugin.alias, "weightLBS", (int)(lbs)); }; } }
public static void PlayerProperties() { SubMenu fitNessCalculating = SettingsUI.CreateSubMenu("Fitness Properties"); BoolViewController shhiWeight = fitNessCalculating.AddBool("Show weight at launch?"); shhiWeight.GetValue += delegate { return(Plugin.Instance.mainConfig.displayWeightOnLaunch); }; shhiWeight.SetValue += delegate(bool mswv) { Plugin.Instance.mainConfig.displayWeightOnLaunch = mswv; }; BoolViewController units = fitNessCalculating.AddBool("Metric Units? (Kgs, cm)"); units.GetValue += delegate { return(Plugin.Instance.mainConfig.metricUnits); }; units.SetValue += delegate(bool lork) { Plugin.Instance.mainConfig.metricUnits = lork; }; bool lbsorkgs = Plugin.Instance.mainConfig.metricUnits; if (lbsorkgs) ////Converted to kgs { IntViewController weightKGS = fitNessCalculating.AddInt("Weight (kgs)", 36, 363, 1); weightKGS.GetValue += delegate { return(Plugin.Instance.mainConfig.weightKGS); }; weightKGS.SetValue += delegate(int kgs) { Plugin.Instance.mainConfig.weightKGS = kgs; }; }/////// Freedom Units else { IntViewController weightLBS = fitNessCalculating.AddInt("Weight (lbs)", 80, 800, 2); weightLBS.GetValue += delegate { return(Plugin.Instance.mainConfig.weightLBS); }; weightLBS.SetValue += delegate(int lbs) { Plugin.Instance.mainConfig.weightLBS = lbs; }; } }
/// <summary> /// Create a BoolViewController outside of the settings menu. /// NOTE: CustomUI.Settings.SubMenu:AddHooks() can make a call to ApplySettings. /// </summary> /// <param name="name">The text to be displayed for this setting.</param> /// <param name="hintText">The text to be displayed when this settings is hovered over.</param> /// <returns>A new BoolViewController.</returns> public static BoolViewController CreateBoolViewController(string name, string hintText = "") { BoolViewController viewController = _submenu.AddBool(name, hintText); // remove this view controller from the global list of CustomSettings, otherwise it'll try to call Init() when we don't need it to SubMenu.needsInit.Remove(viewController); return(viewController); }
/// <summary> /// Adds an additional submenu in the "Settings" page /// </summary> public static void CreateSettingsMenu() { SubMenu subMenu = SettingsUI.CreateSubMenu(Plugin.PluginName); hmdController = subMenu.AddBool("Enable in headset", disclaimer); hmdController.GetValue += delegate { return(Plugin.IsHMDOn); }; hmdController.SetValue += delegate(bool value) { ChangeTransparentWallState(value); Logger.log.Debug($"'Enable in headset' (IsHMDOn) in the main settings is set to '{value}'"); }; livCameraController = subMenu.AddBool("Disable in LIVCamera"); livCameraController.GetValue += delegate { return(Plugin.IsDisableInLIVCamera); }; livCameraController.SetValue += delegate(bool value) { Plugin.IsDisableInLIVCamera = value; Logger.log.Debug($"'Disable in LIVCamera' (IsDisableLIVCameraWall) in the main settings is set to '{value}'"); }; }
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.Instance.Value.Updates.AutoCheckUpdates; autoCheck.SetValue += val => { IPA.Config.SelfConfig.Instance.Value.Updates.AutoCheckUpdates = val; IPA.Config.SelfConfig.LoaderConfig.Store(IPA.Config.SelfConfig.Instance.Value); }; autoUpdate.applyImmediately = true; autoUpdate.GetValue += () => IPA.Config.SelfConfig.Instance.Value.Updates.AutoUpdate; autoUpdate.SetValue += val => { IPA.Config.SelfConfig.Instance.Value.Updates.AutoUpdate = val; IPA.Config.SelfConfig.LoaderConfig.Store(IPA.Config.SelfConfig.Instance.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); }
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); }; }
public static void CreateSourceSettings(string sourceName, SubMenu parent, SourceConfigBase sourceConfig) { var enabled = parent.AddBool("Enable", $"Read enabled feeds from {sourceName}."); enabled.GetValue += delegate { return(sourceConfig.Enabled); }; enabled.SetValue += delegate(bool value) { if (sourceConfig.Enabled == value) { return; } sourceConfig.Enabled = value; // Config.ConfigChanged = true; }; }
public static void Settings() { SubMenu befitSettings = SettingsUI.CreateSubMenu("BeFit Settings"); BoolViewController legacyMode = befitSettings.AddBool("Legacy Mode?"); legacyMode.GetValue += delegate { return(ModPrefs.GetBool(Plugin.alias, "legacyMode", false, true)); }; legacyMode.SetValue += delegate(bool leg) { ModPrefs.SetBool(Plugin.alias, "legacyMode", leg); }; IntViewController calCountAccuracy = befitSettings.AddInt("FPS Drop Reduction: ", 1, 45, 1); calCountAccuracy.GetValue += delegate { return(ModPrefs.GetInt(Plugin.alias, "caccVal", 30, true)); }; calCountAccuracy.SetValue += delegate(int acc) { ModPrefs.SetInt(Plugin.alias, "caccVal", acc); }; BoolViewController viewInGame = befitSettings.AddBool("Show Calories In Game"); viewInGame.GetValue += delegate { return(ModPrefs.GetBool(Plugin.alias, "dcig", true, true)); }; viewInGame.SetValue += delegate(bool dcig) { ModPrefs.SetBool(Plugin.alias, "dcig", dcig); }; BoolViewController viewCurrent = befitSettings.AddBool("Show Current Session Calories"); viewCurrent.GetValue += delegate { return(ModPrefs.GetBool(Plugin.alias, "csv", true, true)); }; viewCurrent.SetValue += delegate(bool csv) { ModPrefs.SetBool(Plugin.alias, "csv", csv); MenuDisplay.visibleCurrentCalories = csv; }; BoolViewController viewDaily = befitSettings.AddBool("Show Daily Calories"); viewDaily.GetValue += delegate { return(ModPrefs.GetBool(Plugin.alias, "dcv", true, true)); }; viewDaily.SetValue += delegate(bool dcv) { ModPrefs.SetBool(Plugin.alias, "dcv", dcv); MenuDisplay.visibleDailyCalories = dcv; }; BoolViewController viewLife = befitSettings.AddBool("Show All Calories"); viewLife.GetValue += delegate { return(ModPrefs.GetBool(Plugin.alias, "lcv", false, true)); }; viewLife.SetValue += delegate(bool lcv) { ModPrefs.SetBool(Plugin.alias, "lcv", lcv); MenuDisplay.visibleLifeCalories = lcv; }; BoolViewController viewLast = befitSettings.AddBool("Show Last Song Calories"); viewLast.GetValue += delegate { return(ModPrefs.GetBool(Plugin.alias, "lgv", true, true)); }; viewLast.SetValue += delegate(bool lgv) { ModPrefs.SetBool(Plugin.alias, "lgv", lgv); MenuDisplay.visibleLastGameCalories = lgv; }; }
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; }
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; }; }
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(); }
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 static void CreateBeatSyncSettingsUI(SubMenu parent) { var timeoutInt = parent.AddInt("Download Timeout", "How long in seconds to wait for Beat Saver to respond to a download request", 5, 60, 1); timeoutInt.GetValue += delegate { return(Config.DownloadTimeout); }; timeoutInt.SetValue += delegate(int value) { if (Config.DownloadTimeout == value) { return; } Config.DownloadTimeout = value; //Config.SetConfigChanged(); }; var maxConcurrentDownloads = parent.AddInt("Max Concurrent Downloads", "How many song downloads can happen at the same time.", 1, 10, 1); maxConcurrentDownloads.GetValue += delegate { return(Config.MaxConcurrentDownloads); }; maxConcurrentDownloads.SetValue += delegate(int value) { if (Config.MaxConcurrentDownloads == value) { return; } Config.MaxConcurrentDownloads = value; // Config.ConfigChanged = true; }; var recentPlaylistDays = parent.AddInt("Recent Playlist Days", "How long in days songs downloaded by BeatSync are kept in the BeatSync Recent playlist (0 to disable the playlist).", 0, 60, 1); recentPlaylistDays.GetValue += delegate { return(Config.RecentPlaylistDays); }; recentPlaylistDays.SetValue += delegate(int value) { if (Config.RecentPlaylistDays == value) { return; } Config.RecentPlaylistDays = value; // Config.ConfigChanged = true; }; var allBeatSyncSongs = parent.AddBool("Enable All BeatSync Songs", "Maintain a playlist that has all the songs downloaded by BeatSync."); allBeatSyncSongs.GetValue += delegate { return(Config.AllBeatSyncSongsPlaylist); }; allBeatSyncSongs.SetValue += delegate(bool value) { if (Config.AllBeatSyncSongsPlaylist == value) { return; } Config.AllBeatSyncSongsPlaylist = value; // Config.ConfigChanged = true; }; var timeBetweenSyncs = parent.AddSubMenu("Time Between Syncs", "Minimum amount of time between BeatSync syncs (Set both to 0 to run BeatSync every time the game is started).", true); var hours = timeBetweenSyncs.AddInt("Hours", "Number of hours between BeatSync syncs.", 0, 100, 1); hours.GetValue += delegate { return(Config.TimeBetweenSyncs.Hours); }; hours.SetValue += delegate(int value) { if (Config.TimeBetweenSyncs.Hours == value) { return; } Config.TimeBetweenSyncs.Hours = value; // Config.ConfigChanged = true; }; var minutes = timeBetweenSyncs.AddInt("Minutes", "Number of minutes between BeatSync syncs.", 0, 59, 1); minutes.GetValue += delegate { return(Config.TimeBetweenSyncs.Minutes); }; minutes.SetValue += delegate(int value) { if (Config.TimeBetweenSyncs.Minutes == value) { return; } Config.TimeBetweenSyncs.Minutes = value; // Config.ConfigChanged = true; }; }
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-----------------------------------"); } }