using Cirno.Scripts.Resources; using Godot; namespace Cirno.Scripts.UI; public partial class ItemNotification : Container { public LootItem Item { get; private set; } [Export] public TextureRect Icon { get; private set; } [Export] public Label DescriptionLabel { get; private set; } private double _counter = 0; private double _timeout = 0; public override void _Process(double delta) { _counter += delta; if (_counter >= _timeout) { QueueFree(); } } public void Init(LootItem item, int total, float timeout) { _timeout = timeout; _counter = 0; Item = item; UpdateCounter(item, total); } private void UpdateCounter(LootItem item, int total) { DescriptionLabel.Text = $"{item.ItemName} +{item.Amount} ({total})"; Icon.Texture = item.InventorySprite; } }