From 5f75bde31745a44bea1ed06153d21d2b8c94234e Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 16 Dec 2025 19:24:20 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Made=20heal=20button=20show=20ho?= =?UTF-8?q?w=20many=20beats=20are=20left?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/Babushka_scene_fight_happening.tscn | 12 ++++++++++-- .../CSharp/Common/Fight/UI/HealButtonVisual.cs | 15 +++++++++++++++ .../Common/Fight/UI/HealButtonVisual.cs.uid | 1 + 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 scripts/CSharp/Common/Fight/UI/HealButtonVisual.cs create mode 100644 scripts/CSharp/Common/Fight/UI/HealButtonVisual.cs.uid diff --git a/scenes/Babushka_scene_fight_happening.tscn b/scenes/Babushka_scene_fight_happening.tscn index 94fdfae..183a8b2 100644 --- a/scenes/Babushka_scene_fight_happening.tscn +++ b/scenes/Babushka_scene_fight_happening.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=18 format=3 uid="uid://cjshlwk8ajpnp"] +[gd_scene load_steps=20 format=3 uid="uid://cjshlwk8ajpnp"] [ext_resource type="Script" uid="uid://cnhpnn8o0gybd" path="res://scripts/CSharp/Common/Fight/FightHappeningSceneSetup.cs" id="1_fiutj"] [ext_resource type="Script" uid="uid://c76mhhqyk4lgh" path="res://scripts/CSharp/Common/Fight/FightHappening.cs" id="1_gsk03"] @@ -15,6 +15,8 @@ [ext_resource type="Script" uid="uid://d2ugtb3dalrg3" path="res://scripts/CSharp/Common/Fight/FightHappeningStateDebugger.cs" id="8_tv7cl"] [ext_resource type="Script" uid="uid://2f7rqk50gtdg" path="res://scripts/CSharp/Common/Fight/SwitchSceneOnFightEnd.cs" id="10_qqd8u"] [ext_resource type="Script" uid="uid://6nniwfxye8ss" path="res://scripts/CSharp/Common/Fight/UsedItemIndicatorVisual.cs" id="14_b4ll5"] +[ext_resource type="Script" uid="uid://71mdwp2m4rta" path="res://scripts/CSharp/Common/Fight/UI/HealButtonVisual.cs" id="14_oy2wu"] +[ext_resource type="Resource" uid="uid://0mnsr4anoaiq" path="res://resources/items/beet.tres" id="15_k4fcr"] [ext_resource type="PackedScene" uid="uid://l1hdihubffeg" path="res://prefabs/fight/damage_flying_nuber.tscn" id="15_oy2wu"] [ext_resource type="Texture2D" uid="uid://djewfwrdt4iv3" path="res://art/ui/UI/icons/icon-fruit-beetroot.png" id="16_k4fcr"] @@ -155,7 +157,12 @@ theme_override_constants/margin_bottom = 10 [node name="Talk Button" type="Button" parent="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer3"] layout_mode = 2 theme_override_font_sizes/font_size = 41 -text = "Heal" +text = "x19 - Heal" +icon = ExtResource("16_k4fcr") +alignment = 0 +expand_icon = true +script = ExtResource("14_oy2wu") +_healItemBlueprint = ExtResource("15_k4fcr") [node name="MarginContainer4" type="MarginContainer" parent="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer"] layout_mode = 2 @@ -236,4 +243,5 @@ _itemTexture = ExtResource("16_k4fcr") [connection signal="pressed" from="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer4/Flee Button" to="ActionSelect" method="SelectAction" binds= [4]] [connection signal="OnStateEntered" from="ActionSelect/StateReactionInputActionSelect" to="ActionSelect" method="show"] [connection signal="OnStateEntered" from="ActionSelect/StateReactionInputActionSelect" to="ActionSelect" method="StateEntered"] +[connection signal="OnStateEntered" from="ActionSelect/StateReactionInputActionSelect" to="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer3/Talk Button" method="UpdateText"] [connection signal="OnStateExited" from="ActionSelect/StateReactionInputActionSelect" to="ActionSelect" method="hide"] diff --git a/scripts/CSharp/Common/Fight/UI/HealButtonVisual.cs b/scripts/CSharp/Common/Fight/UI/HealButtonVisual.cs new file mode 100644 index 0000000..7cc8a4a --- /dev/null +++ b/scripts/CSharp/Common/Fight/UI/HealButtonVisual.cs @@ -0,0 +1,15 @@ +using Babushka.scripts.CSharp.Common.Inventory; +using Godot; + +namespace Babushka.scripts.CSharp.Common.Fight.UI; + +public partial class HealButtonVisual : Button +{ + [Export] private ItemResource _healItemBlueprint = null!; + + public void UpdateText() + { + var healItemsLeft = InventoryManager.Instance.playerInventory!.TotalItemsOfBlueprint(_healItemBlueprint); + Text = $"x{healItemsLeft} - Heal"; + } +} \ No newline at end of file diff --git a/scripts/CSharp/Common/Fight/UI/HealButtonVisual.cs.uid b/scripts/CSharp/Common/Fight/UI/HealButtonVisual.cs.uid new file mode 100644 index 0000000..2634d19 --- /dev/null +++ b/scripts/CSharp/Common/Fight/UI/HealButtonVisual.cs.uid @@ -0,0 +1 @@ +uid://71mdwp2m4rta