Class CancelReturnNavigator
The cancel-returns-to-the-opener contract shared by every standalone display view: poll Cancel while shown, route back to the view that opened this one, and pop the navigation-history entry that opener pushed on the way in.
Inherited Members
Namespace: Serenity.Global.Infrastructure.Views
Assembly: Serenity.UnityGlobal.Infrastructure.dll
Syntax
public sealed class CancelReturnNavigator
Remarks
Extracted from UnityLeaderboardView when the achievements screen needed the same behaviour. It
is one piece of knowledge, not two similar-looking ones: the arming guard, the resolvability check and
the history pop only work as a set, and a second hand-written copy is how two screens end up
disagreeing about what Cancel does.
Not a MonoBehaviour: it owns no scene state and has no lifecycle of its own, so the view that
owns it drives TickCancelInput() from its own Update — the collaborator-not-facet
rule.
Constructors
CancelReturnNavigator(IViewRouter, IViewBrowserService, Func<string>, Action)
Creates the navigator.
Declaration
public CancelReturnNavigator(IViewRouter viewRouter, IViewBrowserService viewBrowserService, Func<string> resolveReturnViewId, Action hideOwner)
Parameters
| Type | Name | Description |
|---|---|---|
| IViewRouter | viewRouter | Router used to show the return target. May be |
| IViewBrowserService | viewBrowserService | Navigation history the opener's entry is popped from. May be |
| Func<string> | resolveReturnViewId | Answers the id to return to, re-read on every press so a definition edit is honoured. |
| Action | hideOwner | Dismisses the owning view when there is nothing to return to. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
Methods
ResetArming()
Re-arms the polling, so the keystroke that opened the owning view is swallowed instead of immediately closing it again. Called every time the view is shown.
Declaration
public void ResetArming()
ReturnToOpener()
Returns to the opener, or dismisses the owning view when there is nothing resolvable to return to. Also the entry point for an on-screen Back control, which has no input polling to go through.
Declaration
public void ReturnToOpener()
TickCancelInput()
Polls Cancel (Escape/Backspace/gamepad East) and returns to the opener when it is pressed. Called once per frame by the owning view while it is shown.
Declaration
public void TickCancelInput()