using Godot; using System.Collections.Generic; namespace SupaLidlGame.UI.Inventory; public partial class ShopMenu : Control, IModal { private Items.IItemCollection _source; public Items.IItemCollection Source { get => _source; set { GD.Print("Set ShopMenu source"); _source = value; _inventoryGrid.Source = value; } } [Export] private InventoryGrid _inventoryGrid; private InventorySlot _selected; public void HideModal() { Hide(); _source = null; } public override void _Ready() { Events.EventBus.Instance.EnterShop += (string path) => { var shop = ResourceLoader.Load(path); GD.Print("Loaded shop"); Source = shop; }; _inventoryGrid.SlotFocused += (InventorySlot slot) => { GD.Print("SlotFocused " + slot.Name); if (slot.Item is not null) { SetTooltipItem(slot); } }; _inventoryGrid.SlotUnfocused += (InventorySlot slot) => { SetTooltipItem(_selected); }; _inventoryGrid.SlotSelected += (InventorySlot slot) => { _selected = slot; SetTooltipItem(slot); GetNode