Пример #1
0
        internal static SubMenu createBase <T>(string name, T configItem, params ICounterPositions[] restricted) where T : Config.IConfigModel
        {
            Plugin.Log("Creating base for: " + name);
            List <Tuple <ICounterPositions, string> > restrictedList = new List <Tuple <ICounterPositions, string> >();

            try
            {
                foreach (ICounterPositions pos in restricted)
                {
                    restrictedList.Add(Tuple.Create(pos, positions.Where((Tuple <ICounterPositions, string> x) => x.Item1 == pos).First().Item2));
                }
            }
            catch { } //It most likely errors here. If it does, well no problem.
            var @base   = SettingsUI.CreateSubMenu("Counters+ | " + name);
            var enabled = @base.AddBool("Enabled", "Toggles this counter on or off.");

            enabled.GetValue += () => configItem.Enabled;
            enabled.SetValue += v => configItem.Enabled = v;
            var position = @base.AddListSetting <PositionSettingsViewController>("Position", "The relative positions of common UI elements of which to go off of.");

            position.values          = (restrictedList.Count() == 0) ? positions : restrictedList;
            position.GetValue        = () => positions.Where((Tuple <Config.ICounterPositions, string> x) => (x.Item1 == configItem.Position)).FirstOrDefault();
            position.GetTextForValue = (value) => value.Item2;
            position.SetValue        = v => configItem.Position = v.Item1;
            var index = @base.AddInt("Index", "How far from the position the counter will be. A higher number means farther away.", 0, 5, 1);

            index.GetValue += () => configItem.Index;
            index.SetValue += v => configItem.Index = v;
            return(@base);
        }
Пример #2
0
        public static void OnLoad()
        {
            SubMenu subMenu = SettingsUI.CreateSubMenu("Twitch Camera Mover");


            // Create the gameobject
            if (CameraMover.Instance == null)
            {
                new GameObject("CameraMover").AddComponent <CameraMover>();
            }

            if (newCube == null)
            {
                newCube = GameObject.CreatePrimitive(PrimitiveType.Cube);
                DontDestroyOnLoad(newCube);
                newCube.SetActive(true);
                newCube.transform.localScale = new Vector3(0.15f, 0.15f, 0.22f);
                newCube.name = "CustomCameraCube";
                newCube.transform.position = new Vector3(0, 1.5f, 0.5f);
            }

            if (floorAdjustViewController == null)
            {
                getPlayerHeight();
            }
        }
Пример #3
0
        private void SetupUI()
        {
            if (initialized)
            {
                return;
            }

            RectTransform mainMenu = (Resources.FindObjectsOfTypeAll <MainMenuViewController>().First().rectTransform);

            MenuButtonUI.AddButton("More songs...", BeatSaverButtonPressed);
            //_moreSongsButton.interactable = false;

            var downloaderSubMenu = SettingsUI.CreateSubMenu("Downloader");

            var disableDeleteButton = downloaderSubMenu.AddBool("Disable delete button");

            disableDeleteButton.GetValue += delegate { return(PluginConfig.disableDeleteButton); };
            disableDeleteButton.SetValue += delegate(bool value) { PluginConfig.disableDeleteButton = value; PluginConfig.SaveConfig(); };

            var deleteToRecycleBin = downloaderSubMenu.AddBool("Delete to Recycle Bin");

            deleteToRecycleBin.GetValue += delegate { return(PluginConfig.deleteToRecycleBin); };
            deleteToRecycleBin.SetValue += delegate(bool value) { PluginConfig.deleteToRecycleBin = value; PluginConfig.SaveConfig(); };

            var maxSimultaneousDownloads = downloaderSubMenu.AddInt("Max simultaneous downloads", 1, 10, 1);

            maxSimultaneousDownloads.GetValue += delegate { return(PluginConfig.maxSimultaneousDownloads); };
            maxSimultaneousDownloads.SetValue += delegate(int value) { PluginConfig.maxSimultaneousDownloads = value; PluginConfig.SaveConfig(); };

            initialized = true;
        }
Пример #4
0
        private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
        {
            if (arg0.name == "Menu")
            {
                modEnable = false;
                var settingsSubmenu = SettingsUI.CreateSubMenu("AutoPause");
                var en = settingsSubmenu.AddBool("AutoPause Enabled");
                en.GetValue += delegate { return(ModPrefs.GetBool("Auros's AutoPause", "Enabled", true, true)); };
                en.SetValue += delegate(bool value) { ModPrefs.SetBool("Auros's AutoPause", "Enabled", value); };

                var pq = settingsSubmenu.AddBool("FPS Pause");
                pq.GetValue += delegate { return(ModPrefs.GetBool("Auros's AutoPause", "FPSCheckerOn", false, true)); };
                pq.SetValue += delegate(bool value) { ModPrefs.SetBool("Auros's AutoPause", "FPSCheckerOn", value); };

                float[] fpsValues    = { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90 };
                var     fpsThreshold = settingsSubmenu.AddList("FPS Threshold", fpsValues);
                fpsThreshold.GetValue    += delegate { return(ModPrefs.GetFloat("Auros's AutoPause", "FPSThreshold", 40, true)); };
                fpsThreshold.SetValue    += delegate(float value) { ModPrefs.SetFloat("Auros's AutoPause", "FPSThreshold", value); };
                fpsThreshold.FormatValue += delegate(float value) { return(string.Format("{0:0}", value)); };
                System.Console.WriteLine("[AutoPause] Settings Created");
                //System.Console.Read();

                //SharedCoroutineStarter.instance.StartCoroutine(DelayedEnable());
            }
        }
Пример #5
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));
                };
            }
        }
Пример #6
0
        public void OnSceneLoaded(Scene scene, LoadSceneMode arg1)
        {
            if (save)
            {
                Logger.log.Info("Saving Settings");
                settings.SaveSettings();
                save = false;
            }

            if (scene.name == "MenuCore" && !settingsattached)
            {
                SubMenu settingsSubmenu = SettingsUI.CreateSubMenu("Rumble Enhancer");

                string hint = "Duration of Rumble Effect";

                IntViewController rumbleTime = settingsSubmenu.AddInt("Rumble Length\t\t(in ms)", hint, 0, 250, 5);
                rumbleTime.GetValue += delegate { return(settings.RumbleTimeMS); };
                rumbleTime.SetValue += delegate(int value) { settings.RumbleTimeMS = value; };

                hint = "The Pause between single pulses,\n the lower this is the stronger the rumble will feel";

                IntViewController rumblePause = settingsSubmenu.AddInt("Rumble Interval\t(in ms)", hint, 0, 30, 1);
                rumblePause.GetValue += delegate { return(settings.TimeBetweenRumblePulsesMS); };
                rumblePause.SetValue += delegate(int value) { settings.TimeBetweenRumblePulsesMS = value; };

                settingsattached = true;
                Logger.log.Info("Settings attached!");
            }
        }
Пример #7
0
        private void OnSceneLoaded(Scene arg0, LoadSceneMode arg1)
        {
            if (arg0.name != "MenuCore")
            {
                return;
            }

            var menu = SettingsUI.CreateSubMenu("FullComboDisplay");

            float[] effectVals = new float[effects.Length];
            for (int i = 0; i < effects.Length; i++)
            {
                effectVals[i] = i;
            }

            var enabled = menu.AddBool("Enabled");

            enabled.GetValue    += delegate { return(ModPrefs.GetBool("FCDisplay", "Enabled", true, true)); };
            enabled.SetValue    += delegate(bool value) { ModPrefs.SetBool("FCDisplay", "Enabled", value); };
            enabled.EnabledText  = "Enabled";
            enabled.DisabledText = "Disabled";

            var effect = menu.AddList("Miss Effect", effectVals);

            effect.GetValue    += delegate { return(ModPrefs.GetInt("FCDisplay", "MissEffect", 1, true)); };
            effect.SetValue    += delegate(float value) { ModPrefs.SetInt("FCDisplay", "MissEffect", (int)value); };
            effect.FormatValue += delegate(float value) { return(effects[(int)value]); };

            var vanilla = menu.AddBool("Vanilla Display (Combo Border)");

            vanilla.GetValue    += delegate { return(ModPrefs.GetBool("FCDisplay", "VanillaEnabled", false, true)); };
            vanilla.SetValue    += delegate(bool value) { ModPrefs.SetBool("FCDisplay", "VanillaEnabled", value); };
            vanilla.EnabledText  = "Visible";
            vanilla.DisabledText = "Hidden";
        }
Пример #8
0
        private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
        {
            if (arg0.name != "Menu")
            {
                return;
            }

            Plugin.Log("Menu Tweaks Started!", LogLevel.DebugOnly);

            // Create the settings menu
            var submenu = SettingsUI.CreateSubMenu("Menu Tweaks");

            // Add the Fail Counter toggle
            failCounterToggle              = submenu.AddBool("Fail Counter");
            failCounterToggle.GetValue    += delegate { return(ModPrefs.GetBool("MenuTweaks", "FailCounterVisible", true, true)); };
            failCounterToggle.SetValue    += delegate(bool value) { ModPrefs.SetBool("MenuTweaks", "FailCounterVisible", value); };
            failCounterToggle.EnabledText  = "VISIBLE";
            failCounterToggle.DisabledText = "HIDDEN";

            // Add the Click Shockwave toggle
            menuShockwaveToggle           = submenu.AddBool("Click Shockwave");
            menuShockwaveToggle.GetValue += delegate { return(ModPrefs.GetBool("MenuTweaks", "ClickShockwaveEnabled", true, true)); };
            menuShockwaveToggle.SetValue += delegate(bool value) { ModPrefs.SetBool("MenuTweaks", "ClickShockwaveEnabled", value); };

            // Add the Fireworks toggle
            fireworksToggle           = submenu.AddBool("Fireworks");
            fireworksToggle.GetValue += delegate { return(ModPrefs.GetBool("MenuTweaks", "FireworksEnabled", true, true)); };
            fireworksToggle.SetValue += delegate(bool value) { ModPrefs.SetBool("MenuTweaks", "FireworksEnabled", value); };
        }
Пример #9
0
        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);
        }
Пример #10
0
        private static void CreateSettingsUI()
        {
            var subMenu = SettingsUI.CreateSubMenu("Scoreboard Style");

            colorMap = new Dictionary <string, Color>();

            MakePicker(subMenu, "default", "Default", "Color for normal users", "#FFFFFF");
            MakePicker(subMenu, "patron", "Patron", "Color for scoresaber patreon supporters", "#F96854");
            MakePicker(subMenu, "rankingTeam", "Ranking Team", "Color for scoresaber ranking team members", "#1ABC9C");
            MakePicker(subMenu, "staff", "Staff", "Color for scoresaber staff", "#FF03E3");
            MakePicker(subMenu, "percent", "Percentage", "Color for score percentage", "#FFD42A");
            MakePicker(subMenu, "pp", "PP", "Color for pp earned", "#6772E5");

            var rankPicker = MakePicker(subMenu, "rank", "Rank", "Color for leaderboard rank", "#FFFFFF", false);

            rankPicker.SetValue += delegate(Color value)
            {
                string hex = "#" + ColorUtility.ToHtmlStringRGB(value);
                rankColor = hex;
                config.SetString("Colors", "rank", hex);
            };

            var scorePicker = MakePicker(subMenu, "score", "Score", "Color for score", "#FFFFFF", false);

            scorePicker.SetValue += delegate(Color value)
            {
                string hex = "#" + ColorUtility.ToHtmlStringRGB(value);
                scoreColor = hex;
                config.SetString("Colors", "score", hex);
            };
        }
Пример #11
0
        public static void OnLoad()
        {
            var menu            = SettingsUI.CreateSubMenu("Pimax Light Fixer");
            var disableLighting = menu.AddBool("Disable Lighting", "When enabled, the problem light components are completely destroyed instead of being repositioned.");

            disableLighting.GetValue += () => { return(Config.DisableLighting); };
            disableLighting.SetValue += (value) => { Config.DisableLighting = value; };
        }
Пример #12
0
        private static void CreateSettingsUI()
        {
            var subMenu = SettingsUI.CreateSubMenu("VideoPlayer");

            var showVideoSetting = subMenu.AddBool("Show Video");

            showVideoSetting.GetValue += delegate
            {
                return(ScreenManager.showVideo);
            };
            showVideoSetting.SetValue += delegate(bool value)
            {
                ScreenManager.showVideo = value;
                ModPrefs.SetBool(Plugin.PluginName, "ShowVideo", ScreenManager.showVideo);
            };

            var placementSetting = subMenu.AddList("Screen Position", VideoPlacementSetting.Modes());

            placementSetting.GetValue += delegate
            {
                return((float)ScreenManager.Instance.placement);
            };
            placementSetting.SetValue += delegate(float value)
            {
                ScreenManager.Instance.SetPlacement((VideoPlacement)value);
                ModPrefs.SetInt(Plugin.PluginName, "ScreenPositionMode", (int)ScreenManager.Instance.placement);
            };
            placementSetting.FormatValue += delegate(float value) { return(VideoPlacementSetting.Name((VideoPlacement)value)); };


            var qualitySetting = subMenu.AddList("Video Download Quality", VideoQualitySetting.Modes());

            qualitySetting.GetValue += delegate
            {
                return((float)YouTubeDownloader.Instance.quality);
            };
            qualitySetting.SetValue += delegate(float value)
            {
                YouTubeDownloader.Instance.quality = (VideoQuality)value;
                ModPrefs.SetInt(Plugin.PluginName, "VideoDownloadQuality", (int)YouTubeDownloader.Instance.quality);
            };
            qualitySetting.FormatValue += delegate(float value) { return(VideoQualitySetting.Name((VideoQuality)value)); };


            var autoDownloadSetting = subMenu.AddBool("Auto Download");

            autoDownloadSetting.GetValue += delegate
            {
                return(VideoLoader.Instance.autoDownload);
            };
            autoDownloadSetting.SetValue += delegate(bool value)
            {
                VideoLoader.Instance.autoDownload = value;
                ModPrefs.SetBool(Plugin.PluginName, "AutoDownload", ScreenManager.showVideo);
            };
        }
Пример #13
0
 public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
 {
     if (scene.buildIndex == MainScene)
     {
         var subMenu   = SettingsUI.CreateSubMenu("TestPluginSubMenu");    // Passing in the sub menu label
         var energyBar = subMenu.AddBool("testBool");                      // Passing in the option label
         energyBar.GetValue += delegate { return(testBool); };             // Delegate returning the bool for display
         energyBar.SetValue += delegate(bool value) { testBool = value; }; // Delegate to set the bool when Apply/Ok is pressed
     }
 }
Пример #14
0
        public static void OnLoad()
        {
            var menu = SettingsUI.CreateSubMenu("Song Request Manager");

            var AutopickFirstSong = menu.AddBool("Autopick First Song", "Automatically pick the first song with sr!");

            AutopickFirstSong.SetValue += (requests) => { RequestBotConfig.Instance.AutopickFirstSong = requests; };
            AutopickFirstSong.GetValue += () => { return(RequestBotConfig.Instance.AutopickFirstSong); };

            var MiniumSongRating = menu.AddSlider("Minimum rating", "Minimum allowed song rating", 0, 100, 0.5f, false);

            MiniumSongRating.SetValue += (scale) => { RequestBotConfig.Instance.LowestAllowedRating = scale; };
            MiniumSongRating.GetValue += () => { return(RequestBotConfig.Instance.LowestAllowedRating); };

            var MaximumAllowedSongLength = menu.AddSlider("Maximum Song Length", "Longest allowed song length in minutes", 0, 999, 1.0f, false);

            MaximumAllowedSongLength.SetValue += (scale) => { RequestBotConfig.Instance.MaximumSongLength = scale; };
            MaximumAllowedSongLength.GetValue += () => { return(RequestBotConfig.Instance.MaximumSongLength); };


            var MinimumNJS = menu.AddSlider("Minimum NJS allowed", "Disallow songs below a certain NJS", 0, 50, 1.0f, false);

            MinimumNJS.SetValue += (scale) => { RequestBotConfig.Instance.MinimumNJS = scale; };
            MinimumNJS.GetValue += () => { return(RequestBotConfig.Instance.MinimumNJS); };

            var TTSSupport = menu.AddBool("TTS Support", "Add ! to all command outputs for TTS Filtering");

            TTSSupport.SetValue += (requests) => { RequestBotConfig.Instance.BotPrefix = requests ? "! " : ""; };
            TTSSupport.GetValue += () => { return(RequestBotConfig.Instance.BotPrefix != ""); };

            var UserRequestLimit = menu.AddSlider("User Request limit", "Maximum requests in queue at one time", 0, 10, 1f, true);

            UserRequestLimit.SetValue += (scale) => { RequestBotConfig.Instance.UserRequestLimit = (int )scale; };
            UserRequestLimit.GetValue += () => { return(RequestBotConfig.Instance.UserRequestLimit); };

            var SubRequestLimit = menu.AddSlider("Sub Request limit", "Maximum requests in queue at one time", 0, 10, 1f, true);

            SubRequestLimit.SetValue += (scale) => { RequestBotConfig.Instance.SubRequestLimit = (int)scale; };
            SubRequestLimit.GetValue += () => { return(RequestBotConfig.Instance.SubRequestLimit); };

            var ModRequestLimit = menu.AddSlider("Moderator Request limit", "Maximum requests in queue at one time", 0, 100, 1f, true);

            ModRequestLimit.SetValue += (scale) => { RequestBotConfig.Instance.ModRequestLimit = (int)scale; };
            ModRequestLimit.GetValue += () => { return(RequestBotConfig.Instance.ModRequestLimit); };

            var VIPBonus = menu.AddSlider("VIP Request bonus", "Additional requests allowed in queue", 0, 10, 1f, true);

            VIPBonus.SetValue += (scale) => { RequestBotConfig.Instance.VipBonusRequests = (int)scale; };
            VIPBonus.GetValue += () => { return(RequestBotConfig.Instance.VipBonusRequests); };

            var ModeratorRights = menu.AddBool("Full moderator rights", "Allow moderators access to ALL bot commands. Do you trust your mods?");

            ModeratorRights.SetValue += (requests) => { RequestBotConfig.Instance.ModFullRights = requests; };
            ModeratorRights.GetValue += () => { return(RequestBotConfig.Instance.ModFullRights); };
        }
Пример #15
0
        public static void CreateSettingsUI()
        {
            //This will create a menu tab in the settings menu for your plugin
            var pluginSettingsSubmenu = SettingsUI.CreateSubMenu("Submenu Name");

            var exampleToggle = pluginSettingsSubmenu.AddBool("Example Toggle");

            //Fetch your initial value for the option from within the braces, or simply have it default to a value
            exampleToggle.GetValue += delegate { return(false); };
            exampleToggle.SetValue += delegate(bool value) {
                //Whatever execution you want to occur after setting the value
            };
        }
Пример #16
0
        private void CreateSettingsMenu()
        {
            var settingsMenu = SettingsUI.CreateSubMenu(Plugin.instance.Name);

            var AutoStartLobby = settingsMenu.AddBool("Auto-Start Lobby", "Opens up a lobby when you launch the game");

            AutoStartLobby.GetValue += delegate { return(Config.Instance.AutoStartLobby); };
            AutoStartLobby.SetValue += delegate(bool value) { Config.Instance.AutoStartLobby = value; };

            var IsPublic = settingsMenu.AddBool("Auto-Start Privacy", "Configures the privacy of lobbies that are auto-started");

            IsPublic.DisabledText = "Friends Only";
            IsPublic.EnabledText  = "Public";
            IsPublic.GetValue    += delegate { return(Config.Instance.IsPublic); };
            IsPublic.SetValue    += delegate(bool value) { Config.Instance.IsPublic = value; };

            var MaxLobbySite = settingsMenu.AddInt("Lobby Size", "Configure the amount of users you want to be able to join your lobby.", 2, 15, 1);

            MaxLobbySite.GetValue += delegate { return(Config.Instance.MaxLobbySize); };
            MaxLobbySite.SetValue += delegate(int value) {
                SteamMatchmaking.SetLobbyMemberLimit(SteamAPI.getLobbyID(), value);
                Config.Instance.MaxLobbySize = value;
            };

            var AvatarsInLobby = settingsMenu.AddBool("Enable Avatars In Lobby", "Turns avatars on for you in the waiting lobby");

            AvatarsInLobby.GetValue += delegate { return(Config.Instance.AvatarsInLobby); };
            AvatarsInLobby.SetValue += delegate(bool value) { Config.Instance.AvatarsInLobby = value; };

            var AvatarsInGame = settingsMenu.AddBool("Enable Avatars In Game", "Turns avatars on for you while playing songs");

            AvatarsInGame.GetValue += delegate { return(Config.Instance.AvatarsInGame); };
            AvatarsInGame.SetValue += delegate(bool value) { Config.Instance.AvatarsInGame = value; };

            var NetworkQuality = settingsMenu.AddInt("Network Quality", "Higher number, smoother avatar. Note that this effects how you appear to others. ", 0, 5, 1);

            NetworkQuality.GetValue += delegate { return(Config.Instance.NetworkQuality); };
            NetworkQuality.SetValue += delegate(int value) {
                Config.Instance.NetworkQuality = value;
                if (Controllers.PlayerController.Instance.isBroadcasting)
                {
                    Controllers.PlayerController.Instance.StopBroadcasting();
                    Controllers.PlayerController.Instance.StartBroadcasting();
                }
            };

            var NetworkScaling = settingsMenu.AddBool("Network Scaling", "Scales your network traffic based on the size of your lobby.");

            NetworkScaling.GetValue += delegate { return(Config.Instance.NetworkScaling); };
            NetworkScaling.SetValue += delegate(bool value) { Config.Instance.NetworkScaling = value; };
        }
Пример #17
0
        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);
                }
            };
        }
Пример #18
0
        /// <summary>
        /// This is the code used to create a submenu in Beat Saber's Settings menu.
        /// </summary>
        public static void CreateSettingsUI()
        {
            //This will create a menu tab in the settings menu for your plugin
            var pluginSettingsSubmenu = SettingsUI.CreateSubMenu("ShowSongID");

            // Example code for creating a true/false toggle button
            var displayBeforeAuthorToggle = pluginSettingsSubmenu.AddBool("Display Before Author", "Display the song ID before the author name.");

            displayBeforeAuthorToggle.GetValue += delegate { return(Plugin.DisplayBeforeAuthor); };
            displayBeforeAuthorToggle.SetValue += delegate(bool value) {
                // This code is run when the toggle is toggled.
                Plugin.DisplayBeforeAuthor = value;
            };
        }
Пример #19
0
        private IEnumerator SetupUI()
        {
            if (initialized)
            {
                yield break;
            }

            RectTransform mainMenu = (Resources.FindObjectsOfTypeAll <MainMenuViewController>().First().rectTransform);

            var downloaderSubMenu = SettingsUI.CreateSubMenu("Downloader");

            var disableDeleteButton = downloaderSubMenu.AddBool("Disable delete button");

            disableDeleteButton.GetValue += delegate { return(PluginConfig.disableDeleteButton); };
            disableDeleteButton.SetValue += delegate(bool value) { PluginConfig.disableDeleteButton = value; PluginConfig.SaveConfig(); };

            var deleteToRecycleBin = downloaderSubMenu.AddBool("Delete to Recycle Bin");

            deleteToRecycleBin.GetValue += delegate { return(PluginConfig.deleteToRecycleBin); };
            deleteToRecycleBin.SetValue += delegate(bool value) { PluginConfig.deleteToRecycleBin = value; PluginConfig.SaveConfig(); };

            var enableSongIcons = downloaderSubMenu.AddBool("Enable additional song icons");

            enableSongIcons.GetValue += delegate { return(PluginConfig.enableSongIcons); };
            enableSongIcons.SetValue += delegate(bool value) { PluginConfig.enableSongIcons = value; PluginConfig.SaveConfig(); };

            var maxSimultaneousDownloads = downloaderSubMenu.AddInt("Max simultaneous downloads", 1, 10, 1);

            maxSimultaneousDownloads.GetValue += delegate { return(PluginConfig.maxSimultaneousDownloads); };
            maxSimultaneousDownloads.SetValue += delegate(int value) { PluginConfig.maxSimultaneousDownloads = value; PluginConfig.SaveConfig(); };

            var fastScrollSpeed = downloaderSubMenu.AddInt("Fast scroll speed", 2, 20, 1);

            fastScrollSpeed.GetValue += delegate { return(PluginConfig.fastScrollSpeed); };
            fastScrollSpeed.SetValue += delegate(int value) { PluginConfig.fastScrollSpeed = value; PluginConfig.SaveConfig(); };

            _moreSongsButton = MenuButtonUI.AddButton("More songs", "Download more songs from BeatSaver.com!", BeatSaverButtonPressed);
            _moreSongsButton.interactable = SongLoader.AreSongsLoaded;

            MenuButtonUI.AddButton("More playlists", PlaylistsButtonPressed);

            if (moreSongsFlowCoordinator == null)
            {
                moreSongsFlowCoordinator = new GameObject("MoreSongsFlowCoordinator").AddComponent <MoreSongsFlowCoordinator>();
            }

            yield return(null);

            initialized = true;
        }
Пример #20
0
        private IEnumerator SetupUI()
        {
            if (initialized)
            {
                yield break;
            }

            var downloaderSubMenu = SettingsUI.CreateSubMenu("Downloader");

            var disableDeleteButton = downloaderSubMenu.AddBool("Disable delete button");

            disableDeleteButton.GetValue += delegate { return(PluginConfig.disableDeleteButton); };
            disableDeleteButton.SetValue += delegate(bool value) { PluginConfig.disableDeleteButton = value; PluginConfig.SaveConfig(); };

            var deleteToRecycleBin = downloaderSubMenu.AddBool("Delete to Recycle Bin");

            deleteToRecycleBin.GetValue += delegate { return(PluginConfig.deleteToRecycleBin); };
            deleteToRecycleBin.SetValue += delegate(bool value) { PluginConfig.deleteToRecycleBin = value; PluginConfig.SaveConfig(); };

            var enableSongIcons = downloaderSubMenu.AddBool("Enable additional song icons");

            enableSongIcons.GetValue += delegate { return(PluginConfig.enableSongIcons); };
            enableSongIcons.SetValue += delegate(bool value) { PluginConfig.enableSongIcons = value; PluginConfig.SaveConfig(); };

            var rememberLastPackAndSong = downloaderSubMenu.AddBool("Remember last pack and song");

            rememberLastPackAndSong.GetValue += delegate { return(PluginConfig.rememberLastPackAndSong); };
            rememberLastPackAndSong.SetValue += delegate(bool value) { PluginConfig.rememberLastPackAndSong = value; PluginConfig.SaveConfig(); };

            var maxSimultaneousDownloads = downloaderSubMenu.AddInt("Max simultaneous downloads", 1, 10, 1);

            maxSimultaneousDownloads.GetValue += delegate { return(PluginConfig.maxSimultaneousDownloads); };
            maxSimultaneousDownloads.SetValue += delegate(int value) { PluginConfig.maxSimultaneousDownloads = value; PluginConfig.SaveConfig(); };

            var fastScrollSpeed = downloaderSubMenu.AddInt("Fast scroll speed", 2, 20, 1);

            fastScrollSpeed.GetValue += delegate { return(PluginConfig.fastScrollSpeed); };
            fastScrollSpeed.SetValue += delegate(int value) { PluginConfig.fastScrollSpeed = value; PluginConfig.SaveConfig(); };

            _moreSongsButton = MenuButtonUI.AddButton("More songs", "Download more songs from BeatSaver.com!", BeatSaverButtonPressed);
            //bananbread songloader loaded menubutton
            _moreSongsButton.interactable = SongCore.Loader.AreSongsLoaded;

            MenuButtonUI.AddButton("More playlists", PlaylistsButtonPressed);

            yield return(null);

            initialized = true;
        }
Пример #21
0
        private void SceneManager_sceneLoaded(Scene scene, LoadSceneMode arg1)
        {
            if (scene.name == "Menu")
            {
                var subMenuCC = SettingsUI.CreateSubMenu("Songloader");

                var colorOverrideOption = subMenuCC.AddBool("Allow Custom Song Colors");
                colorOverrideOption.GetValue += delegate { return(ModPrefs.GetBool("Songloader", "customSongColors", true, true)); };
                colorOverrideOption.SetValue += delegate(bool value) { ModPrefs.SetBool("Songloader", "customSongColors", value); };

                var platformOverrideOption = subMenuCC.AddBool("Allow Custom Song Platforms");
                platformOverrideOption.GetValue += delegate { return(ModPrefs.GetBool("Songloader", "customSongPlatforms", true, true)); };
                platformOverrideOption.SetValue += delegate(bool value) { ModPrefs.SetBool("Songloader", "customSongPlatforms", value); };
            }
        }
Пример #22
0
        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;
            };
        }
Пример #23
0
        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;
                };
            }
        }
Пример #24
0
        public static void OnLoad()
        {
            //MenuButtonUI.AddButton("Mod Updater", () => { ModUpdater.Instance.ModUpdaterMenu.Present(); });

            var menu         = SettingsUI.CreateSubMenu("SyncSaber");
            var autoDownload = menu.AddBool("Auto-Download Songs", "Determines if SyncSaber should download new songs or just add them to the SyncSaber playlist.");

            autoDownload.GetValue += () => { return(Config.AutoDownloadSongs); };
            autoDownload.SetValue += (value) => { Config.AutoDownloadSongs = value; Config.Write(); };

            var autoUpdate = menu.AddBool("Auto-Update Songs", "Determines if SyncSaber should update songs when you select them in the song list.");

            autoUpdate.GetValue += () => { return(Config.AutoUpdateSongs); };
            autoUpdate.SetValue += (value) => { Config.AutoUpdateSongs = value; Config.Write(); };

            var deleteOldVersions = menu.AddBool("Delete Old Songs", "Determines if SyncSaber should delete old versions of songs when auto-updating.");

            deleteOldVersions.GetValue += () => { return(Config.DeleteOldVersions); };
            deleteOldVersions.SetValue += (value) => { Config.DeleteOldVersions = value; Config.Write(); };

            var beastSaberUsername = menu.AddString("Beast Saber Username", "Your username from www.bsaber.com. Note: Only required if you want SyncSaber to automatically download content from the feeds listed below.");

            beastSaberUsername.GetValue += () => { return(Config.BeastSaberUsername); };
            beastSaberUsername.SetValue += (username) => { Config.BeastSaberUsername = username; Config.Write(); };

            var downloadBookmarksFeed = menu.AddBool("Bookmarks Feed", "Determines if SyncSaber should download your BeastSaber bookmarks feed.");

            downloadBookmarksFeed.GetValue    += () => { return(Config.SyncBookmarksFeed); };
            downloadBookmarksFeed.SetValue    += (value) => { Config.SyncBookmarksFeed = value; Config.Write(); };
            downloadBookmarksFeed.EnabledText  = "Sync";
            downloadBookmarksFeed.DisabledText = "Don't Sync";

            var downloadFollowingsFeed = menu.AddBool("Followings Feed", "Determines if SyncSaber should download your BeastSaber followings feed.");

            downloadFollowingsFeed.GetValue    += () => { return(Config.SyncFollowingsFeed); };
            downloadFollowingsFeed.SetValue    += (value) => { Config.SyncFollowingsFeed = value; Config.Write(); };
            downloadFollowingsFeed.EnabledText  = "Sync";
            downloadFollowingsFeed.DisabledText = "Don't Sync";

            var downloadCuratorRecommendedFeed = menu.AddBool("Curator Recommended Feed", "Determines if SyncSaber should download the BeastSaber curator recommended feed.");

            downloadCuratorRecommendedFeed.GetValue    += () => { return(Config.SyncCuratorRecommendedFeed); };
            downloadCuratorRecommendedFeed.SetValue    += (value) => { Config.SyncCuratorRecommendedFeed = value; Config.Write(); };
            downloadCuratorRecommendedFeed.EnabledText  = "Sync";
            downloadCuratorRecommendedFeed.DisabledText = "Don't Sync";
        }
Пример #25
0
        /// <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}'");
            };
        }
Пример #26
0
        public static void CreateSettingsUI()
        {
            var subMenu = SettingsUI.CreateSubMenu("AutoPause");

            var en = subMenu.AddBool("AutoPause Enabled");

            en.GetValue += delegate { return(ModPrefs.GetBool("Auros's AutoPause", "Enabled", true, true)); };
            en.SetValue += delegate(bool value) { ModPrefs.SetBool("Auros's AutoPause", "Enabled", value); };

            var pq = subMenu.AddBool("FPS Pause");

            pq.GetValue += delegate { return(ModPrefs.GetBool("Auros's AutoPause", "FPSCheckerOn", false, true)); };
            pq.SetValue += delegate(bool value) { ModPrefs.SetBool("Auros's AutoPause", "FPSCheckerOn", value); };

            float[] fpsValues    = { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90 };
            var     fpsThreshold = subMenu.AddList("FPS Threshold", fpsValues);

            fpsThreshold.GetValue    += delegate { return(ModPrefs.GetFloat("Auros's AutoPause", "FPSThreshold", 40, true)); };
            fpsThreshold.SetValue    += delegate(float value) { ModPrefs.SetFloat("Auros's AutoPause", "FPSThreshold", value); };
            fpsThreshold.FormatValue += delegate(float value) { return(string.Format("{0:0}", value)); };
        }
Пример #27
0
        private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
        {
            if (arg0.name == "MenuCore")
            {
                Gamemode.Init();
                modEnable = false;
                var settingsSubmenu = SettingsUI.CreateSubMenu("AutoPause");
                var modenabled      = settingsSubmenu.AddBool("AutoPause Enabled");
                modenabled.GetValue += delegate { return(ModPrefs.GetBool("AutoPause | Main", "Enabled", true, true)); };
                modenabled.SetValue += delegate(bool value) { ModPrefs.SetBool("AutoPause | Main", "Enabled", value); };

                var pausebool = settingsSubmenu.AddBool("FPS Pause");
                pausebool.GetValue += delegate { return(ModPrefs.GetBool("AutoPause | Main", "FPSCheckerOn", false, true)); };
                pausebool.SetValue += delegate(bool value) { ModPrefs.SetBool("AutoPause | Main", "FPSCheckerOn", value); };

                var voices = settingsSubmenu.AddBool("Voices");
                voices.GetValue += delegate { return(ModPrefs.GetBool("AutoPause | Main", "Voices", true, true)); };
                voices.SetValue += delegate(bool value) { ModPrefs.SetBool("AutoPause | Main", "Voices", value); };

                float[] fpsValues    = { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90 };
                var     fpsThreshold = settingsSubmenu.AddList("FPS Threshold", fpsValues);
                fpsThreshold.GetValue    += delegate { return(ModPrefs.GetFloat("AutoPause | Main", "FPSThreshold", 40, true)); };
                fpsThreshold.SetValue    += delegate(float value) { ModPrefs.SetFloat("AutoPause | Main", "FPSThreshold", value); };
                fpsThreshold.FormatValue += delegate(float value) { return(string.Format("{0:0}", value)); };

                var reaction = settingsSubmenu.AddList("Reaction Time", numnums);
                reaction.GetValue    += delegate { return(ModPrefs.GetFloat("AutoPause | Main", "ResponseTime", .2f, true)); };
                reaction.SetValue    += delegate(float value) { ModPrefs.SetFloat("AutoPause | Main", "ResponseTime", value); };
                reaction.FormatValue += delegate(float value) { return(string.Format("{0:0.00}", value)); };

                Log.AutoPause("Settings Created");
            }

            if (arg0.name == "MenuCore" && firstTime == true)
            {
                firstTime = false;
                TextObject.OnLoad();
                ///Despacito 2
            }
        }
Пример #28
0
        //public static string full = "Full (default)";
        //public static string warm = "Warm";
        //public static string cool = "Cool";
        //public static string pastel = "Pastel";
        //public static string dark = "Dark";

        //I'll add support for all of this eventually -Auros, good start tho

        //public enum Spectrums
        //{
        //    full,
        //    warm,
        //    cool,
        //    pastel,
        //    dark
        //};
        private void OnSceneLoaded(Scene scene, LoadSceneMode arg1)
        {
            if (scene.name == "MenuCore" && isChromaInstalled == false)
            {
                //Settings Menu Setup
                var subMenuCC   = SettingsUI.CreateSubMenu("Rainbow Lighting");
                var disableMenu = subMenuCC.AddBool("Enabled");
                disableMenu.GetValue    += delegate { return(ModPrefs.GetBool("RainbowLighting", "Enabled", true, true)); };
                disableMenu.SetValue    += delegate(bool value) { enabled = value; ModPrefs.SetBool("RainbowLighting", "Enabled", value); };
                disableMenu.EnabledText  = "ON";
                disableMenu.DisabledText = "OFF";
                //var spectrumSelect = subMenuCC.AddList("Spectrum", new float[1] { 0 });
                //spectrumSelect.FormatValue += delegate (float value) { return Spectrums[(int)value]; };
                //TO DO: actual spectrum select

                //PlayerSettings Toggle
                Sprite icon          = UIUtilities.LoadSpriteFromResources("RainbowLighting.Resources.icon.png");
                var    disableOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.PlayerSettingsRight, "Rainbow Lighting", "MainMenu", "Enable Rainbow Lighting", icon);
                disableOption.GetValue  = ModPrefs.GetBool("RainbowLighting", "Enabled", true, true);
                disableOption.OnToggle += (value) => { enabled = value; ModPrefs.SetBool("RainbowLighting", "Enabled", value); };
            }
        }
Пример #29
0
        public static void OnLoad()
        {
            var menu        = SettingsUI.CreateSubMenu("Enhanced Twitch Chat");
            var channelName = menu.AddString("Twitch Channel Name", "The name of the channel you want Enhanced Twitch Chat to monitor");

            channelName.SetValue += (channel) => { Config.Instance.TwitchChannelName = channel; };
            channelName.GetValue += () => { return(Config.Instance.TwitchChannelName); };

            var fontName = menu.AddString("Menu Font Name", "The name of the system font you want to use for the chat. This can be any font you've installed on your computer!");

            fontName.SetValue += (font) => { Config.Instance.FontName = font; };
            fontName.GetValue += () => { return(Config.Instance.FontName); };

            var chatScale = menu.AddList("Chat Scale", incrementValues(0, 0.1f, 51), "The size of text and emotes in the chat.");

            chatScale.SetValue    += (scale) => { Config.Instance.ChatScale = scale; };
            chatScale.GetValue    += () => { return(Config.Instance.ChatScale); };
            chatScale.FormatValue += (value) => { return(value.ToString()); };

            var chatWidth = menu.AddInt("Chat Width", "The width of the chat.", 100, int.MaxValue, 10);

            chatWidth.SetValue += (width) => { Config.Instance.ChatWidth = width; };
            chatWidth.GetValue += () => { return((int)Config.Instance.ChatWidth); };

            var reverseChatOrder = menu.AddBool("Reverse Chat Order", "Makes the chat scroll from top to bottom instead of bottom to top.");

            reverseChatOrder.SetValue += (order) => { Config.Instance.ReverseChatOrder = order; };
            reverseChatOrder.GetValue += () => { return(Config.Instance.ReverseChatOrder); };

            var songRequestsEnabled = menu.AddBool("Song Request Bot", "Enables song requests in chat! Click the \"Next Request\" button in the top right corner of your song list to move onto the next request!\r\n\r\n<size=60%>Use <b>!request <beatsaver-id></b> or <b>!request <song name></b> to request songs!</size>");

            songRequestsEnabled.SetValue += (requests) => { Config.Instance.SongRequestBot = requests; };
            songRequestsEnabled.GetValue += () => { return(Config.Instance.SongRequestBot); };

            var animatedEmotes = menu.AddBool("Animated Emotes", "Enables animated BetterTwitchTV/FrankerFaceZ/Cheermotes in the chat. When disabled, these emotes will still appear but will not be animated.");

            animatedEmotes.SetValue += (animted) => { Config.Instance.AnimatedEmotes = animted; };
            animatedEmotes.GetValue += () => { return(Config.Instance.AnimatedEmotes); };
        }
Пример #30
0
        public static void CreateSettingsUI()
        {
            //This will create a menu tab in the settings menu for your plugin
            var pluginSettingsSubmenu = SettingsUI.CreateSubMenu("Light Serial Output");

            var enabled = pluginSettingsSubmenu.AddBool("Enabled");

            //Fetch your initial value for the option from within the braces, or simply have it default to a value
            enabled.GetValue += delegate { return(Config.enabled); };
            enabled.SetValue += delegate(bool value) { Config.enabled = value; };

            var chroma = pluginSettingsSubmenu.AddBool("Chroma/lite support");

            chroma.GetValue += delegate { return(Config.chroma); };
            chroma.SetValue += delegate(bool value) { Config.chroma = value; };


            var ComPort = pluginSettingsSubmenu.AddInt("Com port", 1, 256, 1);

            ComPort.GetValue += delegate { return(Config.comPort); };
            ComPort.SetValue += delegate(int value) { Config.comPort = value; };

            var BaudRate = pluginSettingsSubmenu.AddString("Baud rate", "The Baud rate for the serial signal (Must be a intenger).");

            BaudRate.GetValue += delegate { return(Config.baudRate.ToString()); };
            BaudRate.SetValue += delegate(string value) {
                int x = 0;

                if (Int32.TryParse(value, out x))
                {
                    Config.baudRate = x;
                }
                else
                {
                    Config.baudRate = 250000;
                }
            };
        }