From 4c077af28df385380ce4512ce2323c987630b30a 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 08:22:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(UI):=20=E4=BF=AE=E6=AD=A3ColorBar=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC=E5=92=8CDamageLabel=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor(Bullets): 调整BigLaser和Diamond的旋转插值系数 feat(EntityBase): 添加掉落物提示概率控制 style(BossBar): 添加currentValue默认值和label对齐方式 docs(GameRule): 新增掉落物提示概率配置项 --- components/UI/BossBar.tscn | 2 ++ components/UI/ColorBar.tscn | 2 +- components/UI/DamageLabel.tscn | 3 ++- scripts/Contents/Bullets/BigLaser.gd | 2 +- scripts/Contents/Bullets/Diamond.gd | 2 +- scripts/Statemachine/EntityBase.gd | 3 ++- scripts/Tools/GameRule.gd | 3 ++- 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/components/UI/BossBar.tscn b/components/UI/BossBar.tscn index 0b48297..1185261 100644 --- a/components/UI/BossBar.tscn +++ b/components/UI/BossBar.tscn @@ -32,6 +32,7 @@ offset_right = 0.0 offset_bottom = -40.0 grow_horizontal = 2 grow_vertical = 0 +currentValue = 0.0 [node name="panel" type="PanelContainer" parent="health"] layout_mode = 1 @@ -44,6 +45,7 @@ theme_override_styles/panel = SubResource("StyleBoxEmpty_ar00p") [node name="label" type="HBoxContainer" parent="health/panel"] layout_mode = 2 +alignment = 1 [node name="name" type="Label" parent="health/panel/label"] unique_name_in_owner = true diff --git a/components/UI/ColorBar.tscn b/components/UI/ColorBar.tscn index f039234..e8d675e 100644 --- a/components/UI/ColorBar.tscn +++ b/components/UI/ColorBar.tscn @@ -36,7 +36,7 @@ anchors_preset = 0 offset_right = 100.0 offset_bottom = 10.0 script = ExtResource("1_a106p") -currentValue = 0.0 +currentValue = 100.0 backBox = SubResource("StyleBoxFlat_kf2fc") middleBox1 = SubResource("StyleBoxFlat_sh754") middleBox2 = SubResource("StyleBoxFlat_8n8i8") diff --git a/components/UI/DamageLabel.tscn b/components/UI/DamageLabel.tscn index 1fb995f..cf29829 100644 --- a/components/UI/DamageLabel.tscn +++ b/components/UI/DamageLabel.tscn @@ -111,6 +111,7 @@ _data = { } [node name="DamageLabel" type="Node2D"] +z_index = 1 script = ExtResource("1_0q15u") color1 = Color(1, 1, 1, 1) @@ -122,7 +123,7 @@ offset_left = -100.0 offset_top = -100.0 offset_right = 100.0 offset_bottom = 100.0 -text = "114514" +text = "%dmg%" label_settings = SubResource("LabelSettings_valp2") horizontal_alignment = 1 vertical_alignment = 1 diff --git a/scripts/Contents/Bullets/BigLaser.gd b/scripts/Contents/Bullets/BigLaser.gd index 2aab452..f91072c 100644 --- a/scripts/Contents/Bullets/BigLaser.gd +++ b/scripts/Contents/Bullets/BigLaser.gd @@ -2,7 +2,7 @@ extends BulletBase class_name BigLaser func ai(): - rotation = lerp_angle(rotation, ((get_global_mouse_position() - position).angle()), 0.05) + rotation = lerp_angle(rotation, ((get_global_mouse_position() - position).angle()), 0.15) position = launcher.texture.global_position func applyDot(): hitbox.disabled = true diff --git a/scripts/Contents/Bullets/Diamond.gd b/scripts/Contents/Bullets/Diamond.gd index 8d04416..6d3f13c 100644 --- a/scripts/Contents/Bullets/Diamond.gd +++ b/scripts/Contents/Bullets/Diamond.gd @@ -4,6 +4,6 @@ class_name Diamond const traceTime = 2000 func ai(): - rotation = lerp_angle(rotation, position.angle_to_point(launcher.currentFocusedBoss.position), 0.2 * clamp((traceTime - timeLived()) / traceTime, 0, INF)) + rotation = lerp_angle(rotation, position.angle_to_point(launcher.currentFocusedBoss.position), 0.15 * clamp((traceTime - timeLived()) / traceTime, 0, INF)) canDamageSelf = !(timeLived() >= traceTime) forward(Vector2.from_angle(rotation)) diff --git a/scripts/Statemachine/EntityBase.gd b/scripts/Statemachine/EntityBase.gd index 7ae7bf3..691b0f5 100644 --- a/scripts/Statemachine/EntityBase.gd +++ b/scripts/Statemachine/EntityBase.gd @@ -90,7 +90,8 @@ func _ready(): ) itemCollected.connect( func(itemType, amount): - UIState.itemCollect.add_child(ItemShow.generate(itemType, amount, true)) + if MathTool.rate(GameRule.tipSpawnRateWhenGetDroppedItem): + UIState.itemCollect.add_child(ItemShow.generate(itemType, amount, true)) ) else: currentFocusedBoss = get_tree().get_nodes_in_group("players")[0] diff --git a/scripts/Tools/GameRule.gd b/scripts/Tools/GameRule.gd index 5998ecc..61e92b7 100644 --- a/scripts/Tools/GameRule.gd +++ b/scripts/Tools/GameRule.gd @@ -8,4 +8,5 @@ static var itemDroppedSpawnOffset: float = 30 # 掉落物生成位置的随机 static var appleDropRate: float = 0.1 # 苹果掉落概率 static var refreshCountIncreasePercent: Vector2 = Vector2(0.4, 1.1) # 刷新所需的棒球数量的增加的百分比,随机,默认为40%~110% static var entityCountBoostPerWave: float = 0.1 # 每波敌人数量增加的百分比,倍数级 -static var itemShowStayTime: int = 1500 # 物品展示组件如果设置了自动隐藏,那么隐藏前可以存活的时间 \ No newline at end of file +static var itemShowStayTime: int = 1500 # 物品展示组件如果设置了自动隐藏,那么隐藏前可以存活的时间 +static var tipSpawnRateWhenGetDroppedItem: float = 0.25 # 当玩家获取到掉落物时,提示的概率 \ No newline at end of file