Major Player refactor
This commit is contained in:
@@ -1,29 +1,28 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace GameJamDungeon
|
||||
{
|
||||
public partial class AppLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record SetupGameScene : State, IGet<Input.LoadGameFinished>
|
||||
{
|
||||
public SetupGameScene()
|
||||
{
|
||||
this.OnEnter(() =>
|
||||
{
|
||||
Output(new Output.SetupGameScene());
|
||||
Output(new Output.ShowGame());
|
||||
Input(new Input.LoadGameFinished());
|
||||
});
|
||||
}
|
||||
namespace GameJamDungeon;
|
||||
|
||||
public Transition On(in Input.LoadGameFinished input)
|
||||
public partial class AppLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record SetupGameScene : State, IGet<Input.LoadGameFinished>
|
||||
{
|
||||
public SetupGameScene()
|
||||
{
|
||||
this.OnEnter(() =>
|
||||
{
|
||||
return To<InGame>();
|
||||
}
|
||||
Output(new Output.SetupGameScene());
|
||||
Output(new Output.ShowGame());
|
||||
Input(new Input.LoadGameFinished());
|
||||
});
|
||||
}
|
||||
|
||||
public Transition On(in Input.LoadGameFinished input)
|
||||
{
|
||||
return To<InGame>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace GameJamDungeon
|
||||
namespace GameJamDungeon;
|
||||
|
||||
public partial class AppLogic
|
||||
{
|
||||
public partial class AppLogic
|
||||
public partial record State
|
||||
{
|
||||
public partial record State
|
||||
[Meta]
|
||||
public partial record InGame : State, IGet<Input.GameOver>
|
||||
{
|
||||
[Meta]
|
||||
public partial record InGame : State, IGet<Input.GameOver>
|
||||
public InGame()
|
||||
{
|
||||
public InGame()
|
||||
|
||||
this.OnEnter(() =>
|
||||
{
|
||||
Get<IAppRepo>().OnEnterGame();
|
||||
Output(new Output.ShowGame());
|
||||
});
|
||||
this.OnExit(() => Output(new Output.HideGame()));
|
||||
|
||||
this.OnEnter(() =>
|
||||
{
|
||||
Get<IAppRepo>().OnEnterGame();
|
||||
Output(new Output.ShowGame());
|
||||
});
|
||||
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.GameOver());
|
||||
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.GameOver());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,33 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace GameJamDungeon
|
||||
{
|
||||
public partial class AppLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record MainMenu : State, IGet<Input.NewGame>, IGet<Input.QuitGame>
|
||||
{
|
||||
public MainMenu()
|
||||
{
|
||||
this.OnEnter(() =>
|
||||
{
|
||||
Get<IAppRepo>().OnMainMenuEntered();
|
||||
Output(new Output.ShowMainMenu());
|
||||
});
|
||||
}
|
||||
public Transition On(in Input.NewGame input)
|
||||
{
|
||||
Output(new Output.SetupGameScene());
|
||||
return To<LoadingScreen>();
|
||||
}
|
||||
namespace GameJamDungeon;
|
||||
|
||||
public Transition On(in Input.QuitGame input)
|
||||
public partial class AppLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record MainMenu : State, IGet<Input.NewGame>, IGet<Input.QuitGame>
|
||||
{
|
||||
public MainMenu()
|
||||
{
|
||||
this.OnEnter(() =>
|
||||
{
|
||||
Output(new Output.ExitGame());
|
||||
return ToSelf();
|
||||
}
|
||||
Get<IAppRepo>().OnMainMenuEntered();
|
||||
Output(new Output.ShowMainMenu());
|
||||
});
|
||||
}
|
||||
public Transition On(in Input.NewGame input)
|
||||
{
|
||||
Output(new Output.SetupGameScene());
|
||||
return To<LoadingScreen>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.QuitGame input)
|
||||
{
|
||||
Output(new Output.ExitGame());
|
||||
return ToSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user