Skip to content

Game.SceneFlow.LoggedOutScreen

Assembly: Game
Namespace: Game.SceneFlow

Type: public class LoggedOutScreen

Base: FullScreenOverlay

Summary:
LoggedOutScreen is a full-screen overlay used when the current player is not signed in. It displays the "UserLoggedOut" overlay and waits for either user input (the configured "AnyKey" action) or a user-change event. On input it attempts to sign the user in via PlatformManager and shows a WaitScreen while sign-in is in progress. If sign-in succeeds the screen exits; if the active user changes while signed out and the game is in a playable/editor mode it redirects to the main menu. The screen cleans up overlay bindings and input barriers when finished.


Fields

  • This class does not declare its own private fields in this file.
    LoggedOutScreen relies on members provided by its base class (e.g., m_Done and m_CompletedEvent are referenced but defined in the inherited FullScreenOverlay / IScreenState implementations). There are no additional private fields declared in LoggedOutScreen.cs itself.

  • N/A
    No other private backing fields are declared here.

Properties

  • protected override OverlayScreen overlayScreen { get; }
    Returns OverlayScreen.UserLoggedOut. This tells the overlay system which screen to activate while this overlay is running.

  • protected override string actionA { get; }
    Returns "AnyKey". This is the input action name used to continue from the logged-out screen.

  • protected override string continueDisplayProperty { get; }
    Returns "Continue". This is the display text property key used for the continue prompt shown to the user.

Constructors

  • public LoggedOutScreen()
    No explicit constructor is defined in the file; the default parameterless constructor is used. Initialization is handled by the base class and by runtime behavior in Execute.

Methods

  • public override async Task Execute(GameManager manager, CancellationToken token)
    Primary entry point for the overlay. Behavior summary:
  • Creates an EnabledActionScoped for the configured continue action (category "Engagement", action "AnyKey") so the overlay can receive the continue input and show the associated display text.
  • Creates an overlay input barrier via Game.Input.InputManager.instance.CreateOverlayBarrier("LoggedOutScreen") to isolate overlay input.
  • Activates the UserLoggedOut overlay screen via manager.userInterface.overlayBindings.ActivateScreenScoped.
  • Enters a loop that runs until m_Done is set:
    • Concurrently waits for input (IScreenState.WaitForInput) or a user change (IScreenState.WaitForUser).
    • When input completes, calls PlatformManager.instance.SignIn(SignInOptions.None, UserChangingCallback) to attempt sign-in and waits for the resulting SignInFlags.
    • If SignInFlags.Success is present, sets m_Done = true to exit the screen.
    • If SignInFlags.UserChanged is present and the current game mode is a game/editor, calls manager.MainMenu() to return to the main menu (since the active user changed).
    • If the user-change task completes (or any other awaited task completes without input), sets m_Done = true to exit.
  • The loop invokes m_CompletedEvent when a wait ends to notify other waiting logic.
  • Properly disposes the scoped resources so overlays and input binding state are restored on exit.

The method accepts a CancellationToken to support early cancellation and uses a nested local callback (UserChangingCallback) to show a WaitScreen while sign-in is in progress.

  • void UserChangingCallback(Task signInTask) (local function inside Execute)
    Callback passed to PlatformManager.SignIn. It constructs and executes a WaitScreen to present progress while the sign-in Task is running:
  • new WaitScreen().Execute(manager, token, signInTask);
  • This keeps the UI responsive and communicates sign-in progress to the user.

Usage Example

// Typical usage is via the scene/flow manager, but you can call Execute directly:
// manager: GameManager instance provided by the game
// token: CancellationToken you control for cancellation

var loggedOutScreen = new Game.SceneFlow.LoggedOutScreen();
await loggedOutScreen.Execute(manager, token);

Notes and implementation details: - The class expects the overlay/input systems and platform sign-in APIs to be available (PlatformManager, Game.Input.InputManager, manager.userInterface.overlayBindings). - Input is scoped using EnabledActionScoped and an overlay barrier to avoid other UI or gameplay input interfering while the logged-out screen is active. - Sign-in is performed with SignInOptions.None; a longer sign-in flow is shown via a WaitScreen. If the active user changes mid-flow and the game was open, the manager is instructed to return to the main menu to reflect the user change.