Stages/OptionsStage.cs
namespace BlockParty;

/// <summary>
/// Options menu reached from the title screen. A Razor menu stage (like <see cref="TitleStage"/>)
/// hosting the shared <see cref="OptionsMenuController"/> volume UI. BACK fades back to the title.
/// </summary>
public sealed class OptionsStage : MenuStageBase
{
	public OptionsMenuController Controller { get; } = new();

	private OptionsScreen _screen;

	public OptionsStage( GameManager manager ) : base( manager )
	{
		Controller.OnBack = () => FadeToStage( new TitleStage( Manager ) );
	}

	protected override void OnEnter()
	{
		SpawnBackgroundBlocks();

		var go = CreateUiRoot();
		_screen = go.Components.Create<OptionsScreen>();
		_screen.Stage = this;
	}

	public override void Tick( float dt )
	{
		base.Tick( dt );

		// Lock input once we've committed to leaving (matches the title menu's exit lock).
		if ( !IsFadingOut )
			Controller.Tick( dt );
	}
}