From ff17c946a4783048bb792777ff34c297a92112f0 Mon Sep 17 00:00:00 2001 From: ReAdmin <170283204+rewalo@users.noreply.github.com> Date: Wed, 7 Oct 2026 03:03:51 -0700 Subject: [PATCH] Spread wiki panel reveal over frames and show the ring immediately --- MiraAPI/Patches/RoleGuidePatches.cs | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/MiraAPI/Patches/RoleGuidePatches.cs b/MiraAPI/Patches/RoleGuidePatches.cs index b0a9d5f..2dcd269 100644 --- a/MiraAPI/Patches/RoleGuidePatches.cs +++ b/MiraAPI/Patches/RoleGuidePatches.cs @@ -27,6 +27,7 @@ public static class RoleGuidePatches { private const int RolesTabIndex = 2; private const int ModifiersTabIndex = 3; + private const int RevealPanelsPerFrame = 6; private static readonly Dictionary RolePanels = []; private static readonly Dictionary ModifierPanels = []; @@ -57,6 +58,7 @@ public static class RoleGuidePatches private static bool _suppressSearchRefresh; private static IEnumerator? _reveal; private static bool _pendingRefresh; + private static int _revealedThisFrame; private static LoadingRing? _loadingSpinner; private static SortingFilter _sortFilter = SortingFilter.EnabledOnly; private static SortingMethod _sortMethod = SortingMethod.Alphabetical; @@ -575,17 +577,35 @@ public static class RoleGuidePatches Coroutines.Stop(_reveal); } + _panelsReady = false; + UpdateSpinner(); _reveal = Coroutines.Start(CoRevealActiveTab()); } private static IEnumerator CoRevealActiveTab() { - _panelsReady = false; - UpdateSpinner(); + yield return null; var modifiers = IsModifiersTabActive; var toShow = modifiers ? UpdateModifierPanels(out _) : UpdateRolePanels(out _); - yield return toShow.Where(p => !p.Panel.gameObject.activeSelf) - .CoLoopWithBudget(p => p.Panel.gameObject.SetActive(true)); + var batch = 0; + foreach (var holder in toShow) + { + var panel = holder.Panel.gameObject; + if (panel.activeSelf) + { + continue; + } + + panel.SetActive(true); + _revealedThisFrame++; + if (++batch >= RevealPanelsPerFrame) + { + batch = 0; + yield return null; + _revealedThisFrame = 0; + } + } + if (modifiers) { _modifiersTabDirty = false;