Add back role guide preloading

This commit is contained in:
Atony committed 2026-11-11 22:52:00 -06:00
1 parent b0f0d19268
commit bc1913e352
2 files changed
+32

No files matched your search

@@ -0,0 +1,22 @@
using HarmonyLib;
namespace MiraAPI.Patches.Hud;
/// <summary>
/// Preloads the Mira wiki/role guide panels when a game starts so opening the guide
/// in-game does not cause a noticeable hitch.
/// </summary>
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.Awake))]
public static class MatchInfoGuidePreloadPatch
{
public static void Postfix()
{
if (!MatchInfoGuide.Instance)
{
return;
}
Warning("Preloading Match Info Guide...");
RoleGuidePatches.TriggerPreload(MatchInfoGuide.Instance);
}
}
+10
View File
@@ -216,6 +216,16 @@ public static class RoleGuidePatches
Coroutines.Start(CoPreload(__instance));
}
public static void TriggerPreload(MatchInfoGuide instance)
{
if (!instance || _populate != null)
{
return;
}
Coroutines.Start(CoPreload(instance));
}
private static IEnumerator CoPreload(MatchInfoGuide instance)
{
while (instance && (!HudManager.InstanceExists || !GameManager.Instance))