mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-11 13:55:55 +00:00
Item Notifications
This commit is contained in:
parent
fc35baeaba
commit
0438ed4a04
8 changed files with 98 additions and 25 deletions
|
|
@ -19,7 +19,12 @@ public partial class Hud : CanvasLayer
|
|||
|
||||
[Export]
|
||||
public PackedScene WeaponContainerTemplate { get; private set; }
|
||||
|
||||
[Export]
|
||||
public PackedScene ItemNotificationTemplate { get; private set; }
|
||||
|
||||
[Export] public float ItemsNotificationTimeout { get; private set; } = 3f;
|
||||
|
||||
[Export]
|
||||
private Node2D _selector;
|
||||
|
||||
|
|
@ -60,8 +65,19 @@ public partial class Hud : CanvasLayer
|
|||
// Assuming the HUD has a Label node named "HealthLabel"
|
||||
//_healthLabel = GetNode<Label>("HealthLabel");
|
||||
_gameOverPanel.Hide();
|
||||
|
||||
InventoryManager.Instance.ItemAdded += OnItemAdded;
|
||||
}
|
||||
|
||||
|
||||
private void OnItemAdded(LootItem item, int currentamount)
|
||||
{
|
||||
var instance = ItemNotificationTemplate.Instantiate<ItemNotification>();
|
||||
|
||||
_itemsContainer.CallDeferred("add_child", instance);
|
||||
|
||||
instance.Init(item, currentamount, ItemsNotificationTimeout);
|
||||
}
|
||||
|
||||
public void ShowMessage(string text)
|
||||
{
|
||||
var message = GetNode<Label>("Message");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue