Move GameLogic to new project
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
public partial class GameLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record AskForTeleport : Playing, IGet<Input.FloorExitReached>, IGet<Input.HideAskForTeleport>
|
||||
{
|
||||
public AskForTeleport()
|
||||
{
|
||||
this.OnAttach(() => { Get<IGameRepo>().Pause(); Output(new Output.ShowAskForTeleport()); });
|
||||
this.OnDetach(() => { Output(new Output.HideAskForTeleport()); });
|
||||
}
|
||||
|
||||
public Transition On(in Input.FloorExitReached input) => To<FloorClearedDecisionState>();
|
||||
|
||||
public Transition On(in Input.HideAskForTeleport input)
|
||||
{
|
||||
return To<Playing>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://boai3f4vwgree
|
||||
@@ -0,0 +1,36 @@
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
public partial class GameLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record FloorClearedDecisionState : Playing, IGet<Input.GoToNextFloor>, IGet<Input.SaveGame>, IGet<Input.HideFloorClearMenu>
|
||||
{
|
||||
public FloorClearedDecisionState()
|
||||
{
|
||||
this.OnAttach(() => { Get<IGameRepo>().Pause(); Output(new Output.ShowFloorClearMenu()); });
|
||||
this.OnDetach(() => { Output(new Output.ExitFloorClearMenu()); });
|
||||
}
|
||||
|
||||
public Transition On(in Input.GoToNextFloor input)
|
||||
{
|
||||
Output(new Output.LoadNextFloor());
|
||||
return ToSelf();
|
||||
}
|
||||
|
||||
public Transition On(in Input.HideFloorClearMenu input)
|
||||
{
|
||||
return To<Playing>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.SaveGame input)
|
||||
{
|
||||
Output(new Output.SaveGame());
|
||||
return To<Playing>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://dw1wcux7lcpqy
|
||||
@@ -0,0 +1 @@
|
||||
uid://cpu75lmblmbj4
|
||||
@@ -0,0 +1,25 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
public partial class GameLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record InventoryOpened : Playing, IGet<Input.CloseInventory>
|
||||
{
|
||||
public InventoryOpened()
|
||||
{
|
||||
this.OnEnter(() => { Get<IGameRepo>().Pause(); Output(new Output.OpenInventory()); });
|
||||
this.OnExit(() => { Get<IGameRepo>().Resume(); Output(new Output.HideInventory()); });
|
||||
}
|
||||
|
||||
public Transition On(in Input.CloseInventory input)
|
||||
{
|
||||
return To<Playing>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://dmbireek8b68t
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
using Chickensoft.Introspection;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
|
||||
public partial class GameLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record MenuBackdrop : State, IGet<Input.StartGame>, IGet<Input.Initialize>
|
||||
{
|
||||
public MenuBackdrop()
|
||||
{
|
||||
OnAttach(() => Get<IAppRepo>().GameEntered += OnGameEntered);
|
||||
OnDetach(() => Get<IAppRepo>().GameEntered -= OnGameEntered);
|
||||
}
|
||||
|
||||
public void OnGameEntered() => Input(new Input.StartGame());
|
||||
|
||||
public Transition On(in Input.StartGame input)
|
||||
{
|
||||
Output(new Output.LoadMap());
|
||||
return To<Playing>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.Initialize input)
|
||||
{
|
||||
return ToSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://lwjsht36v6ut
|
||||
@@ -0,0 +1,22 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
public partial class GameLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record MinimapOpen : Playing, IGet<Input.MiniMapButtonReleased>
|
||||
{
|
||||
public MinimapOpen()
|
||||
{
|
||||
this.OnEnter(() => { Get<IGameRepo>().Pause(); Output(new Output.ShowMiniMap()); });
|
||||
this.OnExit(() => { Get<IGameRepo>().Resume(); Output(new Output.HideMiniMap()); });
|
||||
}
|
||||
|
||||
public Transition On(in Input.MiniMapButtonReleased input) => To<Playing>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://nlpm8t4dege2
|
||||
@@ -0,0 +1,26 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
public partial class GameLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record Paused : Playing, IGet<Input.UnpauseGame>
|
||||
{
|
||||
public Paused()
|
||||
{
|
||||
this.OnEnter(() =>
|
||||
{
|
||||
Get<IGameRepo>().Pause();
|
||||
Output(new Output.ShowPauseMenu());
|
||||
});
|
||||
this.OnExit(() => Output(new Output.ExitPauseMenu()));
|
||||
}
|
||||
|
||||
public virtual Transition On(in Input.UnpauseGame input) => To<Resuming>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://c46publoqhqsn
|
||||
@@ -0,0 +1,43 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
public partial class GameLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record Playing : State,
|
||||
IGet<Input.OpenInventory>,
|
||||
IGet<Input.MiniMapButtonPressed>,
|
||||
IGet<Input.GameOver>,
|
||||
IGet<Input.AskForTeleport>,
|
||||
IGet<Input.PauseGame>,
|
||||
IGet<Input.GoToOverworld>
|
||||
{
|
||||
public Playing()
|
||||
{
|
||||
OnAttach(() => Output(new Output.StartGame()));
|
||||
}
|
||||
|
||||
public void OnEnded() => Input(new Input.GameOver());
|
||||
|
||||
public Transition On(in Input.OpenInventory input) => To<InventoryOpened>();
|
||||
|
||||
public Transition On(in Input.MiniMapButtonPressed input) => To<MinimapOpen>();
|
||||
|
||||
public Transition On(in Input.GameOver input) => To<Quit>();
|
||||
|
||||
public Transition On(in Input.AskForTeleport input) => To<AskForTeleport>();
|
||||
|
||||
public Transition On(in Input.PauseGame input) => To<Paused>();
|
||||
|
||||
public Transition On(in Input.GoToOverworld input)
|
||||
{
|
||||
Output(new Output.GoToOverworld());
|
||||
return ToSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://i54nvesmcliy
|
||||
@@ -0,0 +1,19 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
public partial class GameLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record Quit : State
|
||||
{
|
||||
public Quit()
|
||||
{
|
||||
this.OnEnter(() => Output(new Output.ShowLostScreen()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://cq37bi3y07rxa
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
public partial class GameLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record Resuming : Playing, IGet<Input.PauseMenuTransitioned>
|
||||
{
|
||||
public Resuming()
|
||||
{
|
||||
this.OnEnter(() => Get<IGameRepo>().Resume());
|
||||
this.OnExit(() => Output(new Output.HidePauseMenu()));
|
||||
}
|
||||
|
||||
public Transition On(in Input.PauseMenuTransitioned input) =>
|
||||
To<Playing>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://clh8ucurjwuvh
|
||||
Reference in New Issue
Block a user