Move App logic to other projects

This commit is contained in:
2025-03-07 01:08:35 -08:00
parent 3b5ee84ce2
commit 1cb79f5b30
49 changed files with 185 additions and 205 deletions

View File

@@ -0,0 +1,37 @@
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
using Zennysoft.Game.Abstractions;
namespace Zennysoft.Game.Ma.Implementation;
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());
}
}
}