Refactor inventory menu logic

This commit is contained in:
2025-03-07 20:42:56 -08:00
parent d30fa35546
commit 8a61104868
19 changed files with 94 additions and 160 deletions

View File

@@ -8,9 +8,7 @@ public interface IGameRepo : IDisposable
{
event Action? Ended;
event Action? OpenInventory;
event Action? CloseInventory;
event Action? CloseInventoryEvent;
event Action<string>? AnnounceMessageOnMainScreenEvent;
@@ -38,14 +36,15 @@ public interface IGameRepo : IDisposable
public void RemoveItemFromInventory(IInventoryItem item);
public void CloseInventory();
public double ExpRate { get; }
}
public class GameRepo : IGameRepo
{
public event Action? Ended;
public event Action? OpenInventory;
public event Action? CloseInventory;
public event Action? CloseInventoryEvent;
public event Action<string>? AnnounceMessageOnMainScreenEvent;
public event Action<string>? AnnounceMessageInInventoryEvent;
public event Action<int>? DoubleExpTimeStart;
@@ -105,6 +104,11 @@ public class GameRepo : IGameRepo
RemoveItemFromInventoryEvent?.Invoke(item);
}
public void CloseInventory()
{
CloseInventoryEvent?.Invoke();
}
public void OnGameEnded()
{
Pause();