コード例 #1
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));
                };
            }
        }
コード例 #2
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!");
            }
        }
コード例 #3
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;
                };
            }
        }
コード例 #4
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);
                }
            };
        }
コード例 #5
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;
            };
        }
コード例 #6
0
        public static void CreateBeastSaberSettingsUI(SubMenu parent, BeastSaberConfig sourceConfig)
        {
            string sourceName = "BeastSaber";

            CreateSourceSettings(sourceName, parent, sourceConfig);
            var maxConcurrentPageChecks = parent.AddInt("Max Concurrent Page Checks",
                                                        $"How many {sourceName} pages to check at the same time.",
                                                        1, 15, 1);

            maxConcurrentPageChecks.GetValue += delegate { return(sourceConfig.MaxConcurrentPageChecks); };
            maxConcurrentPageChecks.SetValue += delegate(int value)
            {
                if (sourceConfig.MaxConcurrentPageChecks == value)
                {
                    return;
                }
                sourceConfig.MaxConcurrentPageChecks = value;
                // Config.ConfigChanged = true;
            };

            var username = parent.AddString("Username", "Your BeastSaber username. Required to use the Bookmarks and Follows feeds");

            username.GetValue += delegate { return(sourceConfig.Username ?? ""); };
            username.SetValue += delegate(string value)
            {
                if (sourceConfig.Username == value)
                {
                    return;
                }
                sourceConfig.Username = value;
                // Config.ConfigChanged = true;
            };

            var bookmarks = CreateFeedSettings("Bookmarks", sourceName, sourceConfig.Bookmarks, parent);
            var follows   = CreateFeedSettings("Follows", sourceName, sourceConfig.Follows, parent);
            var curator   = CreateFeedSettings("Curator Recommended", sourceName, sourceConfig.CuratorRecommended, parent);
        }
コード例 #7
0
        public static void CreateBeatSaverSettingsUI(SubMenu parent, BeatSaverConfig sourceConfig)
        {
            string sourceName = "BeatSaver";

            CreateSourceSettings(sourceName, parent, sourceConfig);
            var maxConcurrentPageChecks = parent.AddInt("Max Concurrent Page Checks",
                                                        $"How many {sourceName} pages to check at the same time.",
                                                        1, 15, 1);

            maxConcurrentPageChecks.GetValue += delegate { return(sourceConfig.MaxConcurrentPageChecks); };
            maxConcurrentPageChecks.SetValue += delegate(int value)
            {
                if (sourceConfig.MaxConcurrentPageChecks == value)
                {
                    return;
                }
                sourceConfig.MaxConcurrentPageChecks = value;
                // Config.ConfigChanged = true;
            };

            var favoriteMappers         = CreateFeedSettings("Favorite Mappers", sourceName, sourceConfig.FavoriteMappers, parent, "Feed to get songs from mappers listed in UserData\\FavoriteMappers.ini. Max Songs is per mapper.");
            var separateMapperPlaylists = favoriteMappers.AddBool("Separate Mapper Playlists",
                                                                  $"Create a playlist for each mapper in FavoriteMappers.ini (must also have CreatePlaylist enabled).");

            separateMapperPlaylists.GetValue += delegate { return(sourceConfig.FavoriteMappers.SeparateMapperPlaylists); };
            separateMapperPlaylists.SetValue += delegate(bool value)
            {
                if (sourceConfig.FavoriteMappers.SeparateMapperPlaylists == value)
                {
                    return;
                }
                sourceConfig.FavoriteMappers.SeparateMapperPlaylists = value;
            };
            var hot       = CreateFeedSettings("Hot", sourceName, sourceConfig.Hot, parent);
            var downloads = CreateFeedSettings("Downloads", sourceName, sourceConfig.Downloads, parent);
        }
コード例 #8
0
        public static void Settings()
        {
            SubMenu            befitSettings = SettingsUI.CreateSubMenu("BeFit Settings");
            BoolViewController pluginEnabled = befitSettings.AddBool("Plugin Enabled?");

            pluginEnabled.GetValue += delegate {
                return(Plugin.Instance.mainConfig.BeFitPluginEnabled);
            };
            pluginEnabled.SetValue += delegate(bool plug) {
                Plugin.Instance.mainConfig.BeFitPluginEnabled = plug;
            };
            IntViewController calCountAccuracy = befitSettings.AddInt("FPS Drop Reduction ", 1, 65, 1);

            calCountAccuracy.GetValue += delegate {
                return(Plugin.Instance.mainConfig.calorieCounterAccuracy);
            };
            calCountAccuracy.SetValue += delegate(int acc) {
                Plugin.Instance.mainConfig.calorieCounterAccuracy = acc;
            };

            BoolViewController viewInGame = befitSettings.AddBool("Show Calories In Game");

            viewInGame.GetValue += delegate {
                return(Plugin.Instance.mainConfig.inGameCaloriesDisplay);
            };
            viewInGame.SetValue += delegate(bool dcig) {
                Plugin.Instance.mainConfig.inGameCaloriesDisplay = dcig;
            };

            BoolViewController viewCurrent = befitSettings.AddBool("Show Current Session Calories");

            viewCurrent.GetValue += delegate {
                return(Plugin.Instance.mainConfig.sessionCaloriesDisplay);
            };
            viewCurrent.SetValue += delegate(bool csv) {
                Plugin.Instance.mainConfig.sessionCaloriesDisplay = csv;
                MenuDisplay.visibleCurrentCalories = csv;
            };

            BoolViewController viewDaily = befitSettings.AddBool("Show Daily Calories");

            viewDaily.GetValue += delegate {
                return(Plugin.Instance.mainConfig.dailyCaloriesDisplay);
            };
            viewDaily.SetValue += delegate(bool dcv) {
                Plugin.Instance.mainConfig.dailyCaloriesDisplay = dcv;
                MenuDisplay.visibleDailyCalories = dcv;
            };

            BoolViewController viewLife = befitSettings.AddBool("Show All Calories");

            viewLife.GetValue += delegate {
                return(Plugin.Instance.mainConfig.lifeCaloriesDisplay);
            };
            viewLife.SetValue += delegate(bool lcv) {
                Plugin.Instance.mainConfig.lifeCaloriesDisplay = lcv;
                MenuDisplay.visibleLifeCalories = lcv;
            };
            BoolViewController viewLast = befitSettings.AddBool("Show Last Song Calories");

            viewLast.GetValue += delegate {
                return(Plugin.Instance.mainConfig.lastGameCaloriesDisplay);
            };
            viewLast.SetValue += delegate(bool lgv) {
                Plugin.Instance.mainConfig.lastGameCaloriesDisplay = lgv;
                MenuDisplay.visibleLastGameCalories = lgv;
            };
        }
コード例 #9
0
        public static void CreateBeatSyncSettingsUI(SubMenu parent)
        {
            var timeoutInt = parent.AddInt("Download Timeout",
                                           "How long in seconds to wait for Beat Saver to respond to a download request",
                                           5, 60, 1);

            timeoutInt.GetValue += delegate { return(Config.DownloadTimeout); };
            timeoutInt.SetValue += delegate(int value)
            {
                if (Config.DownloadTimeout == value)
                {
                    return;
                }
                Config.DownloadTimeout = value;
                //Config.SetConfigChanged();
            };

            var maxConcurrentDownloads = parent.AddInt("Max Concurrent Downloads",
                                                       "How many song downloads can happen at the same time.",
                                                       1, 10, 1);

            maxConcurrentDownloads.GetValue += delegate { return(Config.MaxConcurrentDownloads); };
            maxConcurrentDownloads.SetValue += delegate(int value)
            {
                if (Config.MaxConcurrentDownloads == value)
                {
                    return;
                }
                Config.MaxConcurrentDownloads = value;
                // Config.ConfigChanged = true;
            };

            var recentPlaylistDays = parent.AddInt("Recent Playlist Days",
                                                   "How long in days songs downloaded by BeatSync are kept in the BeatSync Recent playlist (0 to disable the playlist).",
                                                   0, 60, 1);

            recentPlaylistDays.GetValue += delegate { return(Config.RecentPlaylistDays); };
            recentPlaylistDays.SetValue += delegate(int value)
            {
                if (Config.RecentPlaylistDays == value)
                {
                    return;
                }
                Config.RecentPlaylistDays = value;
                // Config.ConfigChanged = true;
            };

            var allBeatSyncSongs = parent.AddBool("Enable All BeatSync Songs",
                                                  "Maintain a playlist that has all the songs downloaded by BeatSync.");

            allBeatSyncSongs.GetValue += delegate { return(Config.AllBeatSyncSongsPlaylist); };
            allBeatSyncSongs.SetValue += delegate(bool value)
            {
                if (Config.AllBeatSyncSongsPlaylist == value)
                {
                    return;
                }
                Config.AllBeatSyncSongsPlaylist = value;
                // Config.ConfigChanged = true;
            };

            var timeBetweenSyncs = parent.AddSubMenu("Time Between Syncs",
                                                     "Minimum amount of time between BeatSync syncs (Set both to 0 to run BeatSync every time the game is started).", true);
            var hours = timeBetweenSyncs.AddInt("Hours", "Number of hours between BeatSync syncs.", 0, 100, 1);

            hours.GetValue += delegate { return(Config.TimeBetweenSyncs.Hours); };
            hours.SetValue += delegate(int value)
            {
                if (Config.TimeBetweenSyncs.Hours == value)
                {
                    return;
                }
                Config.TimeBetweenSyncs.Hours = value;
                // Config.ConfigChanged = true;
            };

            var minutes = timeBetweenSyncs.AddInt("Minutes", "Number of minutes between BeatSync syncs.", 0, 59, 1);

            minutes.GetValue += delegate { return(Config.TimeBetweenSyncs.Minutes); };
            minutes.SetValue += delegate(int value)
            {
                if (Config.TimeBetweenSyncs.Minutes == value)
                {
                    return;
                }
                Config.TimeBetweenSyncs.Minutes = value;
                // Config.ConfigChanged = true;
            };
        }