[+] AntiLag allow running in background

This commit is contained in:
Clansty 2025-05-02 18:02:46 +08:00
parent b34599b2dd
commit fbc0d33d40
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134

View File

@ -12,6 +12,9 @@ namespace AquaMai.Mods.Utils;
zh: "奇妙的防掉帧,如果你有莫名其妙的掉帧,可以试试这个")]
public class AntiLag : MonoBehaviour
{
[ConfigEntry(zh: "游戏未取得焦点时也运行")]
private static readonly bool activateWhileBackground = false;
[HarmonyPostfix]
[HarmonyPatch(typeof(GameMainObject), "Awake")]
public static void OnGameMainObjectAwake()
@ -34,7 +37,7 @@ public class AntiLag : MonoBehaviour
private void OnTimer()
{
if (!Application.isFocused) return;
if (!Application.isFocused && !activateWhileBackground) return;
#if DEBUG
MelonLogger.Msg("[AntiLag] Trigger");
#endif