ReWorked some code to fit more like GameDemo example.
This commit is contained in:
2
assets
2
assets
Submodule assets updated: 37af2de434...235643b054
@@ -86,6 +86,7 @@ public partial class App : CanvasLayer, IApp
|
|||||||
// GD.Print(string.Join(',', AppRepo.ModManger.AllMods.GetMods()));
|
// GD.Print(string.Join(',', AppRepo.ModManger.AllMods.GetMods()));
|
||||||
AppLogic = new AppLogic();
|
AppLogic = new AppLogic();
|
||||||
AppLogic.Set(AppRepo);
|
AppLogic.Set(AppRepo);
|
||||||
|
AppLogic.Set(new AppLogic.Data());
|
||||||
|
|
||||||
OptionConfig = new TestConfig();
|
OptionConfig = new TestConfig();
|
||||||
((TestConfig)OptionConfig).OnSettingChanged += AppRepo.OnSettingChanged;
|
((TestConfig)OptionConfig).OnSettingChanged += AppRepo.OnSettingChanged;
|
||||||
@@ -108,10 +109,10 @@ public partial class App : CanvasLayer, IApp
|
|||||||
GameViewPort.Scaling3DScale = setting.Value.As<float>() / 100f;
|
GameViewPort.Scaling3DScale = setting.Value.As<float>() / 100f;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_binding.On((in IAppRepo.GameExiting exiting) =>
|
// _binding.On((in IAppRepo.GameExiting exiting) =>
|
||||||
{
|
// {
|
||||||
AppLogic.Input(new AppLogicState.Input.EndGame(ExitGameReason.QuitToMenu));
|
// AppLogic.Input(new AppLogicState.Input.EndGame(AppLogic.Get<AppLogic.Data>().ExitGameReason));
|
||||||
});
|
// });
|
||||||
MainMenu.NewGame += OnNewGame;
|
MainMenu.NewGame += OnNewGame;
|
||||||
MainMenu.LastGame += () =>
|
MainMenu.LastGame += () =>
|
||||||
{
|
{
|
||||||
@@ -159,6 +160,8 @@ public partial class App : CanvasLayer, IApp
|
|||||||
|
|
||||||
MainMenu.SetLastGameVisible(fileSystem.File.Exists(Path.Combine(OS.GetUserDataDir(), "lastGame.txt")));
|
MainMenu.SetLastGameVisible(fileSystem.File.Exists(Path.Combine(OS.GetUserDataDir(), "lastGame.txt")));
|
||||||
|
|
||||||
|
ModsMenu.ExitModMenu += OnMenuExit;
|
||||||
|
|
||||||
this.Provide();
|
this.Provide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,28 +20,31 @@ package App-Type [[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGa
|
|||||||
[Methods]
|
[Methods]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:33 _Notification()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:33 _Notification()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:70 BindSetting()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:70 BindSetting()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:299 GetLevels()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:302 GetLevels()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:252 GetSaves()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:255 GetSaves()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:288 HideMenus()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:291 HideMenus()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:72 Initialize()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:72 Initialize()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:270 OnExitTree()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:273 OnExitTree()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:165 OnLastGame()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:168 OnLastGame()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:174 OnLoadGame()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:177 OnLoadGame()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:175 OnLoadSaveGame()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:178 OnLoadSaveGame()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:172 OnMenuExit()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:175 OnMenuExit()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:187 OnMods()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:190 OnMods()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:173 OnNewGame()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:176 OnNewGame()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:186 OnOptions()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:189 OnOptions()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:189 OnReady()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:192 OnReady()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:283 OnResolved()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:286 OnResolved()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:260 OnSaveFileLoaded()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:263 OnSaveFileLoaded()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:266 Setup()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:269 Setup()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:306 Value()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/App.cs:309 Value()]]
|
||||||
}
|
}
|
||||||
class AppLogic {
|
class AppLogic {
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/AppLogic.cs ScriptFile]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/AppLogic.cs ScriptFile]]
|
||||||
[Constructors]
|
[Constructors]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/AppLogic.cs:12 AppLogic]]()
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/AppLogic.cs:14 AppLogic]]()
|
||||||
|
--
|
||||||
|
[Methods]
|
||||||
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/App/AppLogic.cs:19 OnStartSubscriptions()]]
|
||||||
}
|
}
|
||||||
package Game-Type [[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs]] {
|
package Game-Type [[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs]] {
|
||||||
class Game {
|
class Game {
|
||||||
@@ -59,32 +62,31 @@ package App-Type [[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGa
|
|||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:38 SaveFile]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:38 SaveFile]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:41 SaveFilePath]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:41 SaveFilePath]]
|
||||||
--
|
--
|
||||||
[Interface Methods]
|
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:162 LoadGame()]]
|
|
||||||
[Methods]
|
[Methods]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:33 _Notification()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:33 _Notification()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:218 _UnhandledInput()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:218 _UnhandledInput()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:169 HideMenus()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:132 HideMenus()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:71 Initialize()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:71 Initialize()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:232 Load()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:232 Load()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:233 LoadExistingGame()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:233 LoadExistingGame()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:198 OnExitTree()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:125 LoadGame()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:103 OnReady()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:162 OnExitTree()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:201 OnResolved()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:102 OnReady()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:82 OnSaveButton()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:165 OnResolved()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:97 OpenOptions()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:81 OnSaveButton()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:85 PauseButtonPressed()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:96 OpenOptions()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:84 QuitToDesktop()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:84 PauseButtonPressed()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:83 QuitToMainMenu()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:83 QuitToDesktop()]]
|
||||||
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:82 QuitToMainMenu()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:228 Save()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:228 Save()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:143 SaveGame()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:106 SaveGame()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:155 SaveGame2()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:118 SaveGame2()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:175 Setup()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/Game.cs:138 Setup()]]
|
||||||
}
|
}
|
||||||
class GameLogicState {
|
class GameLogicState {
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/GameLogicState.cs ScriptFile]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/GameLogicState.cs ScriptFile]]
|
||||||
[Constructors]
|
[Constructors]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/GameLogicState.cs:14 GameLogic]]()
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/Game/GameLogicState.cs:15 GameLogic]]()
|
||||||
}
|
}
|
||||||
class PauseMenu {
|
class PauseMenu {
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/PauseMenu/PauseMenu.cs ScriptFile]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/PauseMenu/PauseMenu.cs ScriptFile]]
|
||||||
@@ -149,18 +151,21 @@ package App-Type [[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGa
|
|||||||
class ModMenu {
|
class ModMenu {
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs ScriptFile]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs ScriptFile]]
|
||||||
[Properties]
|
[Properties]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:15 ModEntryScene]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:27 BackButton]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:17 ModManger]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:26 DisableAllButton]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:18 ModsContainer]] - [[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ReorderableContainer/ReOrderableContainer.cs Script]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:25 EnableAllButton]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:19 ProfilesButton]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:20 ModEntryScene]]
|
||||||
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:22 ModManger]]
|
||||||
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:23 ModsContainer]] - [[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ReorderableContainer/ReOrderableContainer.cs Script]]
|
||||||
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:24 ProfilesButton]]
|
||||||
--
|
--
|
||||||
[Methods]
|
[Methods]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:74 _ExitTree()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:83 _ExitTree()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:14 _Notification()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:17 _Notification()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:26 OnModProfileSelected()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:35 OnModProfileSelected()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:20 OnResolved()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:28 OnResolved()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:32 OnVisibilityChanged()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:41 OnVisibilityChanged()]]
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:40 RefreshMods()]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ModMenu/ModMenu.cs:49 RefreshMods()]]
|
||||||
}
|
}
|
||||||
class ReOrderableContainer {
|
class ReOrderableContainer {
|
||||||
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ReorderableContainer/ReOrderableContainer.cs ScriptFile]]
|
[[vscode://file//home/ronnie/Documents/Godot/Projects/ChickenGameTest/src/ReorderableContainer/ReOrderableContainer.cs ScriptFile]]
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
namespace FoodFactory;
|
namespace FoodFactory;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Chickensoft.Introspection;
|
using Chickensoft.Introspection;
|
||||||
using Chickensoft.LogicBlocks;
|
using Chickensoft.LogicBlocks;
|
||||||
using Chickensoft.LogicBlocks.Auto;
|
using Chickensoft.LogicBlocks.Auto;
|
||||||
@@ -14,4 +16,9 @@ public partial class AppLogic : AutoBlock, IAppLogic
|
|||||||
Preallocate<AppLogicState>();
|
Preallocate<AppLogicState>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public override IEnumerable<IDisposable> OnStartSubscriptions()
|
||||||
|
{
|
||||||
|
yield return Get<IAppRepo>().AutoChannel.Bind()
|
||||||
|
.On((in IAppRepo.GameExiting message) => (State as AppLogicState.InGame)?.OnGameExited(message.Reason));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ state "AppLogicState" as FoodFactory_AppLogicState {
|
|||||||
|
|
||||||
FoodFactory_AppLogicState_CreatingGame --> FoodFactory_AppLogicState_InGame : NewGame
|
FoodFactory_AppLogicState_CreatingGame --> FoodFactory_AppLogicState_InGame : NewGame
|
||||||
FoodFactory_AppLogicState_CreatingGame --> FoodFactory_AppLogicState_MainMenu : ExitMenu
|
FoodFactory_AppLogicState_CreatingGame --> FoodFactory_AppLogicState_MainMenu : ExitMenu
|
||||||
FoodFactory_AppLogicState_InGame --> FoodFactory_AppLogicState_MainMenu : EndGame
|
FoodFactory_AppLogicState_InGame --> FoodFactory_AppLogicState_LeavingGame : EndGame
|
||||||
FoodFactory_AppLogicState_LeavingGame --> FoodFactory_AppLogicState_MainMenu : EndGame
|
FoodFactory_AppLogicState_LeavingGame --> FoodFactory_AppLogicState_MainMenu : EndGame
|
||||||
FoodFactory_AppLogicState_LoadingGame --> FoodFactory_AppLogicState_InGame : LoadSave
|
FoodFactory_AppLogicState_LoadingGame --> FoodFactory_AppLogicState_InGame : LoadSave
|
||||||
FoodFactory_AppLogicState_LoadingGame --> FoodFactory_AppLogicState_MainMenu : ExitMenu
|
FoodFactory_AppLogicState_LoadingGame --> FoodFactory_AppLogicState_MainMenu : ExitMenu
|
||||||
@@ -24,7 +24,6 @@ FoodFactory_AppLogicState_OptionMenu --> FoodFactory_AppLogicState_MainMenu : Ex
|
|||||||
|
|
||||||
FoodFactory_AppLogicState_CreatingGame : OnEnter → ShowGameCreationWindow
|
FoodFactory_AppLogicState_CreatingGame : OnEnter → ShowGameCreationWindow
|
||||||
FoodFactory_AppLogicState_CreatingGame : OnNewGame → SetUpGameScene
|
FoodFactory_AppLogicState_CreatingGame : OnNewGame → SetUpGameScene
|
||||||
FoodFactory_AppLogicState_InGame : OnEndGame → RemoveExistingGame
|
|
||||||
FoodFactory_AppLogicState_InGame : OnEnter → ShowGame
|
FoodFactory_AppLogicState_InGame : OnEnter → ShowGame
|
||||||
FoodFactory_AppLogicState_LeavingGame : OnEndGame → QuitGame, RemoveExistingGame
|
FoodFactory_AppLogicState_LeavingGame : OnEndGame → QuitGame, RemoveExistingGame
|
||||||
FoodFactory_AppLogicState_LoadingGame : OnEnter → ShowGameLoadingWindow
|
FoodFactory_AppLogicState_LoadingGame : OnEnter → ShowGameLoadingWindow
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ using TrimKit.VirtualFileSystem;
|
|||||||
public interface IAppRepo : IDisposable
|
public interface IAppRepo : IDisposable
|
||||||
{
|
{
|
||||||
readonly record struct GameEntering;
|
readonly record struct GameEntering;
|
||||||
readonly record struct GameExiting;
|
readonly record struct GameExiting(ExitGameReason Reason);
|
||||||
readonly record struct GameSettingChanged(IOptionKey Setting, Variant Value);
|
readonly record struct GameSettingChanged(IOptionKey Setting, Variant Value);
|
||||||
void OnEnteringGame();
|
void OnEnteringGame();
|
||||||
void OnExitGame();
|
void OnExitGame(ExitGameReason reason = ExitGameReason.QuitToMenu);
|
||||||
void OnSettingChanged(IOptionKey setting, Variant value);
|
void OnSettingChanged(IOptionKey setting, Variant value);
|
||||||
IAutoChannel AutoChannel { get; }
|
IAutoChannel AutoChannel { get; }
|
||||||
IModManger ModManger { get; }
|
IModManger ModManger { get; }
|
||||||
@@ -30,7 +30,7 @@ public class AppRepo : IAppRepo
|
|||||||
public required IModManger ModManger {get;init;}
|
public required IModManger ModManger {get;init;}
|
||||||
|
|
||||||
public void OnEnteringGame() => _autoChannel.Send(new IAppRepo.GameEntering());
|
public void OnEnteringGame() => _autoChannel.Send(new IAppRepo.GameEntering());
|
||||||
public void OnExitGame() => _autoChannel.Send(new IAppRepo.GameExiting());
|
public void OnExitGame(ExitGameReason reason = ExitGameReason.QuitToMenu) => _autoChannel.Send(new IAppRepo.GameExiting(reason));
|
||||||
public void OnSettingChanged(IOptionKey setting, Variant value) => _autoChannel.Send(new IAppRepo.GameSettingChanged(setting, value));
|
public void OnSettingChanged(IOptionKey setting, Variant value) => _autoChannel.Send(new IAppRepo.GameSettingChanged(setting, value));
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
@@ -57,3 +57,10 @@ public class AppRepo : IAppRepo
|
|||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public partial class AppLogic
|
||||||
|
{
|
||||||
|
public record Data
|
||||||
|
{
|
||||||
|
public ExitGameReason ExitGameReason { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,9 +20,11 @@ public partial record AppLogicState
|
|||||||
public Type On(in Input.EndGame input)
|
public Type On(in Input.EndGame input)
|
||||||
{
|
{
|
||||||
// return To<LeavingGame>();
|
// return To<LeavingGame>();
|
||||||
|
Get<AppLogic.Data>().ExitGameReason = input.Reason;
|
||||||
|
return To<LeavingGame>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnGameExited(ExitGameReason reason) => Input(new Input.EndGame(reason));
|
||||||
|
|
||||||
Output(new Output.RemoveExistingGame());
|
|
||||||
return To<MainMenu>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,14 +13,16 @@ public partial record AppLogicState
|
|||||||
{
|
{
|
||||||
this.OnEnter(() =>
|
this.OnEnter(() =>
|
||||||
{
|
{
|
||||||
|
Input(new Input.EndGame());//PlaceHolder
|
||||||
// Output(new Output.ShowGame());
|
// Output(new Output.ShowGame());
|
||||||
});
|
});
|
||||||
|
this.OnExit(()=> Get<AppLogic.Data>().ExitGameReason = ExitGameReason.QuitToMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Type On(in Input.EndGame input){
|
public Type On(in Input.EndGame input){
|
||||||
|
var reason = Get<AppLogic.Data>().ExitGameReason;
|
||||||
Output(new Output.RemoveExistingGame());
|
Output(new Output.RemoveExistingGame());
|
||||||
if (input.Reason == ExitGameReason.QuitToDesktop)
|
if (reason is ExitGameReason.QuitToDesktop)
|
||||||
{
|
{
|
||||||
Output(new Output.QuitGame());
|
Output(new Output.QuitGame());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ public partial class Game : Node3D, IGame
|
|||||||
PauseMenu.OnQuitToMainMenu += QuitToMainMenu;
|
PauseMenu.OnQuitToMainMenu += QuitToMainMenu;
|
||||||
PauseMenu.OnQuitToDesktop += QuitToDesktop;
|
PauseMenu.OnQuitToDesktop += QuitToDesktop;
|
||||||
PauseMenu.OnSave += OnSaveButton;
|
PauseMenu.OnSave += OnSaveButton;
|
||||||
GameLogic = new GameLogic();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSaveButton() => GameLogic.Input(new GameLogicState.Input.SaveRequested());
|
private void OnSaveButton() => GameLogic.Input(new GameLogicState.Input.SaveRequested());
|
||||||
@@ -102,42 +101,6 @@ public partial class Game : Node3D, IGame
|
|||||||
|
|
||||||
public void OnReady()
|
public void OnReady()
|
||||||
{
|
{
|
||||||
GameBinding = GameLogic.Bind();
|
|
||||||
GameBinding.OnOutput((in GameLogicState.Output.SetPauseMode _) =>
|
|
||||||
{
|
|
||||||
GetTree().Paused = !GetTree().Paused;
|
|
||||||
}).OnOutput((in GameLogicState.Output.ShowOptionMenu _) =>
|
|
||||||
{
|
|
||||||
HideMenus();
|
|
||||||
OptionsMenu.Show();
|
|
||||||
})
|
|
||||||
// .OnOutput((in GameLogicState.Output.ShowOptionMenu _) =>
|
|
||||||
// {
|
|
||||||
// OptionsMenu.Hide();
|
|
||||||
// })
|
|
||||||
.OnOutput((in GameLogicState.Output.ShowPauseMenu _) =>
|
|
||||||
{
|
|
||||||
HideMenus();
|
|
||||||
PauseMenu.Show();
|
|
||||||
})
|
|
||||||
.OnOutput((in GameLogicState.Output.HideMenus _) => HideMenus())
|
|
||||||
.OnOutput((in GameLogicState.Output.StartSaving _) => SaveGame2())
|
|
||||||
.OnInput((in GameLogicState.Input.SaveCompleted _) => {
|
|
||||||
var path = Path.Combine(OS.GetUserDataDir(), "lastGame.txt");
|
|
||||||
File.WriteAllText(path,SaveService.FilePath);
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// .OnOutput((in GameLogicState.Output.ExitPauseMenu _) =>
|
|
||||||
// {
|
|
||||||
// HideMenus();
|
|
||||||
// })
|
|
||||||
// .OnOutput((in GameLogicState.Output.HidePauseMenu _) =>
|
|
||||||
// {
|
|
||||||
// PauseMenu.Hide();
|
|
||||||
// })
|
|
||||||
;
|
|
||||||
GameLogic.Start<GameLogicState.Playing>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async ValueTask SaveGame()
|
private async ValueTask SaveGame()
|
||||||
@@ -175,6 +138,7 @@ throw;
|
|||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
GameLogic = new GameLogic();
|
||||||
GameRepo = new GameRepo();
|
GameRepo = new GameRepo();
|
||||||
GameLogic.Set(GameRepo);
|
GameLogic.Set(GameRepo);
|
||||||
GameLogic.Set(AppRepo);
|
GameLogic.Set(AppRepo);
|
||||||
@@ -213,6 +177,42 @@ throw;
|
|||||||
// }
|
// }
|
||||||
// );
|
// );
|
||||||
|
|
||||||
|
GameBinding = GameLogic.Bind();
|
||||||
|
GameBinding.OnOutput((in GameLogicState.Output.SetPauseMode _) =>
|
||||||
|
{
|
||||||
|
GetTree().Paused = !GetTree().Paused;
|
||||||
|
}).OnOutput((in GameLogicState.Output.ShowOptionMenu _) =>
|
||||||
|
{
|
||||||
|
HideMenus();
|
||||||
|
OptionsMenu.Show();
|
||||||
|
})
|
||||||
|
// .OnOutput((in GameLogicState.Output.ShowOptionMenu _) =>
|
||||||
|
// {
|
||||||
|
// OptionsMenu.Hide();
|
||||||
|
// })
|
||||||
|
.OnOutput((in GameLogicState.Output.ShowPauseMenu _) =>
|
||||||
|
{
|
||||||
|
HideMenus();
|
||||||
|
PauseMenu.Show();
|
||||||
|
})
|
||||||
|
.OnOutput((in GameLogicState.Output.HideMenus _) => HideMenus())
|
||||||
|
.OnOutput((in GameLogicState.Output.StartSaving _) => SaveGame2())
|
||||||
|
.OnInput((in GameLogicState.Input.SaveCompleted _) => {
|
||||||
|
var path = Path.Combine(OS.GetUserDataDir(), "lastGame.txt");
|
||||||
|
File.WriteAllText(path,SaveService.FilePath);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// .OnOutput((in GameLogicState.Output.ExitPauseMenu _) =>
|
||||||
|
// {
|
||||||
|
// HideMenus();
|
||||||
|
// })
|
||||||
|
// .OnOutput((in GameLogicState.Output.HidePauseMenu _) =>
|
||||||
|
// {
|
||||||
|
// PauseMenu.Hide();
|
||||||
|
// })
|
||||||
|
;
|
||||||
|
GameLogic.Start<GameLogicState.Playing>();
|
||||||
this.Provide();
|
this.Provide();
|
||||||
}
|
}
|
||||||
public override void _UnhandledInput(InputEvent @event)
|
public override void _UnhandledInput(InputEvent @event)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Chickensoft.LogicBlocks;
|
|||||||
using Chickensoft.LogicBlocks.Auto;
|
using Chickensoft.LogicBlocks.Auto;
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
public interface IGameLogic : ILogicBlock;
|
public interface IGameLogic : ILogicBlock;
|
||||||
[Meta]
|
[Meta]
|
||||||
@@ -43,6 +44,7 @@ public abstract partial record GameLogicState
|
|||||||
, IGet<Input.OpenOptionMenu>
|
, IGet<Input.OpenOptionMenu>
|
||||||
, IGet<Input.SaveRequested>
|
, IGet<Input.SaveRequested>
|
||||||
, IGet<Input.GotoMainMenu>
|
, IGet<Input.GotoMainMenu>
|
||||||
|
, IGet<Input.GotoDesktop>
|
||||||
{
|
{
|
||||||
public Paused()
|
public Paused()
|
||||||
{
|
{
|
||||||
@@ -64,8 +66,18 @@ public abstract partial record GameLogicState
|
|||||||
|
|
||||||
public Type On(in Input.SaveRequested input) => To<Saving>();
|
public Type On(in Input.SaveRequested input) => To<Saving>();
|
||||||
public virtual Type On(in Input.PauseButtonPressed input) => To<Playing>();
|
public virtual Type On(in Input.PauseButtonPressed input) => To<Playing>();
|
||||||
public virtual Type On(in Input.GotoMainMenu input) => To<Quit>();
|
public virtual Type On(in Input.GotoMainMenu input)
|
||||||
|
{
|
||||||
|
// Get<AppLogic.Data>().ExitGameReason = ExitGameReason.QuitToMenu;
|
||||||
|
return To<Quit>();
|
||||||
|
}
|
||||||
|
|
||||||
public virtual Type On(in Input.OpenOptionMenu input) => To<OptionsMenu>();
|
public virtual Type On(in Input.OpenOptionMenu input) => To<OptionsMenu>();
|
||||||
|
public Type On(in Input.GotoDesktop input)
|
||||||
|
{
|
||||||
|
// Get<AppLogic.Data>().ExitGameReason = ExitGameReason.QuitToDesktop;
|
||||||
|
return To<QuitToDesktop>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[Meta]
|
[Meta]
|
||||||
public partial record OptionsMenu : Paused
|
public partial record OptionsMenu : Paused
|
||||||
@@ -112,7 +124,18 @@ public abstract partial record GameLogicState
|
|||||||
public Quit()
|
public Quit()
|
||||||
{
|
{
|
||||||
this.OnEnter(
|
this.OnEnter(
|
||||||
() => Get<IAppRepo>().OnExitGame()
|
() => Get<IAppRepo>().OnExitGame(ExitGameReason.QuitToMenu)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[Meta]
|
||||||
|
public partial record QuitToDesktop : GameLogicState
|
||||||
|
{
|
||||||
|
|
||||||
|
public QuitToDesktop()
|
||||||
|
{
|
||||||
|
this.OnEnter(
|
||||||
|
() => Get<IAppRepo>().OnExitGame(ExitGameReason.QuitToDesktop)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ state "GameLogicState" as GameLogicState {
|
|||||||
}
|
}
|
||||||
state "Playing" as GameLogicState_Playing
|
state "Playing" as GameLogicState_Playing
|
||||||
state "Quit" as GameLogicState_Quit
|
state "Quit" as GameLogicState_Quit
|
||||||
|
state "QuitToDesktop" as GameLogicState_QuitToDesktop
|
||||||
}
|
}
|
||||||
|
|
||||||
GameLogicState_OptionsMenu --> GameLogicState_OptionsMenu : OpenOptionMenu
|
GameLogicState_OptionsMenu --> GameLogicState_OptionsMenu : OpenOptionMenu
|
||||||
@@ -13,6 +14,7 @@ GameLogicState_OptionsMenu --> GameLogicState_Paused : PauseButtonPressed
|
|||||||
GameLogicState_Paused --> GameLogicState_OptionsMenu : OpenOptionMenu
|
GameLogicState_Paused --> GameLogicState_OptionsMenu : OpenOptionMenu
|
||||||
GameLogicState_Paused --> GameLogicState_Playing : PauseButtonPressed
|
GameLogicState_Paused --> GameLogicState_Playing : PauseButtonPressed
|
||||||
GameLogicState_Paused --> GameLogicState_Quit : GotoMainMenu
|
GameLogicState_Paused --> GameLogicState_Quit : GotoMainMenu
|
||||||
|
GameLogicState_Paused --> GameLogicState_QuitToDesktop : GotoDesktop
|
||||||
GameLogicState_Paused --> GameLogicState_Saving : SaveRequested
|
GameLogicState_Paused --> GameLogicState_Saving : SaveRequested
|
||||||
GameLogicState_Playing --> GameLogicState_Paused : PauseButtonPressed
|
GameLogicState_Playing --> GameLogicState_Paused : PauseButtonPressed
|
||||||
GameLogicState_Saving --> GameLogicState_Paused : SaveCompleted
|
GameLogicState_Saving --> GameLogicState_Paused : SaveCompleted
|
||||||
|
|||||||
@@ -8,19 +8,28 @@ using Chickensoft.Introspection;
|
|||||||
using Godot;
|
using Godot;
|
||||||
using GodotHelpers;
|
using GodotHelpers;
|
||||||
|
|
||||||
public interface IModMenu : IControl;
|
public interface IModMenu : IControl
|
||||||
|
{
|
||||||
|
event ModMenu.ExitModMenuEventHandler ExitModMenu;
|
||||||
|
}
|
||||||
[Meta(typeof(IAutoNode))]
|
[Meta(typeof(IAutoNode))]
|
||||||
public partial class ModMenu : Control, IModMenu {
|
public partial class ModMenu : Control, IModMenu {
|
||||||
public override void _Notification(int what) => this.Notify(what);
|
public override void _Notification(int what) => this.Notify(what);
|
||||||
|
|
||||||
|
[Signal] public delegate void ExitModMenuEventHandler();
|
||||||
[Export] public PackedScene ModEntryScene { get; set; } = default!;
|
[Export] public PackedScene ModEntryScene { get; set; } = default!;
|
||||||
[Dependency] public IAppRepo AppRepo => this.DependOn<IAppRepo>();
|
[Dependency] public IAppRepo AppRepo => this.DependOn<IAppRepo>();
|
||||||
private IModManger ModManger => AppRepo.ModManger;
|
private IModManger ModManger => AppRepo.ModManger;
|
||||||
[Node] public ReOrderableContainer ModsContainer { get; set; } = default!;
|
[Node] public ReOrderableContainer ModsContainer { get; set; } = default!;
|
||||||
[Node] public IOptionButton ProfilesButton { get; set; } = default!;
|
[Node] public IOptionButton ProfilesButton { get; set; } = default!;
|
||||||
|
[Node] public IButton EnableAllButton { get; set; } = default!;
|
||||||
|
[Node] public IButton DisableAllButton { get; set; } = default!;
|
||||||
|
[Node] public IButton BackButton { get; set; } = default!;
|
||||||
public void OnResolved()
|
public void OnResolved()
|
||||||
{
|
{
|
||||||
VisibilityChanged += OnVisibilityChanged;
|
VisibilityChanged += OnVisibilityChanged;
|
||||||
ProfilesButton.ItemSelected += OnModProfileSelected;
|
ProfilesButton.ItemSelected += OnModProfileSelected;
|
||||||
|
BackButton.Pressed += EmitSignalExitModMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnModProfileSelected(long index)
|
private void OnModProfileSelected(long index)
|
||||||
|
|||||||
@@ -91,15 +91,18 @@ layout_mode = 2
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Button2" type="Button" parent="VSplitContainer/HBoxContainer3" unique_id=656433698]
|
[node name="EnableAllButton" type="Button" parent="VSplitContainer/HBoxContainer3" unique_id=656433698]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Enable All"
|
text = "Enable All"
|
||||||
|
|
||||||
[node name="Button3" type="Button" parent="VSplitContainer/HBoxContainer3" unique_id=1971172163]
|
[node name="DisableAllButton" type="Button" parent="VSplitContainer/HBoxContainer3" unique_id=1971172163]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Disable All"
|
text = "Disable All"
|
||||||
|
|
||||||
[node name="BackButton" type="Button" parent="VSplitContainer/HBoxContainer3" unique_id=392421633]
|
[node name="BackButton" type="Button" parent="VSplitContainer/HBoxContainer3" unique_id=392421633]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 10
|
size_flags_horizontal = 10
|
||||||
text = "Back"
|
text = "Back"
|
||||||
|
|||||||
Reference in New Issue
Block a user