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"; }
private static void CreateSettingsUI() { var subMenu = SettingsUI.CreateSubMenu("Platforms"); var feetMenu = subMenu.AddBool("Always Show Feet"); feetMenu.GetValue += delegate { return(PlatformManager.Instance.envHider.showFeetOverride); }; feetMenu.SetValue += delegate(bool value) { PlatformManager.Instance.envHider.showFeetOverride = value; ModPrefs.SetBool(CustomFloorPlugin.PluginName, "AlwaysShowFeet", PlatformManager.Instance.envHider.showFeetOverride); }; var environment = subMenu.AddList("Environment Override", EnvironmentSceneOverrider.OverrideModes()); environment.GetValue += delegate { return((float)EnvironmentSceneOverrider.overrideMode); }; environment.SetValue += delegate(float value) { EnvironmentSceneOverrider.overrideMode = (EnvironmentSceneOverrider.EnvOverrideMode)value; EnvironmentSceneOverrider.OverrideEnvironmentScene(); ModPrefs.SetInt(CustomFloorPlugin.PluginName, "EnvironmentOverrideMode", (int)EnvironmentSceneOverrider.overrideMode); }; environment.FormatValue += delegate(float value) { return(EnvironmentSceneOverrider.Name((EnvironmentSceneOverrider.EnvOverrideMode)value)); }; }
private void CheckForUserDataFolder() { string userDataPath = Environment.CurrentDirectory + "/UserData"; if (!Directory.Exists(userDataPath)) { Directory.CreateDirectory(userDataPath); } if ("".Equals(ModPrefs.GetString(PluginName, KeyDarthMode, ""))) { ModPrefs.SetBool(PluginName, KeyDarthMode, false); } if ("".Equals(ModPrefs.GetString(PluginName, KeyOneHanded, ""))) { ModPrefs.SetBool(PluginName, KeyOneHanded, false); } if ("".Equals(ModPrefs.GetString(PluginName, KeyAutoDetect, ""))) { ModPrefs.SetBool(PluginName, KeyAutoDetect, false); } if ("".Equals(ModPrefs.GetString(PluginName, KeySeparation, ""))) { ModPrefs.SetInt(PluginName, KeySeparation, 15); } }
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)); }; } }
public static void Write() { ModPrefs.SetBool("SyncSaber", "AutoDownloadSongs", AutoDownloadSongs); ModPrefs.SetBool("SyncSaber", "AutoUpdateSongs", AutoUpdateSongs); ModPrefs.SetString("SyncSaber", "BeastSaberUsername", BeastSaberUsername); ModPrefs.SetInt("SyncSaber", "MaxBeastSaberPages", MaxBeastSaberPages); ModPrefs.SetBool("SyncSaber", "DeleteOldVersions", DeleteOldVersions); }
public void Reset(string cameraName, Params resetParams) { ModPrefs.SetFloat(SECTIONBASE + "!" + cameraName, "BaseColorBoost", resetParams.baseColorBoost); ModPrefs.SetFloat(SECTIONBASE + "!" + cameraName, "BaseColorBoostThreshold", resetParams.baseColorBoostThreshold); ModPrefs.SetFloat(SECTIONBASE + "!" + cameraName, "BloomIntensity", resetParams.bloomIntensity); ModPrefs.SetInt(SECTIONBASE + "!" + cameraName, "BloomIterations", resetParams.bloomIterations); ModPrefs.SetFloat(SECTIONBASE + "!" + cameraName, "TextureWidth", resetParams.textureWidth); }
public static void SaveConfig() { File.WriteAllText(votedSongsPath, JsonConvert.SerializeObject(votedSongs, Formatting.Indented), Encoding.UTF8); File.WriteAllLines(configPath, favoriteSongs.Distinct().ToArray(), Encoding.UTF8); ModPrefs.SetBool("BeatSaverDownloader", "disableDeleteButton", disableDeleteButton); ModPrefs.SetBool("BeatSaverDownloader", "deleteToRecycleBin", deleteToRecycleBin); ModPrefs.SetInt("BeatSaverDownloader", "maxSimultaneousDownloads", maxSimultaneousDownloads); }
public void OnApplicationStart() { ModPrefs.SetString(alias, "version", "v " + Version.ToString()); ModPrefs.SetInt(alias, "sessionCalories", 0); Console.WriteLine(modLog + "Current Date: " + DateTime.Now.ToString("dd.MM.yyyy")); Console.WriteLine(modLog + Name + " " + Version); SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged; SceneManager.sceneLoaded += SceneManager_sceneLoaded; }
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); }; }
public static void SaveConfig() { ModPrefs.SetBool("BeatSaberDrinkWater", "EnablePlugin", EnablePlugin); ModPrefs.SetBool("BeatSaberDrinkWater", "ShowGIFs", ShowGIFs); ModPrefs.SetInt("BeatSaberDrinkWater", "WaitDuration", WaitDuration); ModPrefs.SetBool("BeatSaberDrinkWater", "EnableByPlaytime", EnableByPlaytime); ModPrefs.SetBool("BeatSaberDrinkWater", "EnableByPlaycount", EnableByPlaycount); ModPrefs.SetInt("BeatSaberDrinkWater", "PlaytimeBeforeWarning", PlaytimeBeforeWarning); ModPrefs.SetInt("BeatSaberDrinkWater", "PlaycountBeforeWarning", PlaycountBeforeWarning); }
void FixDiffOrder() { if (maxDiff < minDiff) { var temp = minDiff; minDiff = maxDiff; maxDiff = temp; ModPrefs.SetInt(Plugin.PluginName, minDiffSetting, (int)minDiff); ModPrefs.SetInt(Plugin.PluginName, maxDiffSetting, (int)maxDiff); } }
public static void Save() { ModPrefs.SetBool(PrefsSection, "Enabled", DisplayLyrics); ModPrefs.SetInt(PrefsSection, nameof(ToggleKeyCode), ToggleKeyCode); ModPrefs.SetFloat(PrefsSection, nameof(DisplayDelay), DisplayDelay); ModPrefs.SetFloat(PrefsSection, nameof(HideDelay), HideDelay); if (VerboseLogging) { ModPrefs.SetBool(PrefsSection, nameof(VerboseLogging), true); } }
public void OnApplicationStart() { ModPrefs.SetString("fitNessMod", "version", "v " + Version.ToString()); ModPrefs.SetInt("fitNessMod", "sessionCalories", 0); Console.WriteLine("[fitNessMod | LOG] Current Session Cals set to 0!"); Console.WriteLine("[fitNessMod | LOG] Daily Calories loaded: " + dailyCalories); Console.WriteLine("[fitNessMod | LOG] Life of Mod Calories : " + lifeCalories); Console.WriteLine("[fitNessMod | LOG] Current Date: " + DateTime.Now.ToString("dd.MM.yyyy")); Console.WriteLine("[fitNessMod | LOG] Last Burn Date: " + rdCals); Console.WriteLine("[fitNessMod | LOG] Loaded!"); SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged; SceneManager.sceneLoaded += SceneManager_sceneLoaded; }
public static void Write() { ModPrefs.SetBool(Plugin.Instance.Name, "AutoDownloadSongs", AutoDownloadSongs); ModPrefs.SetBool(Plugin.Instance.Name, "AutoUpdateSongs", AutoUpdateSongs); ModPrefs.SetString(Plugin.Instance.Name, "BeastSaberUsername", BeastSaberUsername); ModPrefs.SetBool(Plugin.Instance.Name, "DeleteOldVersions", DeleteOldVersions); ModPrefs.SetBool(Plugin.Instance.Name, "SyncBookmarksFeed", SyncBookmarksFeed); ModPrefs.SetBool(Plugin.Instance.Name, "SyncCuratorRecommendedFeed", SyncCuratorRecommendedFeed); ModPrefs.SetBool(Plugin.Instance.Name, "SyncFollowingsFeed", SyncFollowingsFeed); ModPrefs.SetInt(Plugin.Instance.Name, "MaxBookmarksPages", MaxBookmarksPages); ModPrefs.SetInt(Plugin.Instance.Name, "MaxCuratorRecommendedPages", MaxCuratorRecommendedPages); ModPrefs.SetInt(Plugin.Instance.Name, "MaxFollowingsPages", MaxFollowingsPages); }
private void ScreenWasMoved(Vector3 pos, Quaternion rot, float scale) { screen.transform.position = pos; screen.transform.rotation = rot; screen.transform.localScale = scale * Vector3.one; ModPrefs.SetString(Plugin.PluginName, "CustomPosition", pos.ToString()); ModPrefs.SetString(Plugin.PluginName, "CustomRotation", rot.eulerAngles.ToString()); ModPrefs.SetFloat(Plugin.PluginName, "CustomScale", scale); placement = VideoPlacement.Custom; ModPrefs.SetInt(Plugin.PluginName, "ScreenPositionMode", (int)placement); }
void OnDestroy() { MenuDisplay.countLGC.text = lvlData.difficultyBeatmap.level.songName; MenuDisplay.labelLG.text = "Last Played Song"; MenuDisplay.lgcText.text = (calories).ToString(); MenuDisplay.cscText.text = (currentSessionCals + calories).ToString(); MenuDisplay.lcText.text = (lifeCalories + calories).ToString(); MenuDisplay.dcText.text = (dailyCalories + calories).ToString(); ModPrefs.SetInt("fitNessMod", "lifeCalories", lifeCalories + calories); ModPrefs.SetInt("fitNessMod", "dailyCalories", dailyCalories + calories); ModPrefs.SetInt("fitNessMod", "sessionCalories", currentSessionCals + calories); Console.WriteLine("[fitNessMod | LOG] Current Calories: " + ModPrefs.GetInt("fitNessMod", "sessionCalories", 0, true)); saberRating.noteWasCutEvent -= onNoteCut; saberRating.noteWasMissedEvent -= onNoteMiss; }
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; }; }
private void CreatUI() { var subMenu = SettingsUI.CreateSubMenu("Random Song"); var min = subMenu.AddList("Min Song Difficulty", Difficulties()); min.GetValue += delegate { return((float)minDiff); }; min.SetValue += delegate(float value) { minDiff = (LevelDifficulty)value; ModPrefs.SetInt(Plugin.PluginName, minDiffSetting, (int)minDiff); }; min.FormatValue += delegate(float value) { return(LevelDifficultyMethods.Name((LevelDifficulty)value)); }; var max = subMenu.AddList("Max Song Difficulty", Difficulties()); max.GetValue += delegate { return((float)maxDiff); }; max.SetValue += delegate(float value) { maxDiff = (LevelDifficulty)value; ModPrefs.SetInt(Plugin.PluginName, maxDiffSetting, (int)maxDiff); }; max.FormatValue += delegate(float value) { return(LevelDifficultyMethods.Name((LevelDifficulty)value)); }; var exclude = subMenu.AddBool("Exclude Standard Songs"); exclude.GetValue += delegate { return(excludeStandard); }; exclude.SetValue += delegate(bool value) { excludeStandard = value; ModPrefs.SetBool(Plugin.PluginName, excludeStandardSetting, excludeStandard); }; var autoPlayMenu = subMenu.AddBool("Auto Play"); autoPlayMenu.GetValue += delegate { return(autoPlay); }; autoPlayMenu.SetValue += delegate(bool value) { autoPlay = value; ModPrefs.SetBool(Plugin.PluginName, autoPlaySetting, autoPlay); }; }
public MirrorHelper() { shortcut = ModPrefs.GetString("MirrorHelper", "Shortcut", "F6", true); texturesize = ModPrefs.GetInt("MirrorHelper", "Resolution", 2048, true); clipplaneoffset = ModPrefs.GetFloat("MirrorHelper", "ClipPlaneOffset", 0, true); if (texturesize <= 1024) { texturesize = 1024; } else if (texturesize <= 2048) { texturesize = 2048; } else { texturesize = 4096; } ModPrefs.SetInt("MirrorHelper", "Resolution", texturesize); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////// private void OnDestroy() { int calories = (int)totalCaloriesBurnt; headvelocityCoefficient = null; METSVALShead = null; handvelocityCoefficient = null; METSVALShands = null; MenuDisplay.countLGC.text = lvlData.difficultyBeatmap.level.songName; MenuDisplay.labelLG.text = "Last Played Song"; MenuDisplay.lgcText.text = (calories).ToString(); MenuDisplay.cscText.text = (currentSessionCals + calories).ToString(); MenuDisplay.lcText.text = (lifeCalories + calories).ToString(); MenuDisplay.dcText.text = (dailyCalories + calories).ToString(); ModPrefs.SetInt(Plugin.alias, "lifeCalories", lifeCalories + calories); ModPrefs.SetInt(Plugin.alias, "dailyCalories", dailyCalories + calories); ModPrefs.SetInt(Plugin.alias, "sessionCalories", currentSessionCals + calories); //Console.WriteLine(Plugin.modLog + "Current Calories: " + ModPrefs.GetInt("fitNessMod", "sessionCalories", 0, true)); }
private void CheckForUserDataFolder() { string userDataPath = Environment.CurrentDirectory + "/UserData"; if (!Directory.Exists(userDataPath)) { Directory.CreateDirectory(userDataPath); } if ("".Equals(ModPrefs.GetString(Plugin.PluginName, Plugin.KeyOneColorMode, ""))) { ModPrefs.SetBool(Plugin.PluginName, Plugin.KeyOneColorMode, true); } if ("".Equals(ModPrefs.GetString(Plugin.PluginName, Plugin.KeyColorBuleOrRed, ""))) { ModPrefs.SetBool(Plugin.PluginName, Plugin.KeyColorBuleOrRed, true); } if ("".Equals(ModPrefs.GetString(Plugin.PluginName, Plugin.KeyNoArrowModeRandLevel, ""))) { ModPrefs.SetInt(Plugin.PluginName, Plugin.KeyNoArrowModeRandLevel, 2); } }
public static void CreateSettingsUI() { var subMenuCC = SettingsUI.CreateSubMenu("Custom Colors"); //Saber Override Setting for Left menu var disableOption = subMenuCC.AddBool("Disable the Plugin"); disableOption.GetValue += delegate { return(ModPrefs.GetBool(Plugin.Name, "disablePlugin", false, true)); }; disableOption.SetValue += delegate(bool value) { if (value == true) { ModPrefs.SetBool(Plugin.Name, "disablePlugin", value); Plugin.disablePlugin = value; Plugin.queuedDisable = true; } if (value == false) { ModPrefs.SetBool(Plugin.Name, "disablePlugin", value); Plugin.disablePlugin = value; Plugin.queuedDisable = false; } }; var environmentColorsOption = subMenuCC.AddBool("Allow Color Overrides"); environmentColorsOption.GetValue += delegate { return(ModPrefs.GetBool(Plugin.Name, "allowEnvironmentColors", true, true)); }; environmentColorsOption.SetValue += delegate(bool value) { ModPrefs.SetBool(Plugin.Name, "allowEnvironmentColors", value); }; var saberOverrideL = subMenuCC.AddBool("Override Custom Saber Color"); saberOverrideL.GetValue += delegate { return(ModPrefs.GetBool(Plugin.Name, "OverrideCustomSabers", true, true)); }; saberOverrideL.SetValue += delegate(bool value) { ModPrefs.SetBool(Plugin.Name, "OverrideCustomSabers", value); }; bool saberTailorInstalled = CheckSaberTailor(); if (saberTailorInstalled == true) { //Trail adjustment if Saber Tailor is installed var SaberTrails = subMenuCC.AddInt("Trail Length", 0, 100, 1); SaberTrails.GetValue += delegate { return(ModPrefs.GetInt("SaberTailor", "TrailLength", 20, true)); }; SaberTrails.SetValue += delegate(int value) { ModPrefs.SetInt("SaberTailor", "TrailLength", (int)value); }; } //Light brightness float[] brightnessValues = new float[11] { 0, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f }; var Brightness = subMenuCC.AddList("Light Brightness", brightnessValues); Brightness.GetValue += delegate { return(ModPrefs.GetFloat(Plugin.Name, "Brightness", 1, true)); }; Brightness.SetValue += delegate(float value) { ModPrefs.SetFloat(Plugin.Name, "Brightness", value); }; Brightness.FormatValue += delegate(float value) { return(value.ToString()); }; var subMenuPresets = SettingsUI.CreateSubMenu("Color Settings"); float[] presetValues = new float[ColorPresets.Count]; for (int i = 0; i < ColorPresets.Count; i++) { presetValues[i] = i; } //Left Color Preset var leftPreset = subMenuPresets.AddList("Left Color Preset", presetValues); leftPreset.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "leftColorPreset", 0, true)); }; leftPreset.SetValue += delegate(float value) { ModPrefs.SetInt(Plugin.Name, "leftColorPreset", (int)value); }; leftPreset.FormatValue += delegate(float value) { return(ColorPresets[(int)value].Item2); }; //Right Color Preset var rightPreset = subMenuPresets.AddList("Right Color Preset", presetValues); rightPreset.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "rightColorPreset", 0, true)); }; rightPreset.SetValue += delegate(float value) { ModPrefs.SetInt(Plugin.Name, "rightColorPreset", (int)value); }; rightPreset.FormatValue += delegate(float value) { return(ColorPresets[(int)value].Item2); }; float[] otherPresetValues = new float[OtherPresets.Count]; for (int i = 0; i < OtherPresets.Count; i++) { otherPresetValues[i] = i; } // Wall Color Preset var customColoredWalls = subMenuPresets.AddList("Wall Color", otherPresetValues); customColoredWalls.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "wallColorPreset", 0, true)); }; customColoredWalls.SetValue += delegate(float value) { ModPrefs.SetInt(Plugin.Name, "wallColorPreset", (int)value); }; customColoredWalls.FormatValue += delegate(float value) { return(OtherPresets[(int)value].Item2); }; //Left Light Preset var leftLightPreset = subMenuPresets.AddList("Left Light Preset", otherPresetValues); leftLightPreset.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "leftLightPreset", 0, true)); }; leftLightPreset.SetValue += delegate(float value) { ModPrefs.SetInt(Plugin.Name, "leftLightPreset", (int)value); }; leftLightPreset.FormatValue += delegate(float value) { return(OtherPresets[(int)value].Item2); }; //Right Light Preset var rightLightPreset = subMenuPresets.AddList("Right Light Preset", otherPresetValues); rightLightPreset.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "rightLightPreset", 0, true)); }; rightLightPreset.SetValue += delegate(float value) { ModPrefs.SetInt(Plugin.Name, "rightLightPreset", (int)value); }; rightLightPreset.FormatValue += delegate(float value) { return(OtherPresets[(int)value].Item2); }; //Rainbow Walls var rainbowWallOverride = subMenuPresets.AddBool("Rainbow Wall Override"); rainbowWallOverride.GetValue += delegate { return(ModPrefs.GetBool(Plugin.Name, "rainbowWalls", false, true)); }; rainbowWallOverride.SetValue += delegate(bool value) { ModPrefs.SetBool(Plugin.Name, "rainbowWalls", value); }; var subMenuUser = SettingsUI.CreateSubMenu("User Colors"); //Left Red var LeftR = subMenuUser.AddInt("User Left Red", Plugin.Min, Plugin.Max, Plugin.userIncrement); LeftR.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "LeftRed", 255, true)); }; LeftR.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "LeftRed", value); }; //Left Green var LeftG = subMenuUser.AddInt("User Left Green", Plugin.Min, Plugin.Max, Plugin.userIncrement); LeftG.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "LeftGreen", 255, true)); }; LeftG.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "LeftGreen", value); }; //Left Blue var LeftB = subMenuUser.AddInt("User Left Blue", Plugin.Min, Plugin.Max, Plugin.userIncrement); LeftB.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "LeftBlue", 255, true)); }; LeftB.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "LeftBlue", value); }; //Right Red var RightR = subMenuUser.AddInt("User Right Red", Plugin.Min, Plugin.Max, Plugin.userIncrement); RightR.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "RightRed", 255, true)); }; RightR.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "RightRed", value); }; //Right Green var RightG = subMenuUser.AddInt("User Right Green", Plugin.Min, Plugin.Max, Plugin.userIncrement); RightG.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "RightGreen", 255, true)); }; RightG.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "RightGreen", value); }; //Right Blue var RightB = subMenuUser.AddInt("User Right Blue", Plugin.Min, Plugin.Max, Plugin.userIncrement); RightB.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "RightBlue", 255, true)); }; RightB.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "RightBlue", value); }; // Increment Modifier var incrementValue = subMenuCC.AddList("User Color Increment", new float[] { 1, 5, 10, 25, 50, 100 }); incrementValue.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "userIncrement", 0, true)); }; incrementValue.SetValue += delegate(float value) { ModPrefs.SetInt(Plugin.Name, "userIncrement", (int)value); new IntViewController[] { LeftR, LeftG, LeftB, RightR, RightG, RightB }.ToList().ForEach((controller) => { controller.UpdateIncrement((int)value); }); }; incrementValue.FormatValue += delegate(float value) { return(((int)value).ToString()); }; }
private void MirrorHelperwindow(int id) { if (Event.current.type == EventType.MouseDown) { GUI.FocusWindow(windowID); windowdragflag = true; } else if (Event.current.type == EventType.MouseUp) { windowdragflag = false; } GUILayout.BeginVertical(); if (Mirror == null) { window = false; return; } texturesize = Mirror.m_TextureSize; int selected; if (texturesize <= 1024) { selected = 0; } else if (texturesize <= 2048) { selected = 1; } else { selected = 2; } GUILayout.Label("Mirror Resolution", UIUtils.labelstyle); GUILayout.Space(UIUtils.space); selected = GUILayout.SelectionGrid(selected, new string[] { "1024", "2048", "4096" }, 3, UIUtils.selectstyle); switch (selected) { default: case 0: texturesize = 1024; break; case 1: texturesize = 2048; break; case 2: texturesize = 4096; break; } Mirror.m_TextureSize = texturesize; clipplaneoffset = UIUtils.SliderGUI(clipplaneoffset, 0f, 1f, 0.01f, "Clip plane offset", "N3"); Mirror.m_ClipPlaneOffset = clipplaneoffset; GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Close Window", UIUtils.buttonstyle)) { window = false; } if (GUILayout.Button("Save", UIUtils.buttonstyle)) { ModPrefs.SetInt("MirrorHelper", "Resolution", texturesize); ModPrefs.SetFloat("MirrorHelper", "ClipPlaneOffset", clipplaneoffset); } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUI.DragWindow(); }
public static void SaveConfig() { ModPrefs.SetInt("RandomSong", "RandomSongBagSize", randomSongBagSize); }
public static void LoadOrCreateConfig() { if (!Directory.Exists("UserData")) { Directory.CreateDirectory("UserData"); } if (!ModPrefs.HasKey("BeatSaverDownloader", "beatsaverURL")) { ModPrefs.SetString("BeatSaverDownloader", "beatsaverURL", "https://beatsaver.com"); Logger.Log("Created config"); } else { beatsaverURL = ModPrefs.GetString("BeatSaverDownloader", "beatsaverURL"); if (string.IsNullOrEmpty(beatsaverURL)) { ModPrefs.SetString("BeatSaverDownloader", "beatsaverURL", "https://beatsaver.com"); beatsaverURL = "https://beatsaver.com"; Logger.Log("Created config"); } } if (!ModPrefs.HasKey("BeatSaverDownloader", "disableDeleteButton")) { ModPrefs.SetBool("BeatSaverDownloader", "disableDeleteButton", false); } else { disableDeleteButton = ModPrefs.GetBool("BeatSaverDownloader", "disableDeleteButton", false, true); } if (!ModPrefs.HasKey("BeatSaverDownloader", "deleteToRecycleBin")) { ModPrefs.SetBool("BeatSaverDownloader", "deleteToRecycleBin", true); } else { deleteToRecycleBin = ModPrefs.GetBool("BeatSaverDownloader", "deleteToRecycleBin", true, true); } if (!ModPrefs.HasKey("BeatSaverDownloader", "maxSimultaneousDownloads")) { ModPrefs.SetInt("BeatSaverDownloader", "maxSimultaneousDownloads", 3); } else { maxSimultaneousDownloads = ModPrefs.GetInt("BeatSaverDownloader", "maxSimultaneousDownloads", 3, true); } /*if (!File.Exists(configPath)) * { * File.Create(configPath).Close(); * } * * favoriteSongs.AddRange(File.ReadAllLines(configPath, Encoding.UTF8)); */ try { if (Registry.CurrentUser.OpenSubKey(@"Software").GetSubKeyNames().Contains("178eef3d-4cea-5a1b-bfd0-07a21d068990")) { beatDropPlaylistsLocation = (string)Registry.CurrentUser.OpenSubKey(@"Software\178eef3d-4cea-5a1b-bfd0-07a21d068990").GetValue("InstallLocation", ""); if (Directory.Exists(beatDropPlaylistsLocation)) { beatDropInstalled = true; } else if (Directory.Exists("%LocalAppData%\\Programs\\BeatDrop\\playlists")) { beatDropInstalled = true; beatDropPlaylistsLocation = "%LocalAppData%\\Programs\\BeatDrop\\playlists"; } else { beatDropInstalled = false; beatDropPlaylistsLocation = ""; } } } catch (Exception e) { Logger.Log($"Can't open registry key! Exception: {e}"); if (Directory.Exists("%LocalAppData%\\Programs\\BeatDrop\\playlists")) { beatDropInstalled = true; beatDropPlaylistsLocation = "%LocalAppData%\\Programs\\BeatDrop\\playlists"; } else { Logger.Log("Unable to find BeatDrop installation folder!"); } } if (!Directory.Exists("Playlists")) { Directory.CreateDirectory("Playlists"); } }
//protected virtual void ToggleRotationLock() //{ // if(lockRotation) // { // lockRotation = false; // CreateInfoMsg("Rotation released"); // } // else // { // lockRotation = true; // //lastTargetAngle = CameraAdjustedEulerAngles(lockOnTarget, CameraTransform); // CreateInfoMsg("Rotation locked"); // } //} protected virtual void GamepadControls() { if (!controllerEnabled) { return; } gamepadStatePrev = gamepadState; gamepadState = GamePad.GetState(controllerIndex, GamePadDeadZone.Circular); if (!gamepadState.IsConnected) { return; } animSwitched = false; if (gamepadStatePrev.Buttons.A == ButtonState.Released && gamepadState.Buttons.A == ButtonState.Pressed) { LockOn(); } if (gamepadStatePrev.Buttons.B == ButtonState.Released && gamepadState.Buttons.B == ButtonState.Pressed) { LockOnRelease(); } if (gamepadStatePrev.Buttons.Y == ButtonState.Released && gamepadState.Buttons.Y == ButtonState.Pressed) { CharaSwitch(true); } if (gamepadStatePrev.Buttons.X == ButtonState.Released && gamepadState.Buttons.X == ButtonState.Pressed) { int next = animMoveSetCurrent + 1 > animMoveSets.Count - 1 ? 0 : animMoveSetCurrent + 1; animMoveSetCurrent = next; ModPrefs.SetInt("LockOnPlugin.Misc", "MovementAnimSet", next); animSwitched = true; } if (gamepadStatePrev.Buttons.RightStick == ButtonState.Released && gamepadState.Buttons.RightStick == ButtonState.Pressed) { if (FileManager.PluginInstalled("TogglePOVNeo") || FileManager.PluginInstalled("TogglePOV")) { Utils.InvokePluginMethod("TogglePOV.HSPluginBase", "TogglePOV"); } } if (gamepadStatePrev.Buttons.LeftStick == ButtonState.Released && gamepadState.Buttons.LeftStick == ButtonState.Pressed) { LockOn(CameraTargetManager.MOVEMENTPOINT_NAME); } if (gamepadState.DPad.Right == ButtonState.Pressed) { Guitime.angle = 1f; float newAngle = CameraAngle.z - 1f * Time.deltaTime * 60f; newAngle = Mathf.Repeat(newAngle, 360f); CameraAngle = new Vector3(CameraAngle.x, CameraAngle.y, newAngle); } else if (gamepadState.DPad.Left == ButtonState.Pressed) { Guitime.angle = 1f; float newAngle = CameraAngle.z + 1f * Time.deltaTime * 60f; newAngle = Mathf.Repeat(newAngle, 360f); CameraAngle = new Vector3(CameraAngle.x, CameraAngle.y, newAngle); } else if (gamepadState.DPad.Up == ButtonState.Pressed) { if (gamepadState.Buttons.LeftShoulder == ButtonState.Pressed) { Guitime.fov = 1f; float newFov = CameraFov - 1f * Time.deltaTime * 60f; CameraFov = Mathf.Clamp(newFov, 1f, 160f); } else { float newDir = CameraDir.z + 1f * CameraZoomSpeed; newDir = Mathf.Clamp(newDir, float.MinValue, 0f); CameraDir = new Vector3(0f, 0f, newDir); reduceOffset = false; } } else if (gamepadState.DPad.Down == ButtonState.Pressed) { if (gamepadState.Buttons.LeftShoulder == ButtonState.Pressed) { Guitime.fov = 1f; float newFov = CameraFov + 1f * Time.deltaTime * 60f; CameraFov = Mathf.Clamp(newFov, 1f, 160f); } else { float newDir = CameraDir.z - 1f * CameraZoomSpeed; newDir = Mathf.Clamp(newDir, float.MinValue, 0f); CameraDir = new Vector3(0f, 0f, newDir); reduceOffset = false; } } Vector2 leftStick = new Vector2(gamepadState.ThumbSticks.Left.X, -gamepadState.ThumbSticks.Left.Y); Vector2 rightStick = new Vector2(gamepadState.ThumbSticks.Right.X, -gamepadState.ThumbSticks.Right.Y); if (controllerSwapSticks) { GamepadMovement(rightStick); GamepadCamera(leftStick); } else { GamepadMovement(leftStick); GamepadCamera(rightStick); } }
public static void LoadOrCreateConfig() { if (IllusionInjector.PluginManager.Plugins.Any(x => x.Name == "Song Browser")) { Logger.Log("Song Browser installed, disabling Song List Tweaks"); disableSongListTweaks = true; } if (!Directory.Exists("UserData")) { Directory.CreateDirectory("UserData"); } if (!ModPrefs.HasKey("BeatSaverDownloader", "beatsaverURL")) { ModPrefs.SetString("BeatSaverDownloader", "beatsaverURL", "https://beatsaver.com"); Logger.Log("Created config"); } else { beatsaverURL = ModPrefs.GetString("BeatSaverDownloader", "beatsaverURL"); if (string.IsNullOrEmpty(beatsaverURL)) { ModPrefs.SetString("BeatSaverDownloader", "beatsaverURL", "https://beatsaver.com"); beatsaverURL = "https://beatsaver.com"; Logger.Log("Created config"); } } if (!ModPrefs.HasKey("BeatSaverDownloader", "apiAccessToken")) { ModPrefs.SetString("BeatSaverDownloader", "apiAccessToken", apiTokenPlaceholder); } else { apiAccessToken = ModPrefs.GetString("BeatSaverDownloader", "apiAccessToken"); if (string.IsNullOrEmpty(apiAccessToken) || apiAccessToken == apiTokenPlaceholder) { ModPrefs.SetString("BeatSaverDownloader", "apiAccessToken", apiTokenPlaceholder); apiAccessToken = apiTokenPlaceholder; } } if (!ModPrefs.HasKey("BeatSaverDownloader", "disableDeleteButton")) { ModPrefs.SetBool("BeatSaverDownloader", "disableDeleteButton", false); } else { disableDeleteButton = ModPrefs.GetBool("BeatSaverDownloader", "disableDeleteButton", false, true); } if (!ModPrefs.HasKey("BeatSaverDownloader", "deleteToRecycleBin")) { ModPrefs.SetBool("BeatSaverDownloader", "deleteToRecycleBin", true); } else { deleteToRecycleBin = ModPrefs.GetBool("BeatSaverDownloader", "deleteToRecycleBin", true, true); } if (!ModPrefs.HasKey("BeatSaverDownloader", "enableSongIcons")) { ModPrefs.SetBool("BeatSaverDownloader", "enableSongIcons", true); } else { enableSongIcons = ModPrefs.GetBool("BeatSaverDownloader", "enableSongIcons", true, true); } if (!ModPrefs.HasKey("BeatSaverDownloader", "maxSimultaneousDownloads")) { ModPrefs.SetInt("BeatSaverDownloader", "maxSimultaneousDownloads", 3); } else { maxSimultaneousDownloads = ModPrefs.GetInt("BeatSaverDownloader", "maxSimultaneousDownloads", 3, true); } if (!ModPrefs.HasKey("BeatSaverDownloader", "fastScrollSpeed")) { ModPrefs.SetInt("BeatSaverDownloader", "fastScrollSpeed", 5); Logger.Log("Created config"); } else { fastScrollSpeed = ModPrefs.GetInt("BeatSaverDownloader", "fastScrollSpeed", 5, true); } if (File.Exists(oldConfigPath) && !File.Exists(configPath)) { File.Move(oldConfigPath, configPath); } if (!File.Exists(configPath)) { File.Create(configPath).Close(); } favoriteSongs.AddRange(File.ReadAllLines(configPath, Encoding.UTF8)); if (!File.Exists(votedSongsPath)) { File.WriteAllText(votedSongsPath, JsonConvert.SerializeObject(votedSongs), Encoding.UTF8); } else { votedSongs = JsonConvert.DeserializeObject <Dictionary <string, SongVote> >(File.ReadAllText(votedSongsPath, Encoding.UTF8)); } if (!File.Exists(reviewedSongsPath)) { File.WriteAllText(reviewedSongsPath, JsonConvert.SerializeObject(reviewedSongs), Encoding.UTF8); } else { reviewedSongs = JsonConvert.DeserializeObject <Dictionary <string, SongReview> >(File.ReadAllText(reviewedSongsPath, Encoding.UTF8)); } try { if (Registry.CurrentUser.OpenSubKey(@"Software").GetSubKeyNames().Contains("178eef3d-4cea-5a1b-bfd0-07a21d068990")) { beatDropPlaylistsLocation = (string)Registry.CurrentUser.OpenSubKey(@"Software\178eef3d-4cea-5a1b-bfd0-07a21d068990").GetValue("InstallLocation", ""); if (Directory.Exists(beatDropPlaylistsLocation)) { beatDropInstalled = true; } else if (Directory.Exists("%LocalAppData%\\Programs\\BeatDrop\\playlists")) { beatDropInstalled = true; beatDropPlaylistsLocation = "%LocalAppData%\\Programs\\BeatDrop\\playlists"; } else { beatDropInstalled = false; beatDropPlaylistsLocation = ""; } } } catch (Exception e) { Logger.Log($"Can't open registry key! Exception: {e}"); if (Directory.Exists("%LocalAppData%\\Programs\\BeatDrop\\playlists")) { beatDropInstalled = true; beatDropPlaylistsLocation = "%LocalAppData%\\Programs\\BeatDrop\\playlists"; } else { Logger.Log("Unable to find BeatDrop installation folder!"); } } if (!Directory.Exists("Playlists")) { Directory.CreateDirectory("Playlists"); } }
public void OnActiveSceneChanged(Scene arg0, Scene scene) { if (scene.name == "MenuViewControllers") { activateDuringIsolated = false; Log("Switched to Menu"); SharedCoroutineStarter.instance.StartCoroutine(GrabPP()); var controllers = Resources.FindObjectsOfTypeAll <VRController>(); if (controllers != null) { foreach (VRController controller in controllers) { if (controller != null) { if (controller.ToString() == "ControllerLeft (VRController)") { leftController = controller; } if (controller.ToString() == "ControllerRight (VRController)") { rightController = controller; } } // Log(controller.ToString()); } // Log("Left:" + leftController.ToString()); // Log("Right: " + rightController.ToString()); } } if (scene.name == "GameCore") { RemovePatches(); } if (_mainSettingsModel == null) { var menu = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().FirstOrDefault(); if (menu != null) { _mainSettingsModel = menu.GetField <MainSettingsModelSO>("_mainSettingsModel"); _mainSettingsModel.Load(true); Log("RUMBLE: " + _mainSettingsModel.controllersRumbleEnabled.ToString()); if (!setDefaultRumble) { defaultRumble = _mainSettingsModel.controllersRumbleEnabled; ModPrefs.SetInt("GameplayModifiersPlus", "GameRumbleSetting", _mainSettingsModel.controllersRumbleEnabled ? 1 : 0); setDefaultRumble = true; Log("Set Default Rumble Value"); } } } if (_mainSettingsModel != null) { defaultRumble = ModPrefs.GetInt("GameplayModifiersPlus", "GameRumbleSetting", -1, false) != 1 ? false : true; _mainSettingsModel.controllersRumbleEnabled.value = defaultRumble; _mainSettingsModel.Save(); } paused = false; if (!customColorsInstalled) { if (colorA != null) { colorA.SetColor(defColorA); } if (colorB != null) { colorB.SetColor(defColorB); } } // try // { if (scene.name == "EmptyTransition") { Log("Resetting Chat Powers Object"); if (chatPowers != null) { GameObject.Destroy(chatPowers); } } if (chatPowers == null) { Log("Null Creation of Chat Powers Object"); chatPowers = new GameObject("Chat Powers"); GameObject.DontDestroyOnLoad(chatPowers); twitchPowers = chatPowers.AddComponent <TwitchPowers>(); } // } // catch(Exception ex) // { // Log(ex.ToString()); // } GMPDisplay display = chatPowers.GetComponent <GMPDisplay>(); if (display != null) { display.Destroy(); GameObject.Destroy(display); } ReadPrefs(); if (GMPUI.chatIntegration && twitchPluginInstalled) { if (twitchPowers != null) { cooldowns.ResetCooldowns(); TwitchPowers.ResetPowers(false); twitchPowers.StopAllCoroutines(); } if (ChatConfig.resetChargesEachLevel) { charges = 0; } } // twitchCommands.StopAllCoroutines(); haveSongNJS = false; if (soundIsPlaying == true) { gnomeSound.Stop(); } soundIsPlaying = false; isValidScene = false; playerInfo = false; modifiersInit = false; if (arg0.name == "EmpyTransition" && chatPowers != null) { GameObject.Destroy(chatPowers); } if (scene.name == "GameCore") { Log("Isolated: " + BS_Utils.Gameplay.Gamemode.IsIsolatedLevel); isValidScene = true; if (BS_Utils.Gameplay.Gamemode.IsIsolatedLevel && !activateDuringIsolated) { Log("Isolated Level, not activating"); return; } // Log("Pre GrabGrab"); GameObject.Destroy(GameObject.Find("Color Setter")); soundEffectManager = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().FirstOrDefault(); spawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().FirstOrDefault(); energyCounter = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().First(); energyPanel = Resources.FindObjectsOfTypeAll <GameEnergyUIPanel>().First(); ColorManager = Resources.FindObjectsOfTypeAll <ColorManager>().First(); levelData = BS_Utils.Plugin.LevelData; // Log("Post GrabGrab"); if (spawnController != null) { spawnController.noteDidStartJumpEvent += SpawnController_ModifiedJump; spawnController.noteWasCutEvent += SpawnController_ScaleRemoveCut; spawnController.noteWasMissedEvent += SpawnController_ScaleRemoveMiss; } else { Log("Spawn Controller Null"); } // Log("Post GrabGrab 2"); currentSongSpeed = levelData.GameplayCoreSceneSetupData.gameplayModifiers.songSpeedMul; BS_Utils.Plugin.LevelDidFinishEvent += LevelData_didFinishEvent; // Log("Post GrabGrab 3"); if (!Multiplayer.MultiMain.multiActive.Value) { if (GMPUI.chatIntegration && ChatConfig.maxCharges > 0 && twitchPluginInstalled) { chatPowers.AddComponent <GMPDisplay>(); } if (GMPUI.chatIntegration && ChatConfig.timeForCharges > 0 && twitchPluginInstalled) { twitchPowers.StartCoroutine(TwitchPowers.ChargeOverTime()); } } // Log("Post GrabGrab 4"); pauseManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First(); var colors = Resources.FindObjectsOfTypeAll <SimpleColorSO>(); // Log("Pre Color"); foreach (SimpleColorSO color in colors) { // Log(color.name); if (color.name == "BaseNoteColor1") { colorA = color; } if (color.name == "BaseNoteColor0") { colorB = color; } } oldColorA.SetColor(colorA); oldColorB.SetColor(colorB); // Log("Pre ChatInt"); // Log(colorA.color.ToString()); if (GMPUI.chatIntegration && charges <= ChatConfig.maxCharges && twitchPluginInstalled) { charges += ChatConfig.chargesPerLevel; if (charges > ChatConfig.maxCharges) { charges = ChatConfig.maxCharges; } // TryAsyncMessage("Current Charges: " + charges); } // Log("Pre Audio/Player"); // ReflectionUtil.SetProperty(typeof(PracticePlugin.Plugin), "TimeScale", 1f); AudioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault(); if (AudioTimeSync != null) { songAudio = AudioTimeSync.GetField <AudioSource>("_audioSource"); if (songAudio == null) { Log("Audio null"); } // Log("Object Found"); } //Get Sabers player = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault(); if (player != null) { playerInfo = true; } else { playerInfo = false; Log("Player is null"); } CheckGMPModifiers(); } }
void Init() { string currentDate = DateTime.Now.ToString("dd.MM.yyyy"); if (rdCals != currentDate) { Console.WriteLine("Current date being set to: " + currentDate + ". Setting daily calorie count to zero;"); dailyCalories = 0; ModPrefs.SetInt("fitNessMod", "dailyCalories", dailyCalories); } //Init Current Session Counter # ///////////////////////////////////////////////////////////////////////// cscText = this.gameObject.AddComponent <TextMeshPro>(); cscText.text = ModPrefs.GetInt("fitNessMod", "sessionCalories", 0, true).ToString(); cscText.fontSize = 2; cscText.color = Color.cyan; cscText.font = Resources.Load <TMP_FontAsset>("Beon SDF No-Glow"); cscText.alignment = TextAlignmentOptions.Center; cscText.rectTransform.position = menuPosition + new Vector3(-1, -0.2f, 0); cscText.rectTransform.rotation = slantBottom; //Init Current Sesion Counter Label ///////////////////////////////////////////////////////////////////////// countCSC = new GameObject("countCSClabel"); TextMeshPro labelcsc = countCSC.AddComponent <TextMeshPro>(); labelcsc.text = "Current Session Calories"; labelcsc.fontSize = 1; labelcsc.color = Color.white; labelcsc.font = Resources.Load <TMP_FontAsset>("Beon SDF No-Glow"); labelcsc.alignment = TextAlignmentOptions.Center; labelcsc.rectTransform.position = menuPosition + new Vector3(-1f, 0, 0); labelcsc.rectTransform.rotation = slantBottom; ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// //Init Life Calories Counter # ///////////////////////////////////////////////////////////////////////// lcText = new GameObject("lifeCalories").gameObject.AddComponent <TextMeshPro>(); lcText.text = ModPrefs.GetInt("fitNessMod", "lifeCalories", 0, true).ToString(); lcText.fontSize = 2; lcText.color = Color.cyan; lcText.font = Resources.Load <TMP_FontAsset>("Beon SDF No-Glow"); lcText.alignment = TextAlignmentOptions.Center; lcText.rectTransform.position = menuPosition + new Vector3(1, -0.2f, 0); lcText.rectTransform.rotation = slantBottom; //Init Life Calories Counter Label ///////////////////////////////////////////////////////////////////////// countLC = new GameObject("countLClabel"); TextMeshPro labelLC = countLC.AddComponent <TextMeshPro>(); labelLC.text = "All Calories"; labelLC.fontSize = 1; labelLC.color = Color.white; labelLC.font = Resources.Load <TMP_FontAsset>("Beon SDF No-Glow"); labelLC.alignment = TextAlignmentOptions.Center; labelLC.rectTransform.position = menuPosition + new Vector3(1, 0, 0); labelLC.rectTransform.rotation = slantBottom; ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// //Init Daily Calories Counter # ///////////////////////////////////////////////////////////////////////// dcText = new GameObject("dailyCalories").gameObject.AddComponent <TextMeshPro>(); dcText.text = ModPrefs.GetInt("fitNessMod", "dailyCalories", 0, true).ToString(); dcText.fontSize = 2; dcText.color = Color.cyan; dcText.font = Resources.Load <TMP_FontAsset>("Beon SDF No-Glow"); dcText.alignment = TextAlignmentOptions.Center; dcText.rectTransform.position = menuPosition + new Vector3(0, -0.2f, 0); dcText.rectTransform.rotation = slantBottom; //Init Daily Calories Counter Label ///////////////////////////////////////////////////////////////////////// countDC = new GameObject("countDClabel"); TextMeshPro labelDC = countDC.AddComponent <TextMeshPro>(); labelDC.text = "Daily Calories"; labelDC.fontSize = 1; labelDC.color = Color.white; labelDC.font = Resources.Load <TMP_FontAsset>("Beon SDF No-Glow"); labelDC.alignment = TextAlignmentOptions.Center; labelDC.rectTransform.position = menuPosition + new Vector3(0, 0, 0); labelDC.rectTransform.rotation = slantBottom; ///////////////////////////////////////////////////////////////////////// //Init Last Game Calories Counter # ///////////////////////////////////////////////////////////////////////// lgcText = new GameObject("dailyCalories").gameObject.AddComponent <TextMeshPro>(); lgcText.text = ""; lgcText.fontSize = 2; lgcText.color = Color.cyan; lgcText.font = Resources.Load <TMP_FontAsset>("Beon SDF No-Glow"); lgcText.alignment = TextAlignmentOptions.Center; lgcText.rectTransform.position = menuPosition + new Vector3(2.5f, -0.6f, 0f); lgcText.rectTransform.rotation = Quaternion.Euler(0, 60, 0); //Init Last Game Song name Label // Displays version number on launch ///////////////////////////////////////////////////////////////////////// countLGC = new GameObject("countLGClabel").gameObject.AddComponent <TextMeshPro>(); countLGC.text = version; countLGC.fontSize = 1.5f; countLGC.color = Color.white; countLGC.font = Resources.Load <TMP_FontAsset>("Beon SDF No-Glow"); countLGC.alignment = TextAlignmentOptions.Center; countLGC.rectTransform.position = menuPosition + new Vector3(2.5f, -0.4f, 0f); countLGC.rectTransform.rotation = Quaternion.Euler(0, 60, 0); ///////////////////////////////////////////////////////////////////////// //Init Last Game Calories Counter Label ///////////////////////////////////////////////////////////////////////// labelLG = new GameObject("countLGClabel").gameObject.AddComponent <TextMeshPro>(); labelLG.text = "BeFit Mod"; //I'm not set on the name labelLG.fontSize = 2f; labelLG.color = Color.white; labelLG.font = Resources.Load <TMP_FontAsset>("Beon SDF No-Glow"); labelLG.alignment = TextAlignmentOptions.Center; labelLG.rectTransform.position = menuPosition + new Vector3(2.5f, -0.2f, 0f); labelLG.rectTransform.rotation = Quaternion.Euler(0, 60, 0); ///////////////////////////////////////////////////////////////////////// }
public static void CreateUI() { GetIcons(); if (BS_Utils.Gameplay.GetUserInfo.GetUserID() == 76561198047644920) { CustomUI.MenuButton.MenuButtonUI.AddButton("AYAYA", null, _GMPIcon); CustomUI.MenuButton.MenuButtonUI.AddButton("papatutuwawa", null, _GMPIcon); CustomUI.MenuButton.MenuButtonUI.AddButton("chikin dayo", null, _GMPIcon); CustomUI.MenuButton.MenuButtonUI.AddButton("cececlown", null, _GMPIcon); CustomUI.MenuButton.MenuButtonUI.AddButton("desu", null, _GMPIcon); CustomUI.MenuButton.MenuButtonUI.AddButton("Smilew", null, _GMPIcon); CustomUI.MenuButton.MenuButtonUI.AddButton("hamnomanim", null, _GMPIcon); CustomUI.MenuButton.MenuButtonUI.AddButton("catgirls", null, _GMPIcon); CustomUI.MenuButton.MenuButtonUI.AddButton("mousegirl", null, _GMPIcon); CustomUI.MenuButton.MenuButtonUI.AddButton("miku", null, _GMPIcon); CustomUI.MenuButton.MenuButtonUI.AddButton("ohisee", null, _GMPIcon); } string disableScoreString = "<size=120%><color=#ff0000ff><b><u>Disables Score Submission</u> </b></color></size> \r\n<size=100%> "; //Rumble Option var gmpTweaksMenu = GameplaySettingsUI.CreateSubmenuOption(GameplaySettingsPanels.ModifiersRight, "GMP Tweaks", "MainMenu", "gmptweaksMenu", "GameplayModifiersPlus Tweaks", _GMPIcon); var rumbleOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Controller Rumble", "MainMenu", "Toggle Controller Vibration in songs", _GMPIcon); rumbleOption.GetValue = ModPrefs.GetInt("GameplayModifiersPlus", "GameRumbleSetting", -1, false) != 1 ? false : true;; rumbleOption.OnToggle += (value) => { ModPrefs.SetInt("GameplayModifiersPlus", "GameRumbleSetting", value == true ? 1 : 0); Plugin.Log("Changed value"); }; var disableFireWorksOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Disable Fireworks", "gmptweaksMenu", "Disable fireworks after a song", _GMPIcon); disableFireWorksOption.GetValue = ModPrefs.GetBool("GameplayModifiersPlus", "DisableFireworks", false, false); disableFireWorksOption.OnToggle += (value) => { disableFireworks = value; ModPrefs.SetBool("GameplayModifiersPlus", "DisableFireworks", value); Plugin.Log("Changed value"); }; var disableRippleOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Disable Note Ripple", "gmptweaksMenu", "Disable ripple effect after cutting a note", _GMPIcon); disableRippleOption.GetValue = ModPrefs.GetBool("GameplayModifiersPlus", "DisableRipple", false, false); disableRippleOption.OnToggle += (value) => { disableRipple = value; ModPrefs.SetBool("GameplayModifiersPlus", "DisableRipple", value); Plugin.Log("Changed value"); }; var gmp1Menu = GameplaySettingsUI.CreateSubmenuOption(GameplaySettingsPanels.ModifiersRight, "GamePlayModifiersPlus", "MainMenu", "GMP1", "GameplayModifiersPlus Options", _GMPIcon); var disableScoresOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.PlayerSettingsLeft, "Disable Score Submission", "MainMenu", "<size=120%><color=#ff0000ff><b><u>Disables Score Submission</u></b></color></size>", _GMPIcon); disableScoresOption.GetValue = disableSubmission; disableScoresOption.OnToggle += (value) => { disableSubmission = value; if (value) { BS_Utils.Gameplay.ScoreSubmission.ProlongedDisableSubmission("Gameplay Modifiers Plus"); } else { BS_Utils.Gameplay.ScoreSubmission.RemoveProlongedDisable("Gameplay Modifiers Plus"); } }; //GMP1 Options // var backOption = GameplaySettingsUI.CreateSubmenuOption(GameplaySettingsPanels.ModifiersRight, "Back", "GMP1", "MainMenu", "Return from GamePlayModifiersOptions", _BackButton); if (Plugin.twitchPluginInstalled) { var twitchStuffOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Chat Integration", "GMP1", disableScoreString + "Allows Chat to mess with your game if connected. !gm help", _TwitchIcon); twitchStuffOption.GetValue = chatIntegration; twitchStuffOption.OnToggle += (value) => { chatIntegration = value; Plugin.Log("Changed value"); }; var chatDeltaOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Chat Delta", "GMP1", "Display Change in Performance Points / Rank in Twitch Chat if Connected", _ChatDeltaIcon); chatDeltaOption.GetValue = ModPrefs.GetBool("GameplayModifiersPlus", "chatDelta", false, true); chatDeltaOption.OnToggle += (chatDelta) => { ModPrefs.SetBool("GameplayModifiersPlus", "chatDelta", chatDelta); Plugin.Log("Changed value"); }; } //GMP2 Options var gmp2Menu = GameplaySettingsUI.CreateSubmenuOption(GameplaySettingsPanels.ModifiersRight, "Additional Modifiers", "GMP1", "GMP2", "Additional Modifiers", _GMPIcon); //Multiplayer Option toggle var multiOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Allow in Multiplayer", "GMP1", "Allow GMP activation in multiplayer room if players equip similar version of the plugin, refer to the readme for more information. Your Version: " + Plugin.pluginVersion, _GMPIcon); multiOption.GetValue = ModPrefs.GetBool("GameplayModifiersPlus", "allowMulti", false, true); multiOption.OnToggle += (value) => { allowMulti = value; ModPrefs.SetBool("GameplayModifiersPlus", "allowMulti", value); Plugin.Log("Changed value"); }; var rainbowOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Rainbow", "GMP2", "Rainbow Notes", _RainbowIcon); rainbowOption.GetValue = rainbow; rainbowOption.OnToggle += (value) => { rainbow = value; Plugin.Log("Changed value"); }; rainbowOption.AddConflict("Chat Integration"); var tunnelOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Tunnel", "GMP2", "Play the song in a tunnel", _GMPIcon); tunnelOption.GetValue = tunnel; tunnelOption.OnToggle += (value) => { tunnel = value; Plugin.Log("Changed value"); }; var reverseOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Reversal ", "GMP2", disableScoreString + "Reverses the direction the notes come from", _SwapSabersIcon); reverseOption.GetValue = reverse; reverseOption.OnToggle += (value) => { reverse = value; Plugin.Log("Changed value"); }; reverseOption.AddConflict("Chat Integration"); var repeatOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Repeat", "GMP2", disableScoreString + "Restarts song on song end", _RepeatIcon); repeatOption.GetValue = repeatSong; repeatOption.OnToggle += (value) => { repeatSong = value; Plugin.Log("Changed value"); }; if (Plugin.mappingExtensionsPresent) { var sixlanesOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Six Lanes", "GMP2", disableScoreString + "Extends the map to be in 6 lanes", _GMPIcon); sixlanesOption.GetValue = sixLanes; sixlanesOption.OnToggle += (value) => { sixLanes = value; Plugin.Log("Changed value"); }; var fourlayersOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Four Layers", "GMP2", disableScoreString + "Extends the map to be in 4 vertical layers rather than 3", _GMPIcon); fourlayersOption.GetValue = fourLayers; fourlayersOption.OnToggle += (value) => { fourLayers = value; Plugin.Log("Changed value"); }; var fiveLanesOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Five Lanes", "GMP2", disableScoreString + "Extends the map to be in 5 lanes", _GMPIcon); fiveLanesOption.GetValue = fiveLanes; fiveLanesOption.OnToggle += (value) => { fiveLanes = value; Plugin.Log("Changed value"); }; fiveLanesOption.AddConflict("Six Lanes"); var laneshiftOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Lane Shift", "GMP2", disableScoreString + "Randomly shifts notes off of their normal lane", _GMPIcon); laneshiftOption.GetValue = laneShift; laneshiftOption.OnToggle += (value) => { laneShift = value; Plugin.Log("Changed value"); }; var angleShiftOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Angle Shift", "GMP2", disableScoreString + "Randomly shifts notes off of their normal Angle", _GMPIcon); angleShiftOption.GetValue = angleShift; angleShiftOption.OnToggle += (value) => { angleShift = value; Plugin.Log("Changed value"); }; } var gnomeOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Gnome on miss", "GMP2", "Probably try not to miss.", _GnomeIcon); gnomeOption.GetValue = gnomeOnMiss; gnomeOption.OnToggle += (value) => { gnomeOnMiss = value; Plugin.Log("Changed value"); }; gnomeOption.AddConflict("Chat Integration"); gnomeOption.AddConflict("Faster Song"); gnomeOption.AddConflict("Slower Song"); var bulletTimeOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Bullet Time", "GMP2", disableScoreString + "Slow down time by pressing the triggers on your controllers.", _BulletTimeIcon); bulletTimeOption.GetValue = bulletTime; bulletTimeOption.OnToggle += (value) => { bulletTime = value; Plugin.Log("Changed value"); }; bulletTimeOption.AddConflict("Faster Song"); bulletTimeOption.AddConflict("Slower Song"); bulletTimeOption.AddConflict("Chat Integration"); var noteSizeOption = GameplaySettingsUI.CreateListOption(GameplaySettingsPanels.ModifiersRight, "Note Size", "GMP2", disableScoreString + "Change the size of the notes. Overwritten by Chat Integration and any other size changing options"); for (float i = 10; i <= 200; i += 10) { noteSizeOption.AddOption(i / 100); } noteSizeOption.GetValue = (() => { float num = fixedNoteScale; if (num % 0.1f != 0) { num = (float)Math.Round(num, 1); } num = Mathf.Clamp(num, 0.1f, 2f); return(num); }); noteSizeOption.OnChange += (value) => { fixedNoteScale = value; Plugin.Log("Changed Value"); }; var swapSabersOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Testing Ground", "GMP2", disableScoreString + "Currently Used To test Random stuff"); swapSabersOption.GetValue = swapSabers; swapSabersOption.OnToggle += (value) => { swapSabers = value; Plugin.Log("Changed value"); }; swapSabersOption.AddConflict("Chat Integration"); var njsRandomOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Random NJS", "GMP2", disableScoreString + "Randomizes Note Jump Speed", _RandomIcon); njsRandomOption.GetValue = njsRandom; njsRandomOption.OnToggle += (value) => { njsRandom = value; Plugin.Log("Changed value"); }; njsRandomOption.AddConflict("Chat Integration"); var offsetrandomOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Random Spawn Offset", "GMP2", disableScoreString + "Randomizes Note Spawn offset", _RandomIcon); offsetrandomOption.GetValue = offsetrandom; offsetrandomOption.OnToggle += (value) => { offsetrandom = value; Plugin.Log("Changed value"); }; offsetrandomOption.AddConflict("Chat Integration"); var randomSizeOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Random Note Size", "GMP2", disableScoreString + "Randomizes Note Size", _RandomIcon); randomSizeOption.GetValue = njsRandom; randomSizeOption.OnToggle += (value) => { randomSize = value; Plugin.Log("Changed value"); }; randomSizeOption.AddConflict("Chat Integration"); var funkyOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Funky", "GMP2", disableScoreString + "Funky Notes", _FunkyIcon); funkyOption.GetValue = funky; funkyOption.OnToggle += (value) => { funky = value; Plugin.Log("Changed value"); }; funkyOption.AddConflict("Chat Integration"); var noArrowsOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "No Arrows", "GMP2", disableScoreString + "No arrows but without the color randomization", _NoArrowsIcon); noArrowsOption.GetValue = noArrows; noArrowsOption.OnToggle += (value) => { noArrows = value; Plugin.Log("Changed value"); }; noArrowsOption.AddConflict("Chat Integration"); var oneColorOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "One Color ", "GMP2", disableScoreString + "Changes Blocks to One Color, allows you to hit them with either saber. Haptics for saber clash and walls disabled with this modifier on", _GMPIcon); oneColorOption.GetValue = oneColor; oneColorOption.OnToggle += (value) => { oneColor = value; Plugin.Log("Changed value"); }; oneColorOption.AddConflict("Chat Integration"); var removeCrouchOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "Remove Crouch Walls ", "GMP2", disableScoreString + "Removes walls that require you to duck, leaving other walls in tact", _GMPIcon); removeCrouchOption.GetValue = removeCrouchWalls; removeCrouchOption.OnToggle += (value) => { removeCrouchWalls = value; Plugin.Log("Changed value"); }; }