Skip to content

Game.SceneFlow.ValidationScreen

Assembly:
Assembly-CSharp (Game)
{{ This class is part of the game's main assembly (Assembly-CSharp) and lives under the Game.SceneFlow namespace. It implements a simple modal validation overlay used by the scene flow to ask the player to proceed or cancel. }}

Namespace:
Game.SceneFlow

Type:
public class

Base:
FullScreenOverlay
{{ ValidationScreen inherits from FullScreenOverlay and overrides a small set of properties to configure which overlay screen and which localized display strings it uses. It also overrides Execute to implement the run-time behavior of the validation modal. }}

Summary:
{{ ValidationScreen shows a full-screen validation overlay (OverlayScreen.Validation) with two actions (proceed / back). It registers two temporary input actions (continue/cancel), creates an overlay input barrier, activates the overlay UI, waits asynchronously for the player's choice using IScreenState.WaitForInput, and then logs whether the user chose "OK" (proceed) or "Cancel". The method respects a CancellationToken so the wait can be aborted. }}


Fields

  • (none)
    {{ This class declares no instance fields. All state is managed via local variables in Execute and via inherited members. }}

Properties

  • protected override OverlayScreen overlayScreen { get }
    {{ Returns OverlayScreen.Validation. This tells the base FullScreenOverlay which overlay screen asset/state to activate when this screen runs. }}

  • protected override string continueDisplayProperty { get }
    {{ Returns the string "Proceed". This is the display key (or literal) used for the proceed/confirm action label in the overlay. }}

  • protected override string cancelDisplayProperty { get }
    {{ Returns the string "Back". This is the display key (or literal) used for the cancel/back action label in the overlay. }}

  • protected override int cancelDisplayPriority { get }
    {{ Returns 30. This configures the display priority for the cancel action (used by the input/overlay presentation system). }}

Constructors

  • (default constructor) public ValidationScreen()
    {{ No explicit constructors are declared in the source; the default parameterless constructor is used. No special initialization is required beyond what the base class does. }}

Methods

  • public override async Task Execute(GameManager manager, CancellationToken token)
    {{ This is the primary method that runs the validation flow.

Behavior summary: - Creates two EnabledActionScoped instances for the continue (actionA) and cancel (actionB) inputs. These are scoped disposables that register overlay input actions and map them to HandleScreenChange and the respective display strings/priorities. - Creates an overlay barrier via Game.Input.InputManager.instance.CreateOverlayBarrier("ValidationScreen") to prevent other input from interfering while the overlay is active. - Activates the overlay UI by using manager.userInterface.overlayBindings.ActivateScreenScoped(overlayScreen). - Waits asynchronously for input using IScreenState.WaitForInput(continueAction, cancelAction, null, token). The returned Task resolves to a tuple (bool ok, InputDevice device), where ok is true for continue and false for cancel. - If the wait completes successfully and ok is true, logs "OK" to UnityEngine.Debug; if ok is false, logs "Cancel". - The method respects cancellation via the provided CancellationToken and cleans up all scoped registrations via using blocks so actions and barriers are disposed even if cancelled.

Notes and caveats: - The method relies on actionA and actionB identifiers coming from the base class or surrounding context (these are referenced when creating EnabledActionScoped instances). Ensure those actions exist and are registered in the input system. - Logging is minimal ("OK" / "Cancel"); replace with the real follow-up flow (e.g., proceed with next scene or return) as appropriate for your mod. }}

Usage Example

// Example: invoking the ValidationScreen from a scene flow.
// Note: the scene flow framework or GameManager typically constructs and runs these screens.
// This snippet shows a simple manual call.

var validation = new ValidationScreen();
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30)); // optional timeout
await validation.Execute(gameManagerInstance, cts.Token);

{{ Alternative: if you are authoring a derived screen or integrating into a custom flow, run Execute from the flow manager and handle the result via the screen state system. Ensure the Game.Input.InputManager and overlayBindings are available on the GameManager instance passed in. }}