38 lines
874 B
C#
38 lines
874 B
C#
using Chickensoft.Introspection;
|
|
using Chickensoft.LogicBlocks;
|
|
using Zennysoft.Game.Abstractions;
|
|
|
|
namespace Zennysoft.Ma.Adapter;
|
|
|
|
public partial class AppLogic
|
|
{
|
|
public partial record State
|
|
{
|
|
[Meta]
|
|
public partial record InGame : State, IGet<Input.GameOver>
|
|
{
|
|
public InGame()
|
|
{
|
|
|
|
this.OnEnter(() =>
|
|
{
|
|
Output(new Output.ShowGame());
|
|
Get<IAppRepo>().OnEnterGame();
|
|
});
|
|
this.OnExit(() => Output(new Output.HideGame()));
|
|
|
|
OnAttach(() => Get<IAppRepo>().GameExited += OnGameExited);
|
|
OnDetach(() => Get<IAppRepo>().GameExited -= OnGameExited);
|
|
}
|
|
|
|
public Transition On(in Input.GameOver input)
|
|
{
|
|
Output(new Output.RemoveExistingGame());
|
|
return To<MainMenu>();
|
|
}
|
|
|
|
public void OnGameExited() => Input(new Input.QuitGame());
|
|
}
|
|
}
|
|
}
|