Game.SceneFlow.CorruptSaveDataScreen
Assembly:
Game (Assembly-CSharp)
Namespace:
Game.SceneFlow
Type:
public class
Base:
FullScreenOverlay
Summary:
CorruptSaveDataScreen is a fullscreen overlay used to inform the player about a corrupt save and wait for a simple acknowledge input. It activates the CorruptSaveData overlay, registers a single "AnyKey" engagement action so the player can continue, and awaits input (or cancellation) before exiting. All input bindings and overlay resources are managed with scoped disposables to ensure they are cleaned up automatically.
Fields
- This type declares no instance fields.
{{ The class relies on local scoped variables and disposables inside Execute rather than storing fields. }}
Properties
-
protected override OverlayScreen overlayScreen { get; }
{{ Returns OverlayScreen.CorruptSaveData. Used to select which overlay is activated when the screen runs. }} -
protected override string actionA { get; }
{{ Returns the string "AnyKey" and represents the primary action label bound for continuing from this screen. }}
Constructors
public CorruptSaveDataScreen()
{{ Implicit parameterless constructor (no explicit constructors are declared). Instances are typically created by the scene/flow system or by mods that integrate custom scene transitions. }}
Methods
public override async Task Execute(GameManager manager, CancellationToken token)
{{ Execution flow:- Creates an EnabledActionScoped named continueAction to register an "Engagement" action bound to actionA ("AnyKey"). The scoped object ensures the action is enabled while the screen is active and removed on disposal.
- Creates an overlay input barrier via InputManager.instance.CreateOverlayBarrier("CorruptSaveDataScreen") to route input appropriately while the overlay is shown.
- Activates the overlay UI for OverlayScreen.CorruptSaveData using manager.userInterface.overlayBindings.ActivateScreenScoped, again relying on a scoped disposable to automatically deactivate the overlay when finished.
- Awaits IScreenState.WaitForInput(continueAction, null, null, token) which completes when the player activates the continue action or when the CancellationToken is triggered.
- All resources (action registration, overlay barrier and overlay activation) are disposed when the method completes or the token cancels, so no manual cleanup is required.
Notes for modders: - Call this method from an appropriate context (game/flow coroutine or async handler) and pass a CancellationToken for safe aborting. - InputManager.instance and manager.userInterface.overlayBindings must be available/initialized when calling Execute. - Because the method is async and uses await, exceptions (including OperationCanceledException when token is canceled) will propagate through the returned Task; handle them as needed. }}
Usage Example
// Example: run the CorruptSaveDataScreen and allow cancellation.
var screen = new CorruptSaveDataScreen();
using var cts = new CancellationTokenSource();
// Call from an async context. In-game you would typically call this as part of scene flow.
try
{
await screen.Execute(manager, cts.Token);
}
catch (OperationCanceledException)
{
// Handle cancellation if needed
}
{{ YOUR_INFO }}