Move GameLogic to new project

This commit is contained in:
2025-03-07 01:39:18 -08:00
parent b7bf4f3d10
commit 65e4af8595
28 changed files with 33 additions and 25 deletions

View File

@@ -2,22 +2,18 @@
namespace Zennysoft.Game.Ma;
using Chickensoft.AutoInject;
using Chickensoft.Collections;
using Chickensoft.Introspection;
using Chickensoft.SaveFileBuilder;
using Chickensoft.Serialization;
using Chickensoft.Serialization.Godot;
using Zennysoft.Game.Ma.src.items;
using Godot;
using System;
using System.IO.Abstractions;
using System.Text.Json;
using System.Text.Json.Serialization.Metadata;
using static Zennysoft.Game.Ma.GameLogic.State;
using Zennysoft.Game.Abstractions;
using Zennysoft.Game.Ma.Implementation;
using System.Threading.Tasks;
using System.IO;
using SimpleInjector;
using static Zennysoft.Game.Ma.Implementation.GameLogic.State;
[Meta(typeof(IAutoNode))]
public partial class Game : Node3D, IGame
@@ -89,10 +85,12 @@ public partial class Game : Node3D, IGame
_container = new SimpleInjector.Container();
_container.Register<IFileSystem, FileSystem>();
_container.Register<ISaveFileManager<GameData>, SaveFileManager<GameData>>();
_container.Register<IGameRepo, GameRepo>(Lifestyle.Singleton);
_container.Register<IGameLogic, GameLogic>(Lifestyle.Singleton);
_container.Verify();
GameRepo = new GameRepo();
GameLogic = new GameLogic();
GameRepo = _container.GetInstance<IGameRepo>();
GameLogic = _container.GetInstance<IGameLogic>();
GameEventDepot = new GameEventDepot();
GameLogic.Set(GameRepo);
GameLogic.Set(AppRepo);
@@ -188,6 +186,7 @@ public partial class Game : Node3D, IGame
PauseMenu.SetProcessUnhandledInput(true);
})
.Handle((in GameLogic.Output.LoadNextFloor _) => { Map.SpawnNextFloor(); })
.Handle((in GameLogic.Output.LoadMap _) => { Map.LoadMap(); })
.Handle((in GameLogic.Output.HidePauseMenu _) => { PauseMenu.Hide(); })
.Handle((in GameLogic.Output.ExitPauseMenu _) => { PauseMenu.FadeOut(); Input.MouseMode = Input.MouseModeEnum.Visible; PauseMenu.SetProcessUnhandledInput(false); })
.Handle((in GameLogic.Output.ShowFloorClearMenu _) => { FloorClearMenu.Show(); FloorClearMenu.FadeIn(); })