mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Spread wiki panel reveal over frames and show the ring immediately
This commit is contained in:
1 parent
5c0e5473a5
commit
ff17c946a4
1 file changed
+24
-4
@@ -27,6 +27,7 @@ public static class RoleGuidePatches
|
|||||||
{
|
{
|
||||||
private const int RolesTabIndex = 2;
|
private const int RolesTabIndex = 2;
|
||||||
private const int ModifiersTabIndex = 3;
|
private const int ModifiersTabIndex = 3;
|
||||||
|
private const int RevealPanelsPerFrame = 6;
|
||||||
|
|
||||||
private static readonly Dictionary<RoleBehaviour, DetailedPanel> RolePanels = [];
|
private static readonly Dictionary<RoleBehaviour, DetailedPanel> RolePanels = [];
|
||||||
private static readonly Dictionary<GameModifier, DetailedPanel> ModifierPanels = [];
|
private static readonly Dictionary<GameModifier, DetailedPanel> ModifierPanels = [];
|
||||||
@@ -57,6 +58,7 @@ public static class RoleGuidePatches
|
|||||||
private static bool _suppressSearchRefresh;
|
private static bool _suppressSearchRefresh;
|
||||||
private static IEnumerator? _reveal;
|
private static IEnumerator? _reveal;
|
||||||
private static bool _pendingRefresh;
|
private static bool _pendingRefresh;
|
||||||
|
private static int _revealedThisFrame;
|
||||||
private static LoadingRing? _loadingSpinner;
|
private static LoadingRing? _loadingSpinner;
|
||||||
private static SortingFilter _sortFilter = SortingFilter.EnabledOnly;
|
private static SortingFilter _sortFilter = SortingFilter.EnabledOnly;
|
||||||
private static SortingMethod _sortMethod = SortingMethod.Alphabetical;
|
private static SortingMethod _sortMethod = SortingMethod.Alphabetical;
|
||||||
@@ -575,17 +577,35 @@ public static class RoleGuidePatches
|
|||||||
Coroutines.Stop(_reveal);
|
Coroutines.Stop(_reveal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_panelsReady = false;
|
||||||
|
UpdateSpinner();
|
||||||
_reveal = Coroutines.Start(CoRevealActiveTab());
|
_reveal = Coroutines.Start(CoRevealActiveTab());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerator CoRevealActiveTab()
|
private static IEnumerator CoRevealActiveTab()
|
||||||
{
|
{
|
||||||
_panelsReady = false;
|
yield return null;
|
||||||
UpdateSpinner();
|
|
||||||
var modifiers = IsModifiersTabActive;
|
var modifiers = IsModifiersTabActive;
|
||||||
var toShow = modifiers ? UpdateModifierPanels(out _) : UpdateRolePanels(out _);
|
var toShow = modifiers ? UpdateModifierPanels(out _) : UpdateRolePanels(out _);
|
||||||
yield return toShow.Where(p => !p.Panel.gameObject.activeSelf)
|
var batch = 0;
|
||||||
.CoLoopWithBudget(p => p.Panel.gameObject.SetActive(true));
|
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)
|
if (modifiers)
|
||||||
{
|
{
|
||||||
_modifiersTabDirty = false;
|
_modifiersTabDirty = false;
|
||||||
|
|||||||
Reference in new issue
Block a user