mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Add FPS slider (default to 120 fps)
This commit is contained in:
1 parent
c72eacc7a2
commit
ab67c233d8
2 files changed
+15
No files matched your search
@@ -4,6 +4,7 @@ using MiraAPI.LocalSettings.Attributes;
|
||||
using MiraAPI.Patches;
|
||||
using MiraAPI.Utilities;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI;
|
||||
|
||||
@@ -48,6 +49,10 @@ public class MiraApiSettings(ConfigFile config) : LocalSettingsTab(config)
|
||||
}
|
||||
OldButtonScaleFactor = ButtonUIFactorSlider.Value;
|
||||
}
|
||||
else if (configEntry == SetFpsSlider)
|
||||
{
|
||||
Application.targetFrameRate = (int)SetFpsSlider.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -69,6 +74,13 @@ public class MiraApiSettings(ConfigFile config) : LocalSettingsTab(config)
|
||||
public ConfigEntry<float> ButtonUIFactorSlider { get; private set; } =
|
||||
config.Bind("Visuals/UI", "Button Scale Factor", 0.75f);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the fps specified by the player.
|
||||
/// </summary>
|
||||
[LocalSliderSetting(min: 60f, max: 240f, suffixType: MiraNumberSuffixes.None, formatString: "0", displayValue: true, roundValue: true)]
|
||||
public ConfigEntry<float> SetFpsSlider { get; private set; } =
|
||||
config.Bind("Visuals/UI", "Frames Per Seconds", 120f);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to apply cosmetic changes to the TaskAdder.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using HarmonyLib;
|
||||
using MiraAPI.LocalSettings;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.Patches.Menu;
|
||||
|
||||
@@ -17,5 +19,6 @@ public static class MainMenuManagerPatches
|
||||
public static void AwakePostfix()
|
||||
{
|
||||
AddressablesLoader.LoadAll();
|
||||
Application.targetFrameRate = (int)LocalSettingsTabSingleton<MiraApiSettings>.Instance.SetFpsSlider.Value;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user