private static void SetupTrustRankButton() { if (QuickMenu.prop_QuickMenu_0 != null) { GameObject QuickMenu_gameObject = QuickMenu.prop_QuickMenu_0.field_Private_GameObject_4; if (QuickMenu_gameObject != null) { UiToggleButton component = QuickMenu_gameObject.transform.Find("Toggle_States_ShowTrustRank_Colors").GetComponent <UiToggleButton>(); if (component != null) { bool is_enabled = ModPrefs.GetBool("ogtrustranks", "enabled"); if (is_enabled) { TrustRanks rank = GetTrustRankEnum(APIUser.CurrentUser); if (rank == TrustRanks.VETERAN) { SetupRankDisplay(component, "TRUSTED", "Veteran User", VeteranUserColor); } else if (rank == TrustRanks.LEGENDARY) { SetupRankDisplay(component, "TRUSTED", "Legendary User", LegendaryUserColor); } } else { SetupRankDisplay(component, "TRUSTED", "Trusted User", TrustedUserColor); } } } } }
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 void OnApplicationStart() { SceneManager.activeSceneChanged += OnSceneChanged; if (ModPrefs.GetString("PerfectionDisplay", "Position") == "") { ModPrefs.SetString("PerfectionDisplay", "Position", FormattableString.Invariant($"{PerfectDisplay.displayPosition.x:0.00},{PerfectDisplay.displayPosition.y:0.00},{PerfectDisplay.displayPosition.z:0.00}")); } else { var posString = ModPrefs.GetString("PerfectionDisplay", "Position"); var posVals = posString.Split(',').Select(f => float.Parse(f, CultureInfo.InvariantCulture)).ToArray(); PerfectDisplay.displayPosition = new Vector3(posVals[0], posVals[1], posVals[2]); } if (ModPrefs.GetString("PerfectionDisplay", "Score Ranges") == "") { ModPrefs.SetString("PerfectionDisplay", "Score Ranges", string.Join(",", PerfectDisplay.scoreRanges)); } else { var rangeString = ModPrefs.GetString("PerfectionDisplay", "Score Ranges"); PerfectDisplay.scoreRanges = rangeString.Split(',').Select(f => int.Parse(f, CultureInfo.InvariantCulture)).ToArray(); } if (ModPrefs.GetString("PerfectionDisplay", "Colors") == "") { ModPrefs.SetString("PerfectionDisplay", "Colors", string.Join(",", PerfectDisplay.colors)); } else { var rangeString = ModPrefs.GetString("PerfectionDisplay", "Colors"); PerfectDisplay.colors = rangeString.Split(','); } if (PerfectDisplay.scoreRanges.Length + 2 > PerfectDisplay.colors.Length) { Console.WriteLine("[PerfectionDisplay] Config error - colors should have 2 more colors than there are score ranges, filling the remaining colors with white"); string[] colors = new string[PerfectDisplay.scoreRanges.Length + 2]; for (int i = 0; i < colors.Length; i++) { if (i < PerfectDisplay.colors.Length) { colors[i] = PerfectDisplay.colors[i]; } else { colors[i] = "white"; } } PerfectDisplay.colors = colors; } for (int i = 0; i < PerfectDisplay.colors.Length; i++) { if (!PerfectDisplay.colors[i].StartsWith("#")) { PerfectDisplay.colors[i] = "\"" + PerfectDisplay.colors[i] + "\""; } } PerfectDisplay.showNumbers = ModPrefs.GetBool("PerfectionDisplay", "Show Count", PerfectDisplay.showNumbers, true); PerfectDisplay.showPercent = ModPrefs.GetBool("PerfectionDisplay", "Show Percent", PerfectDisplay.showPercent, true); PerfectDisplay.shouldHitscore = ModPrefs.GetBool("PerfectionDisplay", "HitScoreVisualizer Integration", PerfectDisplay.shouldHitscore, true); }
public override void OnApplicationStart() { ModPrefs.RegisterCategory("PortableMirror", "PortableMirror"); ModPrefs.RegisterPrefFloat("PortableMirror", "MirrorScaleX", 5f, "Mirror Scale X"); ModPrefs.RegisterPrefFloat("PortableMirror", "MirrorScaleY", 3f, "Mirror Scale Y"); ModPrefs.RegisterPrefBool("PortableMirror", "OptimizedMirror", false, "Optimized Mirror"); ModPrefs.RegisterPrefBool("PortableMirror", "CanPickupMirror", false, "Can Pickup Mirror"); ModPrefs.RegisterPrefString("PortableMirror", "MirrorKeybind", "Alpha1", "Toggle Mirror Keybind"); _mirrorScaleX = ModPrefs.GetFloat("PortableMirror", "MirrorScaleX"); _mirrorScaleY = ModPrefs.GetFloat("PortableMirror", "MirrorScaleY"); _optimizedMirror = ModPrefs.GetBool("PortableMirror", "OptimizedMirror"); _canPickupMirror = ModPrefs.GetBool("PortableMirror", "CanPickupMirror"); _mirrorKeybind = Utils.GetMirrorKeybind(); MelonModLogger.Log("Settings can be configured in UserData\\MelonPreferences.cfg"); MelonModLogger.Log($"[{_mirrorKeybind}] -> Toggle portable mirror"); MelonMod uiExpansionKit = MelonLoader.Main.Mods.Find(m => m.InfoAttribute.Name == "UI Expansion Kit"); if (uiExpansionKit != null) { uiExpansionKit.InfoAttribute.SystemType.Assembly.GetTypes().First(t => t.FullName == "UIExpansionKit.API.ExpansionKitApi").GetMethod("RegisterWaitConditionBeforeDecorating", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static).Invoke(null, new object[] { CreateQuickMenuButton() }); } }
private static bool Enter(PortalInternal __instance, MethodInfo __originalMethod) { if (ModPrefs.GetBool("vrcextended", "disablePortal")) { return(false); } if (portalEnter == __instance) { return(true); } if (ModPrefs.GetBool("vrcextended", "askUsePortal")) { VRCUiPopupManagerUtils.ShowPopup("Enter Portal", "Do you really want to enter the portal?", "No", delegate() { VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup(); }, "Yes", delegate() { portalEnter = __instance; VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup(); __originalMethod.Invoke(__instance, new object[] { }); }); return(false); } return(true); }
public static void CreateUI() { var toggleOption = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersLeft, "Show Notes Left Counter", "MainMenu", "Shows the amount of notes left in the song as you progress"); toggleOption.GetValue = ModPrefs.GetBool("NotesLeftCounter", "showNoteCounter", true, true); toggleOption.OnToggle += (value) => { ShowNoteCounter = value; ModPrefs.SetBool("NotesLeftCounter", "showNoteCounter", value); }; }
void OnApplicationFocus(bool hasFocus) { if (!ModPrefs.GetBool("vrcextended", "fpsManagement")) { return; } if (!hasFocus) { Application.targetFrameRate = 5; ExtendedLogger.Log("Game out of focus, setting FPS to " + Application.targetFrameRate); } else { if (ModPrefs.GetBool("vrcextended", "unlimitedFPS")) { Application.targetFrameRate = 0; } else { Application.targetFrameRate = VRCExtended.FrameRate; } ExtendedLogger.Log("Game in focus, setting FPS to " + Application.targetFrameRate); } }
public void OnApplicationStart() { m_minSpeed = ModPrefs.GetFloat("Camera", "fMinSpeed", 10, true); m_maxSpeed = ModPrefs.GetFloat("Camera", "fMaxSpeed", 180, true); m_cameraAcceleration = ModPrefs.GetFloat("Camera", "fCameraAcceleration", 5, true); useEnglish = ModPrefs.GetBool("Camera", "bUseEnglish", Application.systemLanguage != SystemLanguage.Japanese, true); }
public void Start() { threshold = ModPrefs.GetFloat(name, "FPSThreshold", threshold, true); fpsCheckerEnabled = ModPrefs.GetBool(name, "FPSCheckerOn", fpsCheckerEnabled, true); period = ModPrefs.GetFloat(name, "ResponseTime", period, true); StartCoroutine(WaitForStart()); }
IEnumerator WaitForStart() { System.Console.WriteLine("[AutoPause] Waiting for Managers to be available"); yield return(new WaitUntil(() => GamePauseManager != null && PlayerController != null && GameplayManager != null)); pluginEnabled = ModPrefs.GetBool(name, "Enabled", pluginEnabled, true); }
protected bool LoadSettings() { if (ModPrefs.GetString("TogglePOV", "Version", TogglePOVPlugin.PLUGIN_VERSION, true) != TogglePOVPlugin.PLUGIN_VERSION) { ModPrefs.SetString("TogglePOV", "Version", TogglePOVPlugin.PLUGIN_VERSION); ModPrefs.SetFloat("TogglePOV", "fFOV", DEFAULT_FOV); ModPrefs.SetBool("TogglePOV", "bShowHair", SHOW_HAIR); ModPrefs.SetFloat("TogglePOV", "fMaleOffset", MALE_OFFSET); ModPrefs.SetFloat("TogglePOV", "fFemaleOffset", FEMALE_OFFSET); } else { currentfov = DEFAULT_FOV = Mathf.Clamp(ModPrefs.GetFloat("TogglePOV", "fFOV", DEFAULT_FOV, true), 1f, MAXFOV); SHOW_HAIR = ModPrefs.GetBool("TogglePOV", "bShowHair", SHOW_HAIR, true); MALE_OFFSET = ModPrefs.GetFloat("TogglePOV", "fMaleOffset", MALE_OFFSET, true); FEMALE_OFFSET = ModPrefs.GetFloat("TogglePOV", "fFemaleOffset", FEMALE_OFFSET, true); } try { string keystring = ModPrefs.GetString("TogglePOV", "POVHotkey", hotkey.ToString(), true); hotkey = (KeyCode)Enum.Parse(typeof(KeyCode), keystring, true); } catch (Exception) { Console.WriteLine("Using default hotkey ({0})", hotkey.ToString()); return(false); } return(true); }
private void RunAction(string act) { if (act == "lock") { locked = !locked; Text = "Overlay (" + Size.Width + "x" + Size.Height + ") (Locked: " + locked + ")"; } else if (act == "refresh") { ForeColor = System.Drawing.Color.FromName(ModPrefs.GetString("StreamInfo", "TextColor", "White", true)); BackColor = System.Drawing.Color.FromName(ModPrefs.GetString("StreamInfo", "BackgroundColor", "Black", true)); if (ModPrefs.GetBool("StreamInfo", "UseBackgroundImage", false, true) && File.Exists(Path.Combine(Plugin.dir, "image.png"))) { BackgroundImage = Image.FromFile(Path.Combine(Plugin.dir, "image.png")); } else { BackgroundImage = null; } UpdateAlign(); Refresh(); } }
public void OnApplicationStart() { SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged; SceneManager.sceneLoaded += SceneManager_sceneLoaded; BailOutInstalled = PluginManager.Plugins.Any(p => p.Name.Contains("Bail") && p.Name.Contains("Out") && p.Name.Contains("Mode")); if (BailOutInstalled) { Console.WriteLine("[StreamInfo] BailOut plugin found."); } else { Console.WriteLine("[StreamInfo] BailOut plugin not found."); } info = new SongInfo(); if (!Directory.Exists(Path.Combine(Environment.CurrentDirectory, "UserData"))) { Directory.CreateDirectory(Path.Combine(Environment.CurrentDirectory, "UserData")); } if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } foreach (string s in new[] { "SongName", "overlaydata" }) { if (!File.Exists(Path.Combine(dir, s + ".txt"))) { Console.WriteLine("[StreamInfo] " + s + ".txt not found. Creating file..."); if (s == "overlaydata") { File.WriteAllLines(Path.Combine(dir, s + ".txt"), new[] { "567,288", "0,0", "75,198", "307,134", "16,132", "87,19", "170,83", "303,19" }); } else { File.WriteAllText(Path.Combine(dir, s + ".txt"), ""); } } } if (ModPrefs.GetBool("StreamInfo", "OverlayEnabled", true, true)) { Console.WriteLine("[StreamInfo] Launching overlay..."); overlay = new Overlay(); overlay.FormClosed += Overlay_FormClosed; Action overlayjob = delegate { Application.Run(overlay); }; OverlayTask = new HMTask(overlayjob); OverlayTask.Run(); overlay.Refresh(); overlayRefreshRate = ModPrefs.GetInt("StreamInfo", "RefreshRate", 100, true); Console.WriteLine("[StreamInfo] Overlay started."); overlayEnabled = true; } }