Start refactoring UI concerns away from game and into UI logic class
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
public partial class InGameUILogic
|
||||
{
|
||||
[Meta]
|
||||
public abstract partial record State : StateLogic<State>
|
||||
{
|
||||
protected State()
|
||||
{
|
||||
OnAttach(() =>
|
||||
{
|
||||
var gameRepo = Get<IGameRepo>();
|
||||
gameRepo.AnnounceMessage += OnAnnounceMessage;
|
||||
});
|
||||
OnDetach(() =>
|
||||
{
|
||||
var gameRepo = Get<IGameRepo>();
|
||||
gameRepo.AnnounceMessage -= OnAnnounceMessage;
|
||||
});
|
||||
}
|
||||
|
||||
private void OnAnnounceMessage(string message)
|
||||
{
|
||||
Output(new Output.AnnounceMessage(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user