diff --git a/BenMakesGames.PlayPlayMini.sln.DotSettings b/BenMakesGames.PlayPlayMini.sln.DotSettings new file mode 100644 index 0000000..d9697fd --- /dev/null +++ b/BenMakesGames.PlayPlayMini.sln.DotSettings @@ -0,0 +1,3 @@ + + GSM + UI \ No newline at end of file diff --git a/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj b/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj index 368c7e6..74bced9 100644 --- a/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj +++ b/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj @@ -5,7 +5,7 @@ Ben Hendel-Doying An opinionated framework for making smallish games with MonoGame. 2021-2024 Ben Hendel-Doying - 4.5.0 + 4.6.0 true monogame game engine framework di state @@ -27,7 +27,7 @@ - + diff --git a/BenMakesGames.PlayPlayMini/GameStateManagerBuilder.cs b/BenMakesGames.PlayPlayMini/GameStateManagerBuilder.cs index 0ad1538..274869d 100644 --- a/BenMakesGames.PlayPlayMini/GameStateManagerBuilder.cs +++ b/BenMakesGames.PlayPlayMini/GameStateManagerBuilder.cs @@ -21,7 +21,7 @@ public class GameStateManagerBuilder private AssetCollection GameAssets { get; } = new(); - private Action? AddServicesCallback { get; set; } + private Action? AddServicesCallback { get; set; } private Action? ConfigurationCallback { get; set; } private string WindowTitle { get; set; } = "PlayPlayMini Game"; private (int Width, int Height, int Zoom) WindowSize { get; set; } = (1920 / 3, 1080 / 3, 2); @@ -69,7 +69,7 @@ public GameStateManagerBuilder AddAssets(IList assets) return this; } - public GameStateManagerBuilder AddServices(Action callback) + public GameStateManagerBuilder AddServices(Action callback) { if (AddServicesCallback is not null) throw new ArgumentException("AddServices may only be called once!"); @@ -79,13 +79,23 @@ public GameStateManagerBuilder AddServices(Action callback) instead.")] + public GameStateManagerBuilder AddServices(Action callback) + { + if (AddServicesCallback is not null) + throw new ArgumentException("AddServices may only be called once!"); + + AddServicesCallback = (s, c, _) => callback(s, c); + + return this; + } + + [Obsolete("Use AddServices(Action callback) instead.")] public GameStateManagerBuilder AddServices(Action callback) { if (AddServicesCallback is not null) throw new ArgumentException("AddServices may only be called once!"); - AddServicesCallback = (s, _) => callback(s); + AddServicesCallback = (s, _, _) => callback(s); return this; } @@ -179,7 +189,7 @@ public void Run() .As(typeof(ILogger<>)) .SingleInstance(); - AddServicesCallback?.Invoke(builder, configuration); + AddServicesCallback?.Invoke(builder, configuration, serviceWatcher); if(InitialGameState is null) throw new ArgumentException("No initial game state set! You must call GameStateManagerBuilder's SetInitialGameState method before calling its Run method.");