36 lines
902 B
C#
36 lines
902 B
C#
using Chickensoft.Introspection;
|
|
|
|
namespace Zennysoft.Ma.Adapter;
|
|
|
|
public partial class InGameUILogic
|
|
{
|
|
public partial record State
|
|
{
|
|
[Meta]
|
|
public partial record InventoryOpen : Active, IGet<Input.HideInventory>
|
|
{
|
|
public InventoryOpen()
|
|
{
|
|
OnAttach(() =>
|
|
{
|
|
var gameRepo = Get<IGameRepo>();
|
|
gameRepo.CloseInventoryEvent += OnCloseInventoryEvent;
|
|
gameRepo.Pause();
|
|
Output(new Output.ShowInventory());
|
|
});
|
|
OnDetach(() =>
|
|
{
|
|
var gameRepo = Get<IGameRepo>();
|
|
gameRepo.Resume();
|
|
gameRepo.CloseInventoryEvent -= OnCloseInventoryEvent;
|
|
Output(new Output.HideInventory());
|
|
});
|
|
}
|
|
|
|
private void OnCloseInventoryEvent() => Input(new Input.HideInventory());
|
|
|
|
public Transition On(in Input.HideInventory input) => To<Active>();
|
|
}
|
|
}
|
|
}
|