From 9cf3fd77ed755eec6ed0f8dcf0c02b5b4537b472 Mon Sep 17 00:00:00 2001 From: Michael K Date: Tue, 17 Dec 2024 23:30:40 -0600 Subject: [PATCH 1/3] removed the button to access the inventory and added a label to show gold amount --- #Scenes/TopBarOverlay.tscn | 13 ++++++++++++- UI/GoldLabel.gd | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 UI/GoldLabel.gd diff --git a/#Scenes/TopBarOverlay.tscn b/#Scenes/TopBarOverlay.tscn index d31cceea..f6d798d1 100644 --- a/#Scenes/TopBarOverlay.tscn +++ b/#Scenes/TopBarOverlay.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=3 uid="uid://bam77cwf4emyr"] +[gd_scene load_steps=8 format=3 uid="uid://bam77cwf4emyr"] [ext_resource type="Texture2D" uid="uid://cjlatwiw7r80d" path="res://Art/Map/icon.png" id="1_a5uhs"] [ext_resource type="Script" path="res://UI/InventoryButton.gd" id="1_ml7tf"] @@ -6,6 +6,7 @@ [ext_resource type="Texture2D" uid="uid://cw0ojfpapsf3a" path="res://Art/Map/inventory_icon.png" id="2_j3m2f"] [ext_resource type="Texture2D" uid="uid://hqkt8t1v2f5h" path="res://Art/Card_layout/deck_pile.png" id="3_87q1i"] [ext_resource type="Script" path="res://UI/DeckPileUISetter.gd" id="4_jtp2y"] +[ext_resource type="Script" path="res://UI/GoldLabel.gd" id="7_dey8e"] [node name="TopBarOverlay" type="Control"] layout_mode = 3 @@ -18,6 +19,7 @@ grow_horizontal = 2 grow_vertical = 2 [node name="Inventory" type="TextureButton" parent="."] +visible = false layout_mode = 0 offset_left = 560.0 offset_top = 18.0 @@ -68,4 +70,13 @@ texture_focused = ExtResource("3_87q1i") stretch_mode = 0 script = ExtResource("4_jtp2y") +[node name="Gold" type="Label" parent="."] +layout_mode = 0 +offset_left = 554.0 +offset_top = 31.0 +offset_right = 608.0 +offset_bottom = 54.0 +text = "Gold: 99999999" +script = ExtResource("7_dey8e") + [connection signal="pressed" from="Inventory" to="Inventory" method="_on_pressed"] diff --git a/UI/GoldLabel.gd b/UI/GoldLabel.gd new file mode 100644 index 00000000..abd850e8 --- /dev/null +++ b/UI/GoldLabel.gd @@ -0,0 +1,10 @@ +extends Label +## Gold counter display in the top right. Should handle updates when gold changes + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + update_gold_text(InventoryManager.gold_component.get_gold_amount()) + InventoryManager.gold_component.gold_changed.connect(update_gold_text) + +func update_gold_text(new_gold_amount : int) -> void: + text = "Gold : " + str(new_gold_amount) From eb6f522c524b7a88f8664ec336b6d13715db0273 Mon Sep 17 00:00:00 2001 From: Michael K Date: Thu, 19 Dec 2024 21:27:13 -0600 Subject: [PATCH 2/3] moved the label slightly over --- #Scenes/TopBarOverlay.tscn | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/#Scenes/TopBarOverlay.tscn b/#Scenes/TopBarOverlay.tscn index f6d798d1..a984fd83 100644 --- a/#Scenes/TopBarOverlay.tscn +++ b/#Scenes/TopBarOverlay.tscn @@ -72,10 +72,10 @@ script = ExtResource("4_jtp2y") [node name="Gold" type="Label" parent="."] layout_mode = 0 -offset_left = 554.0 -offset_top = 31.0 -offset_right = 608.0 -offset_bottom = 54.0 +offset_left = 517.0 +offset_top = 34.0 +offset_right = 635.0 +offset_bottom = 57.0 text = "Gold: 99999999" script = ExtResource("7_dey8e") From 66d65b64131670d93ceab5d9a69cf9b6bd4cbb15 Mon Sep 17 00:00:00 2001 From: Michael K Date: Sat, 21 Dec 2024 21:44:07 -0600 Subject: [PATCH 3/3] made gold label a bit bigger --- #Scenes/TopBarOverlay.tscn | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/#Scenes/TopBarOverlay.tscn b/#Scenes/TopBarOverlay.tscn index a984fd83..ba0f9234 100644 --- a/#Scenes/TopBarOverlay.tscn +++ b/#Scenes/TopBarOverlay.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://bam77cwf4emyr"] +[gd_scene load_steps=9 format=3 uid="uid://bam77cwf4emyr"] [ext_resource type="Texture2D" uid="uid://cjlatwiw7r80d" path="res://Art/Map/icon.png" id="1_a5uhs"] [ext_resource type="Script" path="res://UI/InventoryButton.gd" id="1_ml7tf"] @@ -8,6 +8,9 @@ [ext_resource type="Script" path="res://UI/DeckPileUISetter.gd" id="4_jtp2y"] [ext_resource type="Script" path="res://UI/GoldLabel.gd" id="7_dey8e"] +[sub_resource type="LabelSettings" id="LabelSettings_khmn7"] +font_size = 24 + [node name="TopBarOverlay" type="Control"] layout_mode = 3 anchors_preset = 15 @@ -72,11 +75,12 @@ script = ExtResource("4_jtp2y") [node name="Gold" type="Label" parent="."] layout_mode = 0 -offset_left = 517.0 -offset_top = 34.0 -offset_right = 635.0 -offset_bottom = 57.0 -text = "Gold: 99999999" +offset_left = 504.0 +offset_top = 33.0 +offset_right = 627.0 +offset_bottom = 67.0 +text = "Gold: 1000" +label_settings = SubResource("LabelSettings_khmn7") script = ExtResource("7_dey8e") [connection signal="pressed" from="Inventory" to="Inventory" method="_on_pressed"]