Revamp game pausing and input handling. Fix minigame tutorial and end sequence. (#39)
- Revamp pausing and centralize management in GameManager - Switch Pause implementation to be counter-based to solve corner case of multiple pause requests - Remove duplicated Pause logic from other components - Add pausing when browsing the card album - Fully deliver the exclusive UI implementation - Spruce up the MiniGame tutorial with correct pausing, hiding other UI - Correctly unpause after showing tutorial - Fix minigame ending sequence. The cinematic correctly plays only once now - Replaying the minigame works Co-authored-by: Michal Adam Pikulski <michal@foolhardyhorizons.com> Co-authored-by: Michal Pikulski <michal@foolhardyhorizons.com> Reviewed-on: #39
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user