Пример #1
0
        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);
            }
        }