Game.SceneFlow.WaitScreen
Assembly:
Assembly-CSharp (typical Unity/CS mod assembly)
Namespace:
Game.SceneFlow
Type:
public class
Base:
System.Object
Summary:
Helper class that displays the game's "Wait" overlay while awaiting completion of an asynchronous task. It creates an input overlay barrier and activates the Wait overlay screen for the duration of the awaited task. The class does not define any lifecycle beyond the single Execute method and relies on disposables returned by InputManager and OverlayBindings to restore state when the wait completes.
Fields
private const OverlayScreen k_OverlayScreen
Constant identifying the overlay screen to activate. Value: OverlayScreen.Wait. Used when calling ActivateScreenScoped to show the wait overlay.
Properties
- None
Constructors
public WaitScreen()
Implicit default constructor (no explicit constructor defined in source).
Methods
public async Task Execute(GameManager manager, CancellationToken token, Task taskToWaitFor)
Starts the wait UI and awaits the provided task. Behavior details:- Creates an input overlay barrier via InputManager.instance.CreateOverlayBarrier("WaitScreen") to block or redirect input while waiting.
- Activates the overlay screen scoped to OverlayScreen.Wait using manager.userInterface.overlayBindings.ActivateScreenScoped(OverlayScreen.Wait).
- Awaits the provided taskToWaitFor. The overlay and input barrier are disposed when the awaited task completes or faults.
- Note: the provided CancellationToken parameter is currently unused in the implementation — cancellation of the wait is governed by the awaited task itself. If taskToWaitFor faults, the exception will propagate to the caller of Execute.
Usage Example
// Show the wait overlay while waiting for some asynchronous work to finish.
var waitScreen = new WaitScreen();
await waitScreen.Execute(manager, CancellationToken.None, someBackgroundTask);
Additional notes: - The use of using blocks ensures proper disposal of the overlay barrier and the activated overlay screen even if the awaited task throws. - If you need cancellable waiting from the UI side, you must pass a task that observes cancellation (the token parameter here is not used by Execute).