Fix up the UI + game flow in minigame, should function correctly now

This commit is contained in:
Michal Pikulski
2025-10-24 13:01:19 +02:00
parent 1003c3f6ac
commit 04737ab01b
11 changed files with 919 additions and 1203 deletions

View File

@@ -23,6 +23,10 @@ namespace UI.Core
// Event fired when the page stack changes
public event Action<UIPage> OnPageChanged;
// Events fired when the controller hides or shows all UI pages
public event Action OnAllUIHidden;
public event Action OnAllUIShown;
private PlayerInput _playerInput;
private InputAction _cancelAction;
@@ -141,5 +145,39 @@ namespace UI.Core
OnPageChanged?.Invoke(null);
Logging.Debug("[UIPageController] Cleared page stack");
}
/// <summary>
/// Hide all currently stacked UI pages by calling TransitionOut on each.
/// This does not modify the page stack; it simply asks pages to transition out
/// so UI elements can be hidden. Subscribers can react to <see cref="OnAllUIHidden"/>.
/// </summary>
public void HideAllUI()
{
// Only transition out the top (active) page — maintains stack semantics.
var current = CurrentPage;
if (current != null)
{
current.TransitionOut();
}
OnAllUIHidden?.Invoke();
}
/// <summary>
/// Show all currently stacked UI pages by calling TransitionIn on each from bottom to top.
/// This does not modify the page stack; it asks pages to transition in so UI elements become visible.
/// Subscribers can react to <see cref="OnAllUIShown"/>.
/// </summary>
public void ShowAllUI()
{
// Only transition in the top (active) page — maintains stack semantics.
var current = CurrentPage;
if (current != null)
{
current.TransitionIn();
}
OnAllUIShown?.Invoke();
}
}
}