private static void OnLoadSettingsEvent(Config iniProfile, LoadSettingsType type) { if (type == LoadSettingsType.INITIAL) { technicolourSparksStyle = (TechnicolourStyle)ChromaConfig.GetInt("Technicolour", "technicolourSparksStyle", 0); } /* * PARTICLES */ particleManipulationEnabled = ChromaConfig.GetBool("Particles", "particleManipulationEnabled", false); particlesGlobalMaxMult = ChromaConfig.GetFloat("Particles", "particlesGlobalMaxMult", 1f); slashParticlesMult = ChromaConfig.GetFloat("Particles", "slashParticlesMult", 1f); slashParticlesLifeMult = ChromaConfig.GetFloat("Particles", "slashParticlesLifeMult", 1f); slashParticlesSpeedMult = ChromaConfig.GetFloat("Particles", "slashParticlesSpeedMult", 1f); slashParticlesTimeScale = ChromaConfig.GetFloat("Particles", "slashParticlesTimeScale", 1f); explosionParticlesMult = ChromaConfig.GetFloat("Particles", "explosionParticlesMult", 1f); explosionParticlesLifeMult = ChromaConfig.GetFloat("Particles", "explosionParticlesLifeMult", 1f); explosionParticlesSpeedMult = ChromaConfig.GetFloat("Particles", "explosionParticlesSpeedMult", 1f); explosionParticlesTimeScale = ChromaConfig.GetFloat("Particles", "explosionParticlesTimeScale", 1f); }
public static void OnReloadClick() { //SceneManager.LoadScene(SceneManager.GetActiveScene().name); ChromaConfig.LoadSettings(ChromaConfig.LoadSettingsType.MANUAL); }
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 OnLoadSettingsEvent(BS_Utils.Utilities.Config iniProfile, LoadSettingsType type) { try { ChromaLogger.Log("Loading settings [" + type.ToString() + "]", ChromaLogger.Level.INFO); string iniName = ModPrefs.GetString("Chroma", "ConfigProfile", "default", true); //TODO get the thing IniProfile = new BS_Utils.Utilities.Config("Chroma/Preferences/" + iniName); ChromaLogger.Log("--- From file " + iniName); BS_Utils.Gameplay.GetUserInfo.UpdateUserInfo(); Username = BS_Utils.Gameplay.GetUserInfo.GetUserName(); UserID = BS_Utils.Gameplay.GetUserInfo.GetUserID(); ChromaLogger.Log(Greetings.GetGreeting(UserID, Username), ChromaLogger.Level.INFO); if (DebugMode) { ChromaLogger.Log("=== YOUR ID : " + UserID.ToString()); } if (type == LoadSettingsType.INITIAL) { timesLaunched = ChromaConfig.GetInt("Other", "timesLaunched", timesLaunched + 1); ChromaConfig.SetInt("Other", "timesLaunched", timesLaunched); } /* * MAP */ customMapCheckingEnabled = ChromaConfig.GetBool("Map", "customMapCheckingEnabled", true); customColourEventsEnabled = ChromaConfig.GetBool("Map", "customColourEventsEnabled", true); customSpecialEventsEnabled = ChromaConfig.GetBool("Map", "customSpecialEventsEnabled", true); /* * AUDIO */ masterVolume = Mathf.Clamp01(ChromaConfig.GetFloat("Audio", "masterVolume", 1)); AudioUtil.Instance.SetVolume(masterVolume); /* * TECHNICOLOUR */ if (type == LoadSettingsType.INITIAL) { technicolourEnabled = ChromaConfig.GetBool("Technicolour", "technicolourEnabled", false); technicolourLightsStyle = (TechnicolourStyle)ChromaConfig.GetInt("Technicolour", "technicolourLightsStyle", 1); //technicolourLightsIndividual = GetBool("Technicolour", "technicolourLightsIndividual", technicolourLightsIndividual); technicolourLightsGrouping = (TechnicolourLightsGrouping)ChromaConfig.GetInt("Technicolour", "technicolourLightsGrouping", 1); if (technicolourLightsGrouping == TechnicolourLightsGrouping.ISOLATED) { TechnicolourLightsGrouping = TechnicolourLightsGrouping.ISOLATED_GROUP; } technicolourLightsFrequency = GetFloat("Technicolour", "technicolourLightsFrequency", technicolourLightsFrequency); technicolourSabersStyle = (TechnicolourStyle)ChromaConfig.GetInt("Technicolour", "technicolourSabersStyle", 0); technicolourBlocksStyle = (TechnicolourStyle)ChromaConfig.GetInt("Technicolour", "technicolourBlocksStyle", 0); technicolourWallsStyle = (TechnicolourStyle)ChromaConfig.GetInt("Technicolour", "technicolourWallsStyle", 0); matchTechnicolourSabers = ChromaConfig.GetBool("Technicolour", "matchTechnicolourSabers", false); } string[] technicolourColdString = ChromaConfig.GetString("Technicolour", "technicolourB", "0;128;255;255-0;255;0;255-0;0;255;255-0;255;204;255").Split('-'); string[] technicolourWarmString = ChromaConfig.GetString("Technicolour", "technicolourA", "255;0;0;255-255;0;255;255-255;153;0;255-255;0;102;255").Split('-'); Color[] technicolourCold = new Color[technicolourColdString.Length]; Color[] technicolourWarm = new Color[technicolourWarmString.Length]; for (int i = 0; i < Mathf.Max(technicolourCold.Length, technicolourWarm.Length); i++) { if (i < technicolourCold.Length) { technicolourCold[i] = ColourManager.ColourFromString(technicolourColdString[i]); } if (i < technicolourWarm.Length) { technicolourWarm[i] = ColourManager.ColourFromString(technicolourWarmString[i]); } } ColourManager.TechnicolourWarmPalette = technicolourWarm; ColourManager.TechnicolourColdPalette = technicolourCold; /* * NOTES */ ColourManager.A = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Notes", "colourA", "DEFAULT"), ColourManager.DefaultA); ColourManager.B = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Notes", "colourB", "DEFAULT"), ColourManager.DefaultB); ColourManager.AltA = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Notes", "colourAltA", "Notes Magenta"), ColourManager.DefaultAltA); ColourManager.AltB = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Notes", "colourAltB", "Notes Green"), ColourManager.DefaultAltB); ColourManager.NonColoured = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Notes", "colourNonColoured", "Notes White"), ColourManager.DefaultNonColoured); ColourManager.DoubleHit = ColourManager.DoubleHit = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Notes", "colourDuochrome", "Notes Purple")); ColourManager.Super = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Notes", "colourSuper", "Notes Gold"), ColourManager.DefaultSuper); /* * LIGHTS */ ColourManager.LightAmbient = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Lights", "lightAmbient", "DEFAULT"), ColourManager.DefaultLightAmbient); ColourManager.LightA = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Lights", "lightColourA", "DEFAULT"), ColourManager.DefaultLightA); ColourManager.LightB = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Lights", "lightColourB", "DEFAULT"), ColourManager.DefaultLightB); ColourManager.LightAltA = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Lights", "lightColourAltA", "Light Magenta"), ColourManager.DefaultLightAltA); ColourManager.LightAltB = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Lights", "lightColourAltB", "Light Green"), ColourManager.DefaultLightAltB); ColourManager.LightWhite = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Lights", "lightColourWhite", "Light White"), ColourManager.DefaultLightWhite); ColourManager.LightGrey = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Lights", "lightColourGrey", "Light Grey"), ColourManager.DefaultLightGrey); /* * AESTHETICS */ ColourManager.BarrierColour = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Aesthetics", "barrierColour", "Barrier Red"), ColourManager.DefaultBarrierColour); ColourManager.LaserPointerColour = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Aesthetics", "laserPointerColour", "DEFAULT"), ColourManager.DefaultB); ColourManager.SignA = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Aesthetics", "signColourA", "DEFAULT"), ColourManager.DefaultA); ColourManager.SignB = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Aesthetics", "signColourB", "DEFAULT"), ColourManager.DefaultB); ColourManager.Platform = ChromaSettingsUI.GetColor(ChromaConfig.GetString("Aesthetics", "platformAccoutrements", "DEFAULT"), ColourManager.DefaultB); ColourManager.barrierColourCorrectionScale = ChromaConfig.GetFloat("Aesthetics", "barrierColourCorrectionScale", 1f); ChromaConfig.saberTrailStrength = ChromaConfig.GetFloat("Aesthetics", "saberTrailStrength", 1f); /* * MODIFIERS */ lightshowModifier = ChromaConfig.GetBool("Modifiers", "lightshowModifier", false); /* * OTHER */ legacyLighting = ChromaConfig.GetBool("Other", "legacyLighting", false); debugMode = ChromaConfig.GetBool("Other", "debugMode", false); hideSubMenus = ChromaConfig.GetBool("Other", "hideSubMenus", false); waiverRead = ChromaConfig.GetInt("Other", "safetyWaiver", 0) == 51228; /*string waiverFilePath = Environment.CurrentDirectory.Replace('\\', '/') + "/UserData/ChromaToggle/waiver_411.txt"; * if (File.Exists(waiverFilePath)) { * waiverRead = true; * ChromaLogger.Log("Waiver found."); * }*/ ColourManager.RefreshLights(); if (type == LoadSettingsType.MANUAL) { AudioUtil.Instance.PlayOneShotSound("ConfigReload.wav"); } } catch (Exception e) { ChromaLogger.Log("Error loading Chroma configs! Waduhek", ChromaLogger.Level.ERROR); ChromaLogger.Log(e); } }