Start refactoring UI concerns away from game and into UI logic class
This commit is contained in:
@@ -2,6 +2,8 @@ using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using Renci.SshNet.Messages;
|
||||
using Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -31,9 +33,34 @@ public partial class InGameUI : Control, IInGameUI
|
||||
|
||||
[Node] public IUseTeleportPrompt UseTeleportPrompt { get; set; } = default!;
|
||||
|
||||
[Dependency] private IGameRepo _gameRepo => this.DependOn<IGameRepo>();
|
||||
|
||||
public IInGameUILogic InGameUILogic { get; set; } = default!;
|
||||
|
||||
public InGameUILogic.IBinding InGameUILogicBinding { get; set; } = default!;
|
||||
|
||||
[Signal]
|
||||
public delegate void MinimapButtonReleasedEventHandler();
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
InGameUILogic = new InGameUILogic();
|
||||
InGameUILogic.Set(_gameRepo);
|
||||
}
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
InGameUILogicBinding = InGameUILogic.Bind();
|
||||
|
||||
InGameUILogicBinding
|
||||
.Handle((in InGameUILogic.Output.AnnounceMessage output) =>
|
||||
{
|
||||
PlayerInfoUI.DisplayMessage(output.Message);
|
||||
});
|
||||
|
||||
InGameUILogic.Start();
|
||||
}
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionReleased(GameInputs.MiniMap))
|
||||
|
||||
Reference in New Issue
Block a user