From 11411cb3897c92bca0678f5d892e7a353f97946e Mon Sep 17 00:00:00 2001 From: Rmojarro1 <48000819+Rmojarro1@users.noreply.github.com> Date: Wed, 21 May 2025 16:00:39 -0700 Subject: [PATCH 1/4] Created branch, added sprite --- SharedAssets/riff_rabbit.png | Bin 0 -> 1612 bytes SharedAssets/riff_rabbit.png.import | 34 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 SharedAssets/riff_rabbit.png create mode 100644 SharedAssets/riff_rabbit.png.import diff --git a/SharedAssets/riff_rabbit.png b/SharedAssets/riff_rabbit.png new file mode 100644 index 0000000000000000000000000000000000000000..8612ce9d72bc813b5ae7401b2ce41e50cbc5ec48 GIT binary patch literal 1612 zcmV-S2DABzP)YAX9X8WNB|8RBvx=!KdMT000HO zNklENdkv{CmE(?PVLZh>|)IdJo9=6}zbMHO(-gE!W&iZ}2 zch0?M?)P(l=il$lsa_C<%Z+H?K8r21WoNT?i&}HvxfQ^7bK60GP z+XwUcK;(VOlNg~?EP_PtLW=Py0;JV56F=#*w35k)GDCqLW;WC#HC5cVH9!ndbN z$&wSfoTJ{mcUz9~l`DHZ_o&yXAU^o%i_S&B{sTuia(F+G-Ee6lnL*fQAXdrjO($O1qneZXF>S^)c+&w9#^_TF%u&y8M) z6bVTo#LW)H0R>wk{QdY93MmAd1uR z1<7w2eev3Dk8xFD5HbUhg>(>BKK@YXeL4tZC#xRwqBsybwmq&w2z&dY2MPczKrk^c zQX$l8lN|m27vF1_41m(uR;H$=L$7y7z}p8-I;Oy|FcE?-2Ou*%QB(jr^WX%qdhJtu z`SEM((tty@f)-(t&Ur2ejt<*FWd!557LU2QbePbz~USnO9XP6fD4= z|Es3N__7tNXy3bIn_k}A@40q)Z$ER*2K!!r(f4`WAbbJ16$eO^-x?JP1#A7bcWh%O z@*53AIuNk{q}?QRaz}xQ!T>-x1Z^j1k^sp{K{)`oG6evgdGl^%4Is1$h!!gfq5u&2 zfl$rY>vh1JL+ly=t=6oiTk@L94MEI{agi|q=o|z!>l+t>0MNa4kuHP0=m2zi|2Pob zP3Bhj%C<=tp;u_Cq#bPm6E|;yaeS<}v2ZU{Zg+VyJXUO-L=Jk5rXwziT z07TgURY4rzGh`q8nfIIb%VbNPmTMP7I;9Q46o9%7HZ=5#qf7@tZTo5j=*+_+0)Su$ zx(!ejK$!Vbsl@pBIHgj_{!F(Z>q-E%+N7r!hXnvZ?OvoB7j+!~@c!`$yh9j-n|I&q z2H>|G?}|=PHKj8T<^V*)!^8G*P%a{HF$A3%0!;x_tLGRP7%-||00fzbMf}&88-Sm2 z>B)6X#ZQ_1Na{h=e@aXO%mp1ZO8@`>4rN$LW=%~1DgXcg2mk;800000(o>TF0000< KMNUMnLSTY?3DWWa literal 0 HcmV?d00001 diff --git a/SharedAssets/riff_rabbit.png.import b/SharedAssets/riff_rabbit.png.import new file mode 100644 index 00000000..6199fb6e --- /dev/null +++ b/SharedAssets/riff_rabbit.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ox0iikoj3ooe" +path="res://.godot/imported/riff_rabbit.png-2c147e4df2c202fb7e5a3e11aacf00f1.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://SharedAssets/riff_rabbit.png" +dest_files=["res://.godot/imported/riff_rabbit.png-2c147e4df2c202fb7e5a3e11aacf00f1.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 From 1f1951bff5f63f7d7f90410014c3d785f0ee525f Mon Sep 17 00:00:00 2001 From: Rmojarro1 <48000819+Rmojarro1@users.noreply.github.com> Date: Wed, 21 May 2025 18:22:57 -0700 Subject: [PATCH 2/4] Heal Button functionality Shops now have heal button. Clicking it will restore 1/4 max hp at the cost of 30 money. This will disable the button for the reminder of time spent in shop. If player is at max hp or does not have enough money upon entering shop, button will be disabled automatically. Added display for the player's current health out of max health, with a placeholder heart sprite. --- Globals/Translations/Translations.csv | 1 + .../BattleDirector/Scripts/BattleDirector.cs | 2 +- Scenes/ShopScene/Scripts/ShopScene.cs | 55 ++++++++++++++ Scenes/ShopScene/ShopUI.tscn | 67 +++++++++++++++++- SharedAssets/Heart.png | Bin 0 -> 1523 bytes ...iff_rabbit.png.import => Heart.png.import} | 8 +-- SharedAssets/riff_rabbit.png | Bin 1612 -> 0 bytes 7 files changed, 126 insertions(+), 7 deletions(-) create mode 100644 SharedAssets/Heart.png rename SharedAssets/{riff_rabbit.png.import => Heart.png.import} (68%) delete mode 100644 SharedAssets/riff_rabbit.png diff --git a/Globals/Translations/Translations.csv b/Globals/Translations/Translations.csv index a0b7cb2b..a6317c12 100644 --- a/Globals/Translations/Translations.csv +++ b/Globals/Translations/Translations.csv @@ -34,6 +34,7 @@ SHOP_REMOVAL,Remove A Note,移除音符 SHOP_CONFIRM,Confirm Purchase,购买已确认 SHOP_CANCEL,Cancel,取消操作 REMOVAL_COST,Removal Fee,删除费用 +SHOP_HEAL, Heal, 愈合 BATTLE_ROOM_BEGIN_BUTTON,Begin Battle [Enter],开始战斗 [Enter] BATTLE_ROOM_PERFECT,Perfect,Perfect BATTLE_ROOM_GOOD,Good,良好 diff --git a/Scenes/BattleDirector/Scripts/BattleDirector.cs b/Scenes/BattleDirector/Scripts/BattleDirector.cs index 4c8036ca..65cff2a4 100644 --- a/Scenes/BattleDirector/Scripts/BattleDirector.cs +++ b/Scenes/BattleDirector/Scripts/BattleDirector.cs @@ -200,7 +200,7 @@ public override void _UnhandledInput(InputEvent @event) { if (@event is InputEventKey eventKey && eventKey.Pressed && !eventKey.Echo) { - return; + //return; if (eventKey.Keycode == Key.Key0) { DebugKillEnemy(); diff --git a/Scenes/ShopScene/Scripts/ShopScene.cs b/Scenes/ShopScene/Scripts/ShopScene.cs index 7709e7a3..3935c435 100644 --- a/Scenes/ShopScene/Scripts/ShopScene.cs +++ b/Scenes/ShopScene/Scripts/ShopScene.cs @@ -11,12 +11,18 @@ public partial class ShopScene : Control [Export] private Label _moneyLabel; + [Export] + private Label _currentHealthLabel; + [Export] private Button _exitButton; [Export] private Button _removalButton; + [Export] + private Button _healButton; + [Export] private GridContainer _noteGrid; @@ -66,6 +72,7 @@ public override void _Ready() _removalButton.Pressed += OpenRemovalPane; _removalAcceptButton.Pressed += RemoveNote; _cancelRemoveButton.Pressed += CloseRemovalPane; + _healButton.Pressed += TryHeal; } public override void _EnterTree() @@ -76,8 +83,10 @@ public override void _EnterTree() private void Initialize() { UpdateMoneyLabel(); + UpdateCurrentHealthLabel(); GenerateShopItems(); PopulatePossessedNotes(); + HealButtonStatus(); } public override void _Input(InputEvent @event) @@ -106,6 +115,12 @@ private void UpdateMoneyLabel() _moneyLabel.Text = StageProducer.PlayerStats.Money.ToString(); } + private void UpdateCurrentHealthLabel() + { + _currentHealthLabel.Text = + $"{StageProducer.PlayerStats.CurrentHealth}/{StageProducer.PlayerStats.MaxHealth}"; + } + private const int RelicOptions = 3; private const int NoteOptions = 5; @@ -322,4 +337,44 @@ private void RemoveNote() _selectedRemoveButton.QueueFree(); CloseRemovalPane(); } + + private bool _hasHealed = false; + private const int HealCost = 30; + private int _healAmount = (StageProducer.PlayerStats.MaxHealth / 4); + + private void HealButtonStatus() + { + if ( + StageProducer.PlayerStats.Money <= HealCost + || StageProducer.PlayerStats.CurrentHealth == StageProducer.PlayerStats.MaxHealth + || _hasHealed + ) + { + _healButton.Disabled = true; + } + } + + private void TryHeal() + { + if (_hasHealed) + { + return; + } + HealPlayer(); + } + + private void HealPlayer() + { + StageProducer.PlayerStats.CurrentHealth += _healAmount; + if (StageProducer.PlayerStats.CurrentHealth > StageProducer.PlayerStats.MaxHealth) + { + StageProducer.PlayerStats.CurrentHealth = StageProducer.PlayerStats.MaxHealth; + } + + StageProducer.PlayerStats.Money -= 30; + UpdateCurrentHealthLabel(); + UpdateMoneyLabel(); + _hasHealed = true; + HealButtonStatus(); + } } diff --git a/Scenes/ShopScene/ShopUI.tscn b/Scenes/ShopScene/ShopUI.tscn index 6a999efe..bbbc5c91 100644 --- a/Scenes/ShopScene/ShopUI.tscn +++ b/Scenes/ShopScene/ShopUI.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://bk0js6ji42xrt"] +[gd_scene load_steps=9 format=3 uid="uid://bk0js6ji42xrt"] [ext_resource type="Texture2D" uid="uid://djd6iw2g84bba" path="res://Scenes/UI/Assets/UI_CenterFrame.png" id="1_67his"] [ext_resource type="Script" uid="uid://dg0xaieus84ns" path="res://Scenes/ShopScene/Scripts/ShopScene.cs" id="1_bmt43"] @@ -7,8 +7,9 @@ [ext_resource type="Theme" uid="uid://d37e3tpsbxwak" path="res://Scenes/UI/Assets/GeneralTheme.tres" id="4_3vktw"] [ext_resource type="Script" uid="uid://cahjluc6v7ked" path="res://Scenes/UI/TitleScreen/Scripts/SceneChange.cs" id="5_w0f8r"] [ext_resource type="Texture2D" uid="uid://dyt1cvag13aik" path="res://SharedAssets/Money.png" id="6_tf865"] +[ext_resource type="Texture2D" uid="uid://dtaf4wcsur721" path="res://SharedAssets/Heart.png" id="8_r34tc"] -[node name="ShopUI" type="Control" node_paths=PackedStringArray("_moneyLabel", "_exitButton", "_removalButton", "_noteGrid", "_relicGrid", "_confirmationPopup", "_confirmationButton", "_denyButton", "_descriptionLabel", "_removalPanel", "_possessionGrid", "_removalAcceptButton", "_cancelRemoveButton", "_removalCostLabel")] +[node name="ShopUI" type="Control" node_paths=PackedStringArray("_moneyLabel", "_currentHealthLabel", "_exitButton", "_removalButton", "_healButton", "_noteGrid", "_relicGrid", "_confirmationPopup", "_confirmationButton", "_denyButton", "_descriptionLabel", "_removalPanel", "_possessionGrid", "_removalAcceptButton", "_cancelRemoveButton", "_removalCostLabel")] z_index = 2 layout_mode = 3 anchors_preset = 15 @@ -18,8 +19,10 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_bmt43") _moneyLabel = NodePath("MoneyContainer/MoneyFrame/MarginContainer/HBoxContainer/MoneyLabel") +_currentHealthLabel = NodePath("HealthContainer/HealthFrame/MarginContainer/HBoxContainer/CurrentHealthLabel") _exitButton = NodePath("BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer/Continue") _removalButton = NodePath("BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer/Removal") +_healButton = NodePath("BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer/Heal") _noteGrid = NodePath("TopPanel/MarginContainer/VBoxContainer/NoteSelection/MarginContainer/NotesBox/CenterContainer/NotesGrid") _relicGrid = NodePath("TopPanel/MarginContainer/VBoxContainer/RelicSelection/MarginContainer/RelicsBox/CenterContainer/RelicsGrid") _confirmationPopup = NodePath("ConfirmPurchase") @@ -265,6 +268,13 @@ size_flags_vertical = 4 theme = ExtResource("4_3vktw") text = "SHOP_REMOVAL" +[node name="Heal" type="Button" parent="BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +theme = ExtResource("4_3vktw") +text = "SHOP_HEAL" + [node name="Continue" type="Button" parent="BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer"] layout_mode = 2 size_flags_horizontal = 4 @@ -327,6 +337,59 @@ horizontal_alignment = 2 vertical_alignment = 1 clip_text = true +[node name="HealthContainer" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -125.0 +offset_top = 24.0 +offset_bottom = 53.0 +grow_horizontal = 0 +theme_override_constants/margin_left = -1 +theme_override_constants/margin_top = 5 +theme_override_constants/margin_right = 5 +theme_override_constants/margin_bottom = 0 + +[node name="HealthFrame" type="NinePatchRect" parent="HealthContainer"] +layout_mode = 2 +texture = ExtResource("2_bmt43") +patch_margin_left = 7 +patch_margin_top = 7 +patch_margin_right = 7 +patch_margin_bottom = 7 + +[node name="MarginContainer" type="MarginContainer" parent="HealthContainer/HealthFrame"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_right = 8 + +[node name="HBoxContainer" type="HBoxContainer" parent="HealthContainer/HealthFrame/MarginContainer"] +layout_mode = 2 + +[node name="MarginContainer" type="MarginContainer" parent="HealthContainer/HealthFrame/MarginContainer/HBoxContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 6 + +[node name="TextureRect" type="TextureRect" parent="HealthContainer/HealthFrame/MarginContainer/HBoxContainer/MarginContainer"] +layout_mode = 2 +size_flags_vertical = 4 +texture = ExtResource("8_r34tc") + +[node name="CurrentHealthLabel" type="Label" parent="HealthContainer/HealthFrame/MarginContainer/HBoxContainer"] +custom_minimum_size = Vector2(91, 0) +layout_mode = 2 +size_flags_horizontal = 10 +size_flags_vertical = 1 +text = "0" +horizontal_alignment = 2 +vertical_alignment = 1 +clip_text = true + [node name="ConfirmPurchase" type="CenterContainer" parent="."] visible = false z_index = 3 diff --git a/SharedAssets/Heart.png b/SharedAssets/Heart.png new file mode 100644 index 0000000000000000000000000000000000000000..8291fa203f62e6c23b1e83a6b882c4df53e946d6 GIT binary patch literal 1523 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&k#^NA%Cx&(BWL^R}EvXTnX}-P; zT0k}j11lpN12aeo0~3&tVqgWc85q16rQz%#Mh%3T_DlvAsG2As4FWAd%m}BM7cfFq z1H~3F!Bz7tU`DV(+PYQ6z5^-F0*}aI1_lvd5N4cms#l+Zfw?X-B%&n3*T*V3KUXg? zB|j-uuOhbqq>I6(!V1XDO)W`OsL0L9E4HezRRXK90GK4GQ<#=IWDQi$wiq3C7Jno3LtY6lk!VTY?YKi7Qq3;ohiw1 zdkRX6a=^BvBKW=|(^rz2hHznCF*G=U0izF+0ctbAs?D>YB-sQQ zQmz$1_dxvzbZ9cz-r|xJeIy0?Mg|5Jx&}tNMwa?;{{fwElag#zl39|I3Jy59f50K= zm{Wo(3Q`XWf}BiH$Xewj=B3*zRp_RqrX`lEMl}T@ zifXuxJ{EV_fP8Ni8I)R_pHm77e>+2CBO7p-pok)30-_@Vs}5vQbR7X1`6cMU^3c4@5<8dyXu?RkkYdRS8gL=t7{LrqoJyg_L4p=3 z#X_pWc?Lo`HFC!N$j8YptyK3~DPExjXsp79f1 z4sNBBO-rYyD^F<+I<;X#z?7+LA_6A;;SXEVF@=}gXo`mCCm!yU3Yq8s>gG+#zgzr% z=l8nv->cc%HGceRI$UdE-#n@4gnrX%?;A0Pot%wRQX-wVi*CP`n8=p5?%-^`+&T}R zwx^W^776LhzuFdDX`lRDJz`e#V`h#!2kz-DNpw8{U07P$oo8$l zIQb>g(qN5W(qo@S`8jjDwwQKJQRx(^a`}|(`YFjpYm;kOxYO<GFkdWo z)>+EM&Cz{(ROZHF;rf+nAO5Ksnd$|-6V(h;t?xc@`0sq(Z{F=cj#XDLuj}UCdx_!8 g7w0|dTe801_xZdeX8XLrCQ!-e>FVdQ&MBb@0AgX}-v9sr literal 0 HcmV?d00001 diff --git a/SharedAssets/riff_rabbit.png.import b/SharedAssets/Heart.png.import similarity index 68% rename from SharedAssets/riff_rabbit.png.import rename to SharedAssets/Heart.png.import index 6199fb6e..52d4bfcb 100644 --- a/SharedAssets/riff_rabbit.png.import +++ b/SharedAssets/Heart.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://ox0iikoj3ooe" -path="res://.godot/imported/riff_rabbit.png-2c147e4df2c202fb7e5a3e11aacf00f1.ctex" +uid="uid://dtaf4wcsur721" +path="res://.godot/imported/Heart.png-7dfefac643a1f449fa6e4073fe6379c7.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://SharedAssets/riff_rabbit.png" -dest_files=["res://.godot/imported/riff_rabbit.png-2c147e4df2c202fb7e5a3e11aacf00f1.ctex"] +source_file="res://SharedAssets/Heart.png" +dest_files=["res://.godot/imported/Heart.png-7dfefac643a1f449fa6e4073fe6379c7.ctex"] [params] diff --git a/SharedAssets/riff_rabbit.png b/SharedAssets/riff_rabbit.png deleted file mode 100644 index 8612ce9d72bc813b5ae7401b2ce41e50cbc5ec48..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1612 zcmV-S2DABzP)YAX9X8WNB|8RBvx=!KdMT000HO zNklENdkv{CmE(?PVLZh>|)IdJo9=6}zbMHO(-gE!W&iZ}2 zch0?M?)P(l=il$lsa_C<%Z+H?K8r21WoNT?i&}HvxfQ^7bK60GP z+XwUcK;(VOlNg~?EP_PtLW=Py0;JV56F=#*w35k)GDCqLW;WC#HC5cVH9!ndbN z$&wSfoTJ{mcUz9~l`DHZ_o&yXAU^o%i_S&B{sTuia(F+G-Ee6lnL*fQAXdrjO($O1qneZXF>S^)c+&w9#^_TF%u&y8M) z6bVTo#LW)H0R>wk{QdY93MmAd1uR z1<7w2eev3Dk8xFD5HbUhg>(>BKK@YXeL4tZC#xRwqBsybwmq&w2z&dY2MPczKrk^c zQX$l8lN|m27vF1_41m(uR;H$=L$7y7z}p8-I;Oy|FcE?-2Ou*%QB(jr^WX%qdhJtu z`SEM((tty@f)-(t&Ur2ejt<*FWd!557LU2QbePbz~USnO9XP6fD4= z|Es3N__7tNXy3bIn_k}A@40q)Z$ER*2K!!r(f4`WAbbJ16$eO^-x?JP1#A7bcWh%O z@*53AIuNk{q}?QRaz}xQ!T>-x1Z^j1k^sp{K{)`oG6evgdGl^%4Is1$h!!gfq5u&2 zfl$rY>vh1JL+ly=t=6oiTk@L94MEI{agi|q=o|z!>l+t>0MNa4kuHP0=m2zi|2Pob zP3Bhj%C<=tp;u_Cq#bPm6E|;yaeS<}v2ZU{Zg+VyJXUO-L=Jk5rXwziT z07TgURY4rzGh`q8nfIIb%VbNPmTMP7I;9Q46o9%7HZ=5#qf7@tZTo5j=*+_+0)Su$ zx(!ejK$!Vbsl@pBIHgj_{!F(Z>q-E%+N7r!hXnvZ?OvoB7j+!~@c!`$yh9j-n|I&q z2H>|G?}|=PHKj8T<^V*)!^8G*P%a{HF$A3%0!;x_tLGRP7%-||00fzbMf}&88-Sm2 z>B)6X#ZQ_1Na{h=e@aXO%mp1ZO8@`>4rN$LW=%~1DgXcg2mk;800000(o>TF0000< KMNUMnLSTY?3DWWa From f794d5f3d7aba746d9f71f3abadf54a393b27679 Mon Sep 17 00:00:00 2001 From: LifeHckr Date: Wed, 21 May 2025 20:10:33 -0700 Subject: [PATCH 3/4] Adjust Shop For Heal Button Remove health label to use PlayerPuppet in the scene Adjust Shop UI because the heal button was too big for the container Adjust Translation to specify cost and heal amount Fixed issue where removing note didn't update money label --- Globals/Translations/Translations.csv | 2 +- Scenes/ShopScene/Scripts/ShopScene.cs | 60 +++++--------- Scenes/ShopScene/ShopScene.tscn | 3 +- Scenes/ShopScene/ShopUI.tscn | 108 ++++++++------------------ 4 files changed, 56 insertions(+), 117 deletions(-) diff --git a/Globals/Translations/Translations.csv b/Globals/Translations/Translations.csv index a6317c12..b29a7401 100644 --- a/Globals/Translations/Translations.csv +++ b/Globals/Translations/Translations.csv @@ -34,7 +34,7 @@ SHOP_REMOVAL,Remove A Note,移除音符 SHOP_CONFIRM,Confirm Purchase,购买已确认 SHOP_CANCEL,Cancel,取消操作 REMOVAL_COST,Removal Fee,删除费用 -SHOP_HEAL, Heal, 愈合 +SHOP_HEAL,Heal 25%: 30g,愈合 25%: 30硬币 BATTLE_ROOM_BEGIN_BUTTON,Begin Battle [Enter],开始战斗 [Enter] BATTLE_ROOM_PERFECT,Perfect,Perfect BATTLE_ROOM_GOOD,Good,良好 diff --git a/Scenes/ShopScene/Scripts/ShopScene.cs b/Scenes/ShopScene/Scripts/ShopScene.cs index 3935c435..814b4334 100644 --- a/Scenes/ShopScene/Scripts/ShopScene.cs +++ b/Scenes/ShopScene/Scripts/ShopScene.cs @@ -11,9 +11,6 @@ public partial class ShopScene : Control [Export] private Label _moneyLabel; - [Export] - private Label _currentHealthLabel; - [Export] private Button _exitButton; @@ -56,6 +53,9 @@ public partial class ShopScene : Control [Export] private Label _removalCostLabel; + [Export] + private PlayerPuppet _player; + private ButtonGroup _bGroup; private readonly int[] _priceByRarity = [100, 90, 80, 70, 60, 50, 9]; @@ -63,8 +63,9 @@ public partial class ShopScene : Control private List _shopItems = new List(); - public override void _Ready() + public override void _EnterTree() { + BgAudioPlayer.LiveInstance.ResumeLevelMusic(); _bGroup = new ButtonGroup(); Initialize(); _confirmationButton.Pressed += TryPurchase; @@ -75,18 +76,12 @@ public override void _Ready() _healButton.Pressed += TryHeal; } - public override void _EnterTree() - { - BgAudioPlayer.LiveInstance.ResumeLevelMusic(); - } - private void Initialize() { UpdateMoneyLabel(); - UpdateCurrentHealthLabel(); GenerateShopItems(); PopulatePossessedNotes(); - HealButtonStatus(); + UpdateHealButton(); } public override void _Input(InputEvent @event) @@ -115,12 +110,6 @@ private void UpdateMoneyLabel() _moneyLabel.Text = StageProducer.PlayerStats.Money.ToString(); } - private void UpdateCurrentHealthLabel() - { - _currentHealthLabel.Text = - $"{StageProducer.PlayerStats.CurrentHealth}/{StageProducer.PlayerStats.MaxHealth}"; - } - private const int RelicOptions = 3; private const int NoteOptions = 5; @@ -224,6 +213,7 @@ private void TryPurchase() _currentUItem = null; RefreshShopPrices(); + UpdateHealButton(); } private Control _lastFocused; @@ -336,45 +326,37 @@ private void RemoveNote() StageProducer.PlayerStats.RemoveNote(_toRemove); _selectedRemoveButton.QueueFree(); CloseRemovalPane(); + UpdateMoneyLabel(); + UpdateHealButton(); } - private bool _hasHealed = false; + private bool _hasHealed; private const int HealCost = 30; private int _healAmount = (StageProducer.PlayerStats.MaxHealth / 4); - private void HealButtonStatus() + private void UpdateHealButton() { - if ( + _healButton.Disabled = StageProducer.PlayerStats.Money <= HealCost || StageProducer.PlayerStats.CurrentHealth == StageProducer.PlayerStats.MaxHealth - || _hasHealed - ) - { - _healButton.Disabled = true; - } + || _hasHealed; } private void TryHeal() { - if (_hasHealed) + if ( + StageProducer.PlayerStats.Money <= HealCost + || StageProducer.PlayerStats.CurrentHealth == StageProducer.PlayerStats.MaxHealth + || _hasHealed + ) { return; } - HealPlayer(); - } - - private void HealPlayer() - { - StageProducer.PlayerStats.CurrentHealth += _healAmount; - if (StageProducer.PlayerStats.CurrentHealth > StageProducer.PlayerStats.MaxHealth) - { - StageProducer.PlayerStats.CurrentHealth = StageProducer.PlayerStats.MaxHealth; - } - StageProducer.PlayerStats.Money -= 30; - UpdateCurrentHealthLabel(); + StageProducer.PlayerStats.Money -= HealCost; UpdateMoneyLabel(); + UpdateHealButton(); _hasHealed = true; - HealButtonStatus(); + _player.Heal(_healAmount); } } diff --git a/Scenes/ShopScene/ShopScene.tscn b/Scenes/ShopScene/ShopScene.tscn index c6d905f7..5bfaee34 100644 --- a/Scenes/ShopScene/ShopScene.tscn +++ b/Scenes/ShopScene/ShopScene.tscn @@ -55,6 +55,7 @@ offset_bottom = 180.0 texture = ExtResource("2_dt33i") script = ExtResource("3_n34g6") -[node name="ShopUI" parent="." instance=ExtResource("8_2xatg")] +[node name="ShopUI" parent="." node_paths=PackedStringArray("_player") instance=ExtResource("8_2xatg")] offset_right = 640.0 offset_bottom = 360.0 +_player = NodePath("../PlayerMarker/PlayerPuppet") diff --git a/Scenes/ShopScene/ShopUI.tscn b/Scenes/ShopScene/ShopUI.tscn index bbbc5c91..2aaca710 100644 --- a/Scenes/ShopScene/ShopUI.tscn +++ b/Scenes/ShopScene/ShopUI.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3 uid="uid://bk0js6ji42xrt"] +[gd_scene load_steps=8 format=3 uid="uid://bk0js6ji42xrt"] [ext_resource type="Texture2D" uid="uid://djd6iw2g84bba" path="res://Scenes/UI/Assets/UI_CenterFrame.png" id="1_67his"] [ext_resource type="Script" uid="uid://dg0xaieus84ns" path="res://Scenes/ShopScene/Scripts/ShopScene.cs" id="1_bmt43"] @@ -7,9 +7,8 @@ [ext_resource type="Theme" uid="uid://d37e3tpsbxwak" path="res://Scenes/UI/Assets/GeneralTheme.tres" id="4_3vktw"] [ext_resource type="Script" uid="uid://cahjluc6v7ked" path="res://Scenes/UI/TitleScreen/Scripts/SceneChange.cs" id="5_w0f8r"] [ext_resource type="Texture2D" uid="uid://dyt1cvag13aik" path="res://SharedAssets/Money.png" id="6_tf865"] -[ext_resource type="Texture2D" uid="uid://dtaf4wcsur721" path="res://SharedAssets/Heart.png" id="8_r34tc"] -[node name="ShopUI" type="Control" node_paths=PackedStringArray("_moneyLabel", "_currentHealthLabel", "_exitButton", "_removalButton", "_healButton", "_noteGrid", "_relicGrid", "_confirmationPopup", "_confirmationButton", "_denyButton", "_descriptionLabel", "_removalPanel", "_possessionGrid", "_removalAcceptButton", "_cancelRemoveButton", "_removalCostLabel")] +[node name="ShopUI" type="Control" node_paths=PackedStringArray("_moneyLabel", "_exitButton", "_removalButton", "_healButton", "_noteGrid", "_relicGrid", "_confirmationPopup", "_confirmationButton", "_denyButton", "_descriptionLabel", "_removalPanel", "_possessionGrid", "_removalAcceptButton", "_cancelRemoveButton", "_removalCostLabel")] z_index = 2 layout_mode = 3 anchors_preset = 15 @@ -19,10 +18,9 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_bmt43") _moneyLabel = NodePath("MoneyContainer/MoneyFrame/MarginContainer/HBoxContainer/MoneyLabel") -_currentHealthLabel = NodePath("HealthContainer/HealthFrame/MarginContainer/HBoxContainer/CurrentHealthLabel") -_exitButton = NodePath("BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer/Continue") -_removalButton = NodePath("BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer/Removal") -_healButton = NodePath("BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer/Heal") +_exitButton = NodePath("OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer/Continue") +_removalButton = NodePath("OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer/Removal") +_healButton = NodePath("OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer/Heal") _noteGrid = NodePath("TopPanel/MarginContainer/VBoxContainer/NoteSelection/MarginContainer/NotesBox/CenterContainer/NotesGrid") _relicGrid = NodePath("TopPanel/MarginContainer/VBoxContainer/RelicSelection/MarginContainer/RelicsBox/CenterContainer/RelicsGrid") _confirmationPopup = NodePath("ConfirmPurchase") @@ -37,7 +35,7 @@ _removalCostLabel = NodePath("Removal/Panel/MarginContainer/VBoxContainer/Option [node name="TopPanel" type="NinePatchRect" parent="."] layout_mode = 0 -offset_right = 508.0 +offset_right = 463.0 offset_bottom = 211.0 texture = ExtResource("1_67his") patch_margin_left = 12 @@ -140,7 +138,7 @@ columns = 6 [node name="BottomPanel" type="NinePatchRect" parent="."] layout_mode = 0 offset_top = 211.0 -offset_right = 640.0 +offset_right = 463.0 offset_bottom = 360.0 texture = ExtResource("1_67his") patch_margin_left = 12 @@ -149,10 +147,12 @@ patch_margin_right = 12 patch_margin_bottom = 12 [node name="DescBox" type="MarginContainer" parent="BottomPanel"] -layout_mode = 2 -offset_right = 640.0 -offset_bottom = 149.0 -grow_vertical = 0 +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 size_flags_vertical = 3 size_flags_stretch_ratio = 0.4 theme_override_constants/margin_left = 10 @@ -213,9 +213,18 @@ autowrap_mode = 2 clip_text = true text_overrun_behavior = 1 -[node name="OptionsBG" type="NinePatchRect" parent="BottomPanel/DescBox/HBoxContainer"] +[node name="OptionsBG" type="NinePatchRect" parent="."] self_modulate = Color(1, 1, 1, 0.75) -layout_mode = 2 +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -176.0 +offset_top = -179.0 +grow_horizontal = 0 +grow_vertical = 0 size_flags_horizontal = 3 size_flags_vertical = 3 size_flags_stretch_ratio = 0.39 @@ -225,7 +234,7 @@ patch_margin_top = 6 patch_margin_right = 6 patch_margin_bottom = 7 -[node name="OptionsMargin" type="MarginContainer" parent="BottomPanel/DescBox/HBoxContainer/OptionsBG"] +[node name="OptionsMargin" type="MarginContainer" parent="OptionsBG"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -238,7 +247,7 @@ theme_override_constants/margin_top = 4 theme_override_constants/margin_right = 4 theme_override_constants/margin_bottom = 4 -[node name="OptionsBG" type="NinePatchRect" parent="BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin"] +[node name="OptionsBG" type="NinePatchRect" parent="OptionsBG/OptionsMargin"] layout_mode = 2 texture = ExtResource("3_r34tc") patch_margin_left = 7 @@ -246,7 +255,7 @@ patch_margin_top = 7 patch_margin_right = 7 patch_margin_bottom = 7 -[node name="MarginContainer" type="MarginContainer" parent="BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG"] +[node name="MarginContainer" type="MarginContainer" parent="OptionsBG/OptionsMargin/OptionsBG"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -254,28 +263,28 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 theme_override_constants/margin_left = 7 -theme_override_constants/margin_top = 7 +theme_override_constants/margin_top = 0 theme_override_constants/margin_right = 7 -[node name="VBoxContainer" type="VBoxContainer" parent="BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer"] +[node name="VBoxContainer" type="VBoxContainer" parent="OptionsBG/OptionsMargin/OptionsBG/MarginContainer"] layout_mode = 2 alignment = 1 -[node name="Removal" type="Button" parent="BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer"] +[node name="Removal" type="Button" parent="OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer"] layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 4 theme = ExtResource("4_3vktw") text = "SHOP_REMOVAL" -[node name="Heal" type="Button" parent="BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer"] +[node name="Heal" type="Button" parent="OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer"] layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 4 theme = ExtResource("4_3vktw") text = "SHOP_HEAL" -[node name="Continue" type="Button" parent="BottomPanel/DescBox/HBoxContainer/OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer"] +[node name="Continue" type="Button" parent="OptionsBG/OptionsMargin/OptionsBG/MarginContainer/VBoxContainer"] layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 4 @@ -337,59 +346,6 @@ horizontal_alignment = 2 vertical_alignment = 1 clip_text = true -[node name="HealthContainer" type="MarginContainer" parent="."] -layout_mode = 1 -anchors_preset = 1 -anchor_left = 1.0 -anchor_right = 1.0 -offset_left = -125.0 -offset_top = 24.0 -offset_bottom = 53.0 -grow_horizontal = 0 -theme_override_constants/margin_left = -1 -theme_override_constants/margin_top = 5 -theme_override_constants/margin_right = 5 -theme_override_constants/margin_bottom = 0 - -[node name="HealthFrame" type="NinePatchRect" parent="HealthContainer"] -layout_mode = 2 -texture = ExtResource("2_bmt43") -patch_margin_left = 7 -patch_margin_top = 7 -patch_margin_right = 7 -patch_margin_bottom = 7 - -[node name="MarginContainer" type="MarginContainer" parent="HealthContainer/HealthFrame"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/margin_right = 8 - -[node name="HBoxContainer" type="HBoxContainer" parent="HealthContainer/HealthFrame/MarginContainer"] -layout_mode = 2 - -[node name="MarginContainer" type="MarginContainer" parent="HealthContainer/HealthFrame/MarginContainer/HBoxContainer"] -layout_mode = 2 -theme_override_constants/margin_left = 6 - -[node name="TextureRect" type="TextureRect" parent="HealthContainer/HealthFrame/MarginContainer/HBoxContainer/MarginContainer"] -layout_mode = 2 -size_flags_vertical = 4 -texture = ExtResource("8_r34tc") - -[node name="CurrentHealthLabel" type="Label" parent="HealthContainer/HealthFrame/MarginContainer/HBoxContainer"] -custom_minimum_size = Vector2(91, 0) -layout_mode = 2 -size_flags_horizontal = 10 -size_flags_vertical = 1 -text = "0" -horizontal_alignment = 2 -vertical_alignment = 1 -clip_text = true - [node name="ConfirmPurchase" type="CenterContainer" parent="."] visible = false z_index = 3 From f9754e0f70c867931aba87254daf45cd3f2a1e23 Mon Sep 17 00:00:00 2001 From: LifeHckr Date: Thu, 22 May 2025 13:08:51 -0700 Subject: [PATCH 4/4] Adjust tutorial translation --- Globals/Translations/Translations.csv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Globals/Translations/Translations.csv b/Globals/Translations/Translations.csv index b29a7401..b6923eea 100644 --- a/Globals/Translations/Translations.csv +++ b/Globals/Translations/Translations.csv @@ -123,7 +123,7 @@ TUTORIAL_NODYING,No dying during a tutorial!,教程中不会死亡! TUTORIAL_DIALOGUE_1,"Hello, welcome to Midnight Riff!",你好!欢迎来到午夜即兴! TUTORIAL_DIALOGUE_2,This is a rhythm game where notes move right to left.,这是一款节奏游戏,音符从右向左移动。 TUTORIAL_DIALOGUE_3,"Press the correct button as the notes line up to hit the note. Try to time it as well as you can!",音符对齐时按下正确的按键,尽量精准地进行点击! -TUTORIAL_DIALOGUE_4,"What are the correct buttons? I'll help you out and show you. These can be changed from the meu. Once you press continue we can get started!",正确的按键是什么?我会帮你指出来。这些可以在菜单中更改。按下继续后,我们就可以开始了! +TUTORIAL_DIALOGUE_4,"What are the correct buttons? I'll help you out and show you. These can be changed from the menu. Once you press continue we can get started!",正确的按键是什么?我会帮你指出来。这些可以在菜单中更改。按下继续后,我们就可以开始了! TUTORIAL_LOOP_1,At set intervals the chart loops! This means all notes on the chart repeat. You know a loop is coming up when this symbol scrolls by.,在固定的时间间隔内,乐谱会循环!这意味着乐谱上的所有音符都会重复出现。当这个符号滚动经过时,你就知道循环即将开始。 TUTORIAL_LOOP_2,"In case you haven't noticed, I'll explain these things on the left side. This is your note queue.",如果你还没注意到,我会在左侧解释这些内容。这是你的音符队列。 TUTORIAL_LOOP_3,"This is the combo multiplier, as you hit notes successfully your multiplier will rise. If you miss a note, your multiplier gets reset.",这是连击倍数,成功点击音符后,你的倍数将会上升。如果你错过了一个音符,你的倍数将会重置。 @@ -131,7 +131,7 @@ TUTORIAL_LOOP_4,"This is the freestyle bar, as you hit notes successfully, the f TUTORIAL_LOOP_5,"By now you've probably taken damage. These aren't just cozy songs, these are battles! You take damage when you miss or have bad timing, or from enemy effects. How do you deal damage to enemies? Fill up the bar and I'll tell you.",到目前为止,你可能已经受到伤害了。这些不仅仅是轻松的歌曲,它们是战斗!你错过音符或时机不好,或者受到敌人的效果影响时,都会受到伤害。你如何对敌人造成伤害?填满能量条,我会告诉你。 TUTORIAL_PLACE_1,"Okay, now that the bar is full, you can press a lane button to place your own note. Your notes have special effects. Placing notes consumes the freestyle bar.",好的,现在能量条已满,你可以按下轨道按键放置你自己的音符。你的音符具有特殊效果。放置音符会消耗风格条。 TUTORIAL_PLACE_2,These note effects range from dealing damage to applying status effects!,这些音符效果从造成伤害到施加状态效果不等! -TUTORIAL_PLACE_3,"Your notes can be placed anywhere a note doesn't already exist, and that isn't over the loop marker. But be careful, if you try to place a note while the bar isn't full you may miss a note!",你的音符可以放置在任何没有音符存在且不在循环标记上的位置。但是要小心,如果你试图在能量条未满时放置音符,你可能会错过音符! +TUTORIAL_PLACE_3,"Your notes can be placed anywhere a note doesn't already exist, and that isn't over the loop marker.",你的音符可以放置在任何没有音符存在且不在循环标记上的位置。 TUTORIAL_PLACE_4,"The note you'll place is indicated in the top of the note queue.",你将要放置的音符显示在音符队列顶部。 TUTORIAL_PLACE_5,"Notes are automatically hit when you place them, how helpful, but they come back around when the chart loops, and you need to time hitting them then.",放置音符时会自动击中,这非常方便,但当乐谱循环时它们会再次出现,你需要掌握时机才能击中它们。 TUTORIAL_PLACE_6,"Now go ahead, place a note in the bottom lane!",现在,在最下方的轨道上放置一个音符吧!