diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-11-04 12:54:13 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-11-04 12:54:13 -0300 |
| commit | 63e4f75e9292e1276cc0b5d11ebad010f147aa68 (patch) | |
| tree | 4b6c9a1c39b7e2fedb0ba27a8df47631bb2abea9 /scripts/GUI | |
| parent | 5d2f66f1e7f8a9f35456e0f6acc478d1b2ecb294 (diff) | |
Display de andar
Diffstat (limited to 'scripts/GUI')
| -rw-r--r-- | scripts/GUI/Hud.cs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/scripts/GUI/Hud.cs b/scripts/GUI/Hud.cs index a1511b8..60e1e91 100644 --- a/scripts/GUI/Hud.cs +++ b/scripts/GUI/Hud.cs @@ -1,5 +1,6 @@ using System.Runtime.InteropServices; using Godot; +using TheLegendOfGustav.Utils; namespace TheLegendOfGustav.GUI; @@ -7,12 +8,25 @@ public partial class Hud : CanvasLayer { private TextureProgressBar hpBar; private TextureProgressBar mpBar; + private Label floorLabel; public override void _Ready() { base._Ready(); - hpBar = GetNode<TextureProgressBar>("VBoxContainer/InfoBar/Stats/MarginContainer/HBoxContainer/AspectRatioContainer/HPbar"); - mpBar = GetNode<TextureProgressBar>("VBoxContainer/InfoBar/Stats/MarginContainer/HBoxContainer/AspectRatioContainer2/MPbar"); + hpBar = GetNode<TextureProgressBar>("VBoxContainer/InfoBar/Stats/MarginContainer/VBoxContainer/HBoxContainer/AspectRatioContainer/HPbar"); + mpBar = GetNode<TextureProgressBar>("VBoxContainer/InfoBar/Stats/MarginContainer/VBoxContainer/HBoxContainer/AspectRatioContainer/HPbar"); + floorLabel = GetNode<Label>("VBoxContainer/InfoBar/Stats/MarginContainer/VBoxContainer/HBoxContainer2/floorLabel"); + + SignalBus.Instance.DungeonFloorChanged += OnFloorChanged; + } + + public override void _Notification(int what) + { + base._Notification(what); + if (what == NotificationPredelete) + { + SignalBus.Instance.DungeonFloorChanged -= OnFloorChanged; + } } public void OnHealthChanged(int hp, int maxHp) @@ -26,4 +40,9 @@ public partial class Hud : CanvasLayer mpBar.Value = mp; mpBar.MaxValue = maxMp; } + + public void OnFloorChanged(int floor) + { + floorLabel.Text = $"Andar: {floor}"; + } } |
