Fix up item usage
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
|
||||
|
||||
namespace Zennysoft.Game.Ma.Implementation;
|
||||
|
||||
@@ -13,18 +15,29 @@ public partial class InGameUILogic
|
||||
OnAttach(() =>
|
||||
{
|
||||
var gameRepo = Get<IGameRepo>();
|
||||
gameRepo.AnnounceMessage += OnAnnounceMessage;
|
||||
gameRepo.AnnounceMessageOnMainScreenEvent += OnAnnounceMessageOnMainScreen;
|
||||
gameRepo.AnnounceMessageInInventoryEvent += OnAnnounceMessageInInventory;
|
||||
gameRepo.RemoveItemFromInventoryEvent += OnRemoveItemFromInventory;
|
||||
});
|
||||
OnDetach(() =>
|
||||
{
|
||||
var gameRepo = Get<IGameRepo>();
|
||||
gameRepo.AnnounceMessage -= OnAnnounceMessage;
|
||||
gameRepo.AnnounceMessageOnMainScreenEvent -= OnAnnounceMessageOnMainScreen;
|
||||
gameRepo.AnnounceMessageInInventoryEvent -= OnAnnounceMessageInInventory;
|
||||
});
|
||||
}
|
||||
|
||||
private void OnAnnounceMessage(string message)
|
||||
private void OnAnnounceMessageOnMainScreen(string message)
|
||||
{
|
||||
Output(new Output.AnnounceMessage(message));
|
||||
Output(new Output.AnnounceMessageOnMainScreen(message));
|
||||
}
|
||||
|
||||
private void OnAnnounceMessageInInventory(string message)
|
||||
{
|
||||
Output(new Output.AnnounceMessageInInventory(message));
|
||||
}
|
||||
|
||||
private void OnRemoveItemFromInventory(IInventoryItem item) => Output(new Output.RemoveItemFromInventory(item));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user