From 8e4b560e8270d2f0a819299443cd105039e3c379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Thu, 28 Aug 2025 07:01:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(UI):=20=E4=BF=AE=E6=AD=A3=E8=83=BD=E9=87=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=A0=BC=E5=BC=8F=E5=92=8C=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复能量标签显示格式从"%.1f"改为"%.2f" 调整BigLaser能量消耗从50改为100 修复ItemShow动画资源顺序错误问题 添加autoFree属性到UI场景中的物品节点 修改FieldShow默认文本从"+0"改为"0" --- components/Bullets/BigLaser.tscn | 2 +- components/Scenes/UI.tscn | 3 ++ components/UI/FieldShow.tscn | 2 +- components/UI/ItemShow.tscn | 52 ++++++++++++++++---------------- scripts/Statemachine/ItemShow.gd | 1 + scripts/Statemachine/UIState.gd | 2 +- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/components/Bullets/BigLaser.tscn b/components/Bullets/BigLaser.tscn index f9f8f11..6d84e71 100644 --- a/components/Bullets/BigLaser.tscn +++ b/components/Bullets/BigLaser.tscn @@ -24,7 +24,7 @@ fields = { 2: 1 } lifeTime = 5000.0 -needEnergy = 50.0 +needEnergy = 100.0 [node name="texture" parent="." index="0"] rotation = 1.5708 diff --git a/components/Scenes/UI.tscn b/components/Scenes/UI.tscn index 451cbcf..1e8178d 100644 --- a/components/Scenes/UI.tscn +++ b/components/Scenes/UI.tscn @@ -48,16 +48,19 @@ alignment = 1 [node name="baseball" parent="root/container/items" instance=ExtResource("3_o2oi4")] unique_name_in_owner = true layout_mode = 2 +autoFree = null [node name="basketball" parent="root/container/items" instance=ExtResource("3_o2oi4")] unique_name_in_owner = true layout_mode = 2 type = 1 +autoFree = null [node name="apple" parent="root/container/items" instance=ExtResource("3_o2oi4")] unique_name_in_owner = true layout_mode = 2 type = 2 +autoFree = null [node name="panels" type="Control" parent="root"] unique_name_in_owner = true diff --git a/components/UI/FieldShow.tscn b/components/UI/FieldShow.tscn index 00f38be..a4a474c 100644 --- a/components/UI/FieldShow.tscn +++ b/components/UI/FieldShow.tscn @@ -30,5 +30,5 @@ layout_mode = 2 size_flags_horizontal = 10 size_flags_vertical = 8 theme = ExtResource("2_x62bb") -text = "+0" +text = "0" horizontal_alignment = 1 diff --git a/components/UI/ItemShow.tscn b/components/UI/ItemShow.tscn index e6d3f73..ba80d9a 100644 --- a/components/UI/ItemShow.tscn +++ b/components/UI/ItemShow.tscn @@ -3,6 +3,31 @@ [ext_resource type="Script" path="res://scripts/Statemachine/ItemShow.gd" id="1_2dhsb"] [ext_resource type="Texture2D" uid="uid://bks8jmctleina" path="res://resources/items/baseball.svg" id="1_hyowb"] +[sub_resource type="Animation" id="Animation_6sxrr"] +length = 0.001 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:scale:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:modulate:a") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} + [sub_resource type="Animation" id="Animation_ltvf2"] resource_name = "hide" length = 0.5 @@ -29,31 +54,6 @@ tracks/1/keys = { "times": PackedFloat32Array(0, 0.5) } -[sub_resource type="Animation" id="Animation_6sxrr"] -length = 0.001 -tracks/0/type = "bezier" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:scale:x") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/1/type = "bezier" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath(".:modulate:a") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_xbbtb"] _data = { "RESET": SubResource("Animation_6sxrr"), @@ -71,7 +71,7 @@ script = ExtResource("1_2dhsb") unique_name_in_owner = true custom_minimum_size = Vector2(20, 20) layout_mode = 2 -size_flags_horizontal = 0 +size_flags_horizontal = 2 size_flags_vertical = 8 texture = ExtResource("1_hyowb") expand_mode = 1 diff --git a/scripts/Statemachine/ItemShow.gd b/scripts/Statemachine/ItemShow.gd index e2c611f..3ca74fb 100644 --- a/scripts/Statemachine/ItemShow.gd +++ b/scripts/Statemachine/ItemShow.gd @@ -12,6 +12,7 @@ class_name ItemShow func _ready(): if autoFree: + await TickTool.millseconds(2000) # 等待1秒后自动隐藏 animator.play("hide") await animator.animation_finished queue_free() diff --git a/scripts/Statemachine/UIState.gd b/scripts/Statemachine/UIState.gd index 97a246c..2798cbb 100644 --- a/scripts/Statemachine/UIState.gd +++ b/scripts/Statemachine/UIState.gd @@ -24,7 +24,7 @@ func _process(_delta): bossbar.visible = !!bossbar.entity func _physics_process(_delta): if is_instance_valid(player): - energyLabel.text = "%.1f" % player.energy + energyLabel.text = "%.2f" % player.energy energyMaxLabel.text = "%.1f" % player.fields.get(FieldStore.Entity.MAX_ENERGY) for i in items.get_children(): var item = i as ItemShow