Set up some loading logic and app/main menu logicblocks
This commit is contained in:
@@ -30,7 +30,7 @@ public partial class AppLogic
|
||||
return To<MainMenu>();
|
||||
}
|
||||
|
||||
public void OnGameExited() => Input(new Input.GameOver());
|
||||
public void OnGameExited() => Input(new Input.QuitGame());
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/app/state/states/AppLogic.State.LeavingMenu.cs
Normal file
24
src/app/state/states/AppLogic.State.LeavingMenu.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace GameJamDungeon;
|
||||
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
public partial class AppLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record LeavingMenu : State, IGet<Input.FadeOutFinished>
|
||||
{
|
||||
public LeavingMenu()
|
||||
{
|
||||
this.OnEnter(() => Output(new Output.FadeToBlack()));
|
||||
}
|
||||
|
||||
public Transition On(in Input.FadeOutFinished input) =>
|
||||
Get<Data>().ShouldLoadExistingGame
|
||||
? To<LoadingSaveFile>()
|
||||
: To<InGame>();
|
||||
}
|
||||
}
|
||||
}
|
||||
20
src/app/state/states/AppLogic.State.LoadingSaveFile.cs
Normal file
20
src/app/state/states/AppLogic.State.LoadingSaveFile.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace GameJamDungeon;
|
||||
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
public partial class AppLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record LoadingSaveFile : State, IGet<Input.SaveFileLoaded>
|
||||
{
|
||||
public LoadingSaveFile()
|
||||
{
|
||||
this.OnEnter(() => Output(new Output.StartLoadingSaveFile()));
|
||||
}
|
||||
public Transition On(in Input.SaveFileLoaded input) => To<InGame>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,20 +8,28 @@ public partial class AppLogic
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record MainMenu : State, IGet<Input.NewGame>, IGet<Input.QuitGame>
|
||||
public partial record MainMenu : State, IGet<Input.NewGame>, IGet<Input.LoadGame>, IGet<Input.QuitGame>
|
||||
{
|
||||
public MainMenu()
|
||||
{
|
||||
this.OnEnter(() =>
|
||||
{
|
||||
Get<Data>().ShouldLoadExistingGame = false;
|
||||
Output(new Output.SetupGameScene());
|
||||
Get<IAppRepo>().OnMainMenuEntered();
|
||||
Output(new Output.ShowMainMenu());
|
||||
});
|
||||
}
|
||||
|
||||
public Transition On(in Input.NewGame input)
|
||||
{
|
||||
Output(new Output.SetupGameScene());
|
||||
return To<LoadingScreen>();
|
||||
return To<LeavingMenu>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.LoadGame input)
|
||||
{
|
||||
Get<Data>().ShouldLoadExistingGame = true;
|
||||
return To<LeavingMenu>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.QuitGame input)
|
||||
@@ -1,29 +0,0 @@
|
||||
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());
|
||||
});
|
||||
}
|
||||
|
||||
public Transition On(in Input.LoadGameFinished input)
|
||||
{
|
||||
return To<InGame>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
src/app/state/states/AppLogic.State.SplashScreen.cs
Normal file
32
src/app/state/states/AppLogic.State.SplashScreen.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
namespace GameJamDungeon;
|
||||
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
public partial class AppLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record SplashScreen : State, IGet<Input.FadeOutFinished>
|
||||
{
|
||||
public SplashScreen()
|
||||
{
|
||||
this.OnEnter(() => Output(new Output.ShowSplashScreen()));
|
||||
|
||||
OnAttach(
|
||||
() => Get<IAppRepo>().SplashScreenSkipped += OnSplashScreenSkipped
|
||||
);
|
||||
|
||||
OnDetach(
|
||||
() => Get<IAppRepo>().SplashScreenSkipped -= OnSplashScreenSkipped
|
||||
);
|
||||
}
|
||||
|
||||
public Transition On(in Input.FadeOutFinished input) => To<MainMenu>();
|
||||
|
||||
public void OnSplashScreenSkipped() =>
|
||||
Output(new Output.HideSplashScreen());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace GameJamDungeon;
|
||||
|
||||
public partial class AppLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record LoadingScreen : State, IGet<Input.LoadGameFinished>
|
||||
{
|
||||
public LoadingScreen()
|
||||
{
|
||||
this.OnEnter(() =>
|
||||
{
|
||||
Output(new Output.ShowLoadingScreen());
|
||||
});
|
||||
}
|
||||
|
||||
public Transition On(in Input.LoadGameFinished input) => To<InGame>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user