2023-07-23 11:05:01 -07:00
|
|
|
using Godot;
|
2024-06-04 22:12:01 -07:00
|
|
|
using System.Collections.Generic;
|
2023-07-23 11:05:01 -07:00
|
|
|
|
|
|
|
namespace SupaLidlGame.UI;
|
|
|
|
|
|
|
|
public partial class UIController : Control
|
|
|
|
{
|
|
|
|
[Export]
|
|
|
|
public TextureProgressBar PlayerHealthBar { get; set; }
|
|
|
|
|
|
|
|
[Export]
|
|
|
|
public BossBar BossBar { get; set; }
|
2024-06-04 22:12:01 -07:00
|
|
|
|
|
|
|
private Stack<IModal> _modals;
|
|
|
|
|
|
|
|
public override void _Ready()
|
|
|
|
{
|
|
|
|
Events.EventBus.Instance.EnterShop += (string path) =>
|
|
|
|
{
|
|
|
|
var shop = ResourceLoader.Load<Items.Shop>(path);
|
|
|
|
var shopMenu = GetNode<Inventory.ShopMenu>("%ShopMenu");
|
|
|
|
shopMenu.Source = shop;
|
|
|
|
shopMenu.ShowModal();
|
|
|
|
};
|
2024-09-16 12:33:29 -07:00
|
|
|
|
|
|
|
Events.EventBus.Instance.PlayerOpenInventory += (Items.Inventory inventory) =>
|
|
|
|
{
|
|
|
|
var inventoryMenu = GetNode<Inventory.InventoryMenu>("%InventoryMenu");
|
|
|
|
if (!inventoryMenu.IsPlayingAnimation)
|
|
|
|
{
|
|
|
|
inventoryMenu.Source = inventory;
|
|
|
|
|
|
|
|
if (inventoryMenu.Visible)
|
|
|
|
{
|
|
|
|
inventoryMenu.Close();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
inventoryMenu.ShowModal();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2024-06-04 22:12:01 -07:00
|
|
|
}
|
2023-07-23 11:05:01 -07:00
|
|
|
}
|