summaryrefslogtreecommitdiff
path: root/scripts/GUI/Details.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-09 19:09:34 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-09 19:09:34 -0300
commitc6bbb834f7758027c0df338f1520f34fad3befea (patch)
tree1818cd23c24be16fbe19b16dd0a510874d440d83 /scripts/GUI/Details.cs
parentf1b51bed52ffbd90b5b7cc8dcfc6f0484bbbeb3c (diff)
Organização
Diffstat (limited to 'scripts/GUI/Details.cs')
-rw-r--r--scripts/GUI/Details.cs43
1 files changed, 26 insertions, 17 deletions
diff --git a/scripts/GUI/Details.cs b/scripts/GUI/Details.cs
index 814d2ac..3c64427 100644
--- a/scripts/GUI/Details.cs
+++ b/scripts/GUI/Details.cs
@@ -1,48 +1,57 @@
using Godot;
-using System;
+using TheLegendOfGustav.Entities;
+using TheLegendOfGustav.Map;
+using TheLegendOfGustav.Utils;
+
+namespace TheLegendOfGustav.GUI;
public partial class Details : CanvasLayer
{
private static readonly LabelSettings lblSettings = GD.Load<LabelSettings>("res://assets/definitions/message_label_settings.tres");
- private Map map;
- private VBoxContainer entityNames;
- private Godot.Collections.Array<Entity> entities = [];
+
+ private Map.Map Map { get; set; }
+ private VBoxContainer EntityNames { get; set; }
+ private Godot.Collections.Array<Entity> Entities { get; set; } = [];
- private Godot.Collections.Array<Label> actorsLabel = [];
+ private Godot.Collections.Array<Label> ActorsLabel { get; set; } = [];
public override void _Ready()
{
base._Ready();
- map = GetParent<Map>();
- entityNames = GetNode<VBoxContainer>("HBoxContainer/PanelContainer/ScrollContainer/Entities");
+ Map = GetParent<Map.Map>();
+ EntityNames = GetNode<VBoxContainer>("HBoxContainer/PanelContainer/ScrollContainer/Entities");
SignalBus.Instance.InspectorMoved += OnInspectorWalk;
SignalBus.Instance.EnterInspectionMode += () => Visible = true;
SignalBus.Instance.ExitInspectionMode += () => Visible = false;
}
- public void OnInspectorWalk(Vector2I pos) {
- MapData mapData = map.Map_Data;
- entities = mapData.GetEntitiesAtPosition(pos);
+ public void OnInspectorWalk(Vector2I pos)
+ {
+ MapData mapData = Map.MapData;
+ Entities = mapData.GetEntitiesAtPosition(pos);
UpdateLabels();
}
- private void UpdateLabels() {
- foreach(Label label in actorsLabel) {
+ private void UpdateLabels()
+ {
+ foreach (Label label in ActorsLabel)
+ {
label.QueueFree();
}
- actorsLabel.Clear();
- foreach (Entity entity in entities) {
+ ActorsLabel.Clear();
+
+ foreach (Entity entity in Entities)
+ {
Label label = new()
{
Text = entity.DisplayName,
LabelSettings = lblSettings
};
- actorsLabel.Add(label);
- entityNames.AddChild(label);
+ ActorsLabel.Add(label);
+ EntityNames.AddChild(label);
}
}
}
- \ No newline at end of file