예제 #1
0
        private static void AcquiredOnlineVersionInfo(bool upToDate, string webVersion, string errorMessage)
        {
            string replace;

            if (errorMessage != null)
            {
                replace = "<color=red>" + errorMessage + "</color>";
            }
            else
            {
                if (upToDate)
                {
                    replace = "<color=green>You have the most recent version!</color>";
                }
                else
                {
                    replace = "<color=red>Chroma is outdated!</color>";
                }
                if (webVersion != null)
                {
                    replace = replace + Environment.NewLine + "Latest public release: " + webVersion;
                }
            }

            SidePanelUtil.RegisterTextPanel("chroma",
                                            ResourceTextFiles.chromaNotes
                                            .Replace("%VER%", (upToDate ? "<color=green>" : "<color=red>") + ChromaPlugin.Instance.plugin.Version + "</color>")
                                            .Replace("%USERNAME%", ChromaConfig.Username)
                                            .Replace("%ONLINE_VER%", replace)
                                            );
            SidePanelUtil.Update();

            ChromaLogger.Log("Updated panel with version info");
        }
 static void Postfix(ReleaseInfoViewController __instance, ref MainSettingsModel ____mainSettingsModel, ref bool firstActivation, ref TextPageScrollView ____textPageScrollView, ref TextAsset ____releaseNotesTextAsset, ref TextAsset ____firstTextAsset)
 {
     if (firstActivation)
     {
         SidePanelUtil.ReleaseInfoEnabled(__instance, ____textPageScrollView, ____mainSettingsModel.playingForTheFirstTime ? ____firstTextAsset.text : ____releaseNotesTextAsset.text);
     }
 }
예제 #3
0
        public static void RegisterChromaSideMenu()
        {
            SidePanelUtil.RegisterTextPanel("chroma",
                                            ResourceTextFiles.chromaNotes
                                            .Replace("%VER%", ChromaPlugin.Instance.plugin.Version)
                                            .Replace("%USERNAME%", ChromaConfig.Username)
                                            );

            SidePanelUtil.RegisterTextPanel("chromaWaiver", ResourceTextFiles.safetyWaiver);
            SidePanelUtil.RegisterTextPanel("chromaCredits", ResourceTextFiles.credits);
        }
예제 #4
0
        public static void RegisterChromaSideMenu()
        {
            SidePanelUtil.RegisterTextPanel("chroma",
                                            ResourceTextFiles.chromaNotes
                                            .Replace("%VER%", ChromaPlugin.Instance.plugin.Version)
                                            .Replace("%USERNAME%", ChromaConfig.Username)
                                            .Replace("%ONLINE_VER%", "<color=yellow>ACQUIRING VERSION INFO</color>")
                                            );

            SidePanelUtil.RegisterTextPanel("chromaWaiver", ResourceTextFiles.safetyWaiver);
            SidePanelUtil.RegisterTextPanel("chromaCredits", ResourceTextFiles.credits);

            VersionChecker.GetOnlineVersion("https://modsaber.org/api/v1.1/mods/versions/chroma", AcquiredOnlineVersionInfo);
        }
예제 #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();
        }
예제 #6
0
 public void ReleaseInfoEnabled()
 {
     SidePanelUtil.SetPanel("chroma");
     //SidePanelUtil.SetPanelDirectly(SafetyWaiver.GetSafetyWaiverUIMessage());
 }