From fbc055308f093a6527781cb16ce896ac253219ab Mon Sep 17 00:00:00 2001 From: Matheus Date: Thu, 4 Sep 2025 12:46:30 -0300 Subject: Modificado inspetor --- assets/definitions/details_label_settings.tres | 4 +++ scenes/Details.tscn | 28 +++++++++++++++ scenes/Game.tscn | 6 +++- scenes/Inspector.tscn | 13 +++++++ scripts/GUI/Details.cs | 48 ++++++++++++++++++++++++++ scripts/GUI/Details.cs.uid | 1 + scripts/Utils/SignalBus.cs | 8 +++++ scripts/actors/Inspector.cs | 15 ++++---- scripts/input/InspectInputHandler.cs | 17 +++++---- scripts/map/MapData.cs | 32 +++++++++++++++++ 10 files changed, 155 insertions(+), 17 deletions(-) create mode 100644 assets/definitions/details_label_settings.tres create mode 100644 scenes/Details.tscn create mode 100644 scenes/Inspector.tscn create mode 100644 scripts/GUI/Details.cs create mode 100644 scripts/GUI/Details.cs.uid diff --git a/assets/definitions/details_label_settings.tres b/assets/definitions/details_label_settings.tres new file mode 100644 index 0000000..e3bff56 --- /dev/null +++ b/assets/definitions/details_label_settings.tres @@ -0,0 +1,4 @@ +[gd_resource type="LabelSettings" format=3 uid="uid://3nh470qx26gy"] + +[resource] +line_spacing = 0.0 diff --git a/scenes/Details.tscn b/scenes/Details.tscn new file mode 100644 index 0000000..65df792 --- /dev/null +++ b/scenes/Details.tscn @@ -0,0 +1,28 @@ +[gd_scene load_steps=2 format=3 uid="uid://bryqrafavmwj4"] + +[ext_resource type="Script" uid="uid://c5f8urot55re6" path="res://scripts/GUI/Details.cs" id="1_5ml16"] + +[node name="InspectDetails" type="CanvasLayer"] +script = ExtResource("1_5ml16") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="AspectRatioContainer" type="AspectRatioContainer" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 3.0 + +[node name="PanelContainer" type="PanelContainer" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer/PanelContainer"] +layout_mode = 2 + +[node name="Entities" type="VBoxContainer" parent="HBoxContainer/PanelContainer/ScrollContainer"] +layout_mode = 2 diff --git a/scenes/Game.tscn b/scenes/Game.tscn index 7f7eff0..54a0729 100644 --- a/scenes/Game.tscn +++ b/scenes/Game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=3 uid="uid://u5h6iqyi8wd0"] +[gd_scene load_steps=11 format=3 uid="uid://u5h6iqyi8wd0"] [ext_resource type="Script" uid="uid://dwubb28wt4bhe" path="res://scripts/Game.cs" id="1_cpr0p"] [ext_resource type="Script" uid="uid://ejqmdbc0524i" path="res://scripts/input/MainGameInputHandler.cs" id="3_400sg"] @@ -7,6 +7,7 @@ [ext_resource type="Script" uid="uid://dwyr067lwqcsj" path="res://scripts/map/DungeonGenerator.cs" id="4_78awf"] [ext_resource type="Script" uid="uid://ogqlb3purl6n" path="res://scripts/input/GameOverInputHandler.cs" id="4_g4kob"] [ext_resource type="Script" uid="uid://bamlnrj5bm1rd" path="res://scripts/input/InspectInputHandler.cs" id="5_g4kob"] +[ext_resource type="PackedScene" uid="uid://bryqrafavmwj4" path="res://scenes/Details.tscn" id="5_qy1jj"] [ext_resource type="Script" uid="uid://bereyrj1s46y5" path="res://scripts/map/FieldOfView.cs" id="5_s0nni"] [ext_resource type="PackedScene" uid="uid://b4h4xyr1g8o50" path="res://scenes/hud.tscn" id="6_aug50"] @@ -29,6 +30,9 @@ script = ExtResource("5_s0nni") [node name="Actors" type="Node2D" parent="Map"] +[node name="InspectDetails" parent="Map" instance=ExtResource("5_qy1jj")] +visible = false + [node name="InputHandler" type="Node" parent="."] script = ExtResource("3_s0nni") diff --git a/scenes/Inspector.tscn b/scenes/Inspector.tscn new file mode 100644 index 0000000..886b41c --- /dev/null +++ b/scenes/Inspector.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=3 format=3 uid="uid://dyythuxaio6j4"] + +[ext_resource type="Texture2D" uid="uid://cjjxf4rbj8gku" path="res://assets/sprites/inspector.png" id="1_psyxb"] +[ext_resource type="Script" uid="uid://dxsrtu4b3pi08" path="res://scripts/actors/Inspector.cs" id="2_g62u7"] + +[node name="Sprite2D" type="Sprite2D"] +texture = ExtResource("1_psyxb") +centered = false +script = ExtResource("2_g62u7") + +[node name="Camera2D" type="Camera2D" parent="."] +offset = Vector2(8, 8) +zoom = Vector2(2, 2) diff --git a/scripts/GUI/Details.cs b/scripts/GUI/Details.cs new file mode 100644 index 0000000..0e342aa --- /dev/null +++ b/scripts/GUI/Details.cs @@ -0,0 +1,48 @@ +using Godot; +using System; + +public partial class Details : CanvasLayer +{ + private static readonly LabelSettings lblSettings = GD.Load("res://assets/definitions/message_label_settings.tres"); + private Map map; + private VBoxContainer entityNames; + private Godot.Collections.Array actors = []; + + private Godot.Collections.Array