mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-07-06 10:12:12 +08:00
feat: 为角色添加显示名称并完善面板功能
为熊、公鸡、母鸡等角色添加displayName属性 修改FullscreenPanelBase及相关面板以支持参数传递 完善GameOver面板显示凶手信息功能 调整部分角色的节点索引和状态栏位置
This commit is contained in:
@@ -56,6 +56,7 @@ radius = 114.215
|
|||||||
|
|
||||||
[node name="Bear" instance=ExtResource("1_3ves7")]
|
[node name="Bear" instance=ExtResource("1_3ves7")]
|
||||||
script = ExtResource("2_kh2af")
|
script = ExtResource("2_kh2af")
|
||||||
|
displayName = "狗熊"
|
||||||
|
|
||||||
[node name="texture" parent="." index="2"]
|
[node name="texture" parent="." index="2"]
|
||||||
position = Vector2(0, -80)
|
position = Vector2(0, -80)
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ stream = ExtResource("5_vcsbb")
|
|||||||
[node name="attack3" type="AudioStreamPlayer2D" parent="sounds" index="8"]
|
[node name="attack3" type="AudioStreamPlayer2D" parent="sounds" index="8"]
|
||||||
stream = ExtResource("7_qjhwc")
|
stream = ExtResource("7_qjhwc")
|
||||||
|
|
||||||
[node name="texture" parent="." index="1"]
|
[node name="texture" parent="." index="2"]
|
||||||
position = Vector2(0, -37)
|
position = Vector2(0, -37)
|
||||||
sprite_frames = SubResource("SpriteFrames_xji3d")
|
sprite_frames = SubResource("SpriteFrames_xji3d")
|
||||||
|
|
||||||
@@ -67,6 +67,6 @@ position = Vector2(30, -12)
|
|||||||
[node name="firepot" parent="texture/weapons/normal" index="0" instance=ExtResource("6_kvx3n")]
|
[node name="firepot" parent="texture/weapons/normal" index="0" instance=ExtResource("6_kvx3n")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
||||||
[node name="statebar" parent="." index="2" node_paths=PackedStringArray("entity")]
|
[node name="statebar" parent="." index="3" node_paths=PackedStringArray("entity")]
|
||||||
position = Vector2(0, -82)
|
position = Vector2(0, -82)
|
||||||
entity = NodePath("..")
|
entity = NodePath("..")
|
||||||
|
|||||||
@@ -33,13 +33,14 @@ radius = 40.0
|
|||||||
|
|
||||||
[node name="Hen" instance=ExtResource("1_twxai")]
|
[node name="Hen" instance=ExtResource("1_twxai")]
|
||||||
script = ExtResource("2_8u5a0")
|
script = ExtResource("2_8u5a0")
|
||||||
|
displayName = "母鸡"
|
||||||
drops = Array[int]([0, 1])
|
drops = Array[int]([0, 1])
|
||||||
dropCounts = Array[Vector2]([Vector2(6, 12), Vector2(4, 8)])
|
dropCounts = Array[Vector2]([Vector2(6, 12), Vector2(4, 8)])
|
||||||
|
|
||||||
[node name="hurt" parent="sounds" index="3"]
|
[node name="hurt" parent="sounds" index="3"]
|
||||||
stream = ExtResource("3_ojyt7")
|
stream = ExtResource("3_ojyt7")
|
||||||
|
|
||||||
[node name="texture" parent="." index="1"]
|
[node name="texture" parent="." index="2"]
|
||||||
sprite_frames = SubResource("SpriteFrames_xwexj")
|
sprite_frames = SubResource("SpriteFrames_xwexj")
|
||||||
animation = &"walk"
|
animation = &"walk"
|
||||||
|
|
||||||
@@ -48,6 +49,6 @@ shape = SubResource("CircleShape2D_0uubu")
|
|||||||
|
|
||||||
[node name="normal" type="Node2D" parent="texture/weapons" index="0"]
|
[node name="normal" type="Node2D" parent="texture/weapons" index="0"]
|
||||||
|
|
||||||
[node name="statebar" parent="." index="2" node_paths=PackedStringArray("entity")]
|
[node name="statebar" parent="." index="3" node_paths=PackedStringArray("entity")]
|
||||||
position = Vector2(0, -114)
|
position = Vector2(0, -114)
|
||||||
entity = NodePath("..")
|
entity = NodePath("..")
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ radius = 41.0122
|
|||||||
|
|
||||||
[node name="Rooster" instance=ExtResource("1_e5pl8")]
|
[node name="Rooster" instance=ExtResource("1_e5pl8")]
|
||||||
script = ExtResource("2_oqdqd")
|
script = ExtResource("2_oqdqd")
|
||||||
|
displayName = "公鸡"
|
||||||
|
|
||||||
[node name="weaponStore" parent="." index="0"]
|
[node name="weaponStore" parent="." index="0"]
|
||||||
process_mode = 4
|
process_mode = 4
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ font = ExtResource("3_oynlg")
|
|||||||
font_color = Color(0.710938, 0.710938, 0.710938, 1)
|
font_color = Color(0.710938, 0.710938, 0.710938, 1)
|
||||||
|
|
||||||
[node name="GameOver" instance=ExtResource("1_u2ynr")]
|
[node name="GameOver" instance=ExtResource("1_u2ynr")]
|
||||||
offset_top = 0.0
|
|
||||||
offset_bottom = 0.0
|
|
||||||
script = ExtResource("2_6cd45")
|
script = ExtResource("2_6cd45")
|
||||||
|
|
||||||
[node name="wrapper" parent="content" index="1"]
|
[node name="wrapper" parent="content" index="1"]
|
||||||
|
|||||||
@@ -4,5 +4,7 @@ extends FullscreenPanelBase
|
|||||||
@onready var audio = $"%audio"
|
@onready var audio = $"%audio"
|
||||||
@onready var deadreason = $"%deadreason"
|
@onready var deadreason = $"%deadreason"
|
||||||
|
|
||||||
func beforeOpen():
|
func beforeOpen(args: Array = []):
|
||||||
audio.play()
|
audio.play()
|
||||||
|
var reasonTemplate = MathTool.randc_from(GameRule.deadReasons)
|
||||||
|
deadreason.text = (reasonTemplate + "凶手是%s。") % args
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func _ready():
|
|||||||
)
|
)
|
||||||
avaliableFeeds.add_child(feed)
|
avaliableFeeds.add_child(feed)
|
||||||
|
|
||||||
func beforeOpen():
|
func beforeOpen(_args: Array = []):
|
||||||
selectedCount = 0
|
selectedCount = 0
|
||||||
regenerateCards()
|
regenerateCards()
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ extends FullscreenPanelBase
|
|||||||
|
|
||||||
@onready var box = $"%box"
|
@onready var box = $"%box"
|
||||||
|
|
||||||
func beforeOpen():
|
func beforeOpen(_args: Array = []):
|
||||||
for weapon in UIState.player.weapons:
|
for weapon in UIState.player.weapons:
|
||||||
weapon.show()
|
weapon.show()
|
||||||
UIState.player.weaponStore.remove_child(weapon)
|
UIState.player.weaponStore.remove_child(weapon)
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ func tryDie(by: BulletBase):
|
|||||||
EffectController.create(preload("res://components/Effects/DeadBlood.tscn"), texture.global_position).shot()
|
EffectController.create(preload("res://components/Effects/DeadBlood.tscn"), texture.global_position).shot()
|
||||||
await die()
|
await die()
|
||||||
if isPlayer() and UIState.player == self:
|
if isPlayer() and UIState.player == self:
|
||||||
UIState.setPanel("GameOver")
|
UIState.setPanel("GameOver", [displayName, by.launcher.displayName])
|
||||||
func tryHeal(count: float):
|
func tryHeal(count: float):
|
||||||
if inventory[ItemStore.ItemType.APPLE] > 0 and health < fields.get(FieldStore.Entity.MAX_HEALTH):
|
if inventory[ItemStore.ItemType.APPLE] > 0 and health < fields.get(FieldStore.Entity.MAX_HEALTH):
|
||||||
inventory[ItemStore.ItemType.APPLE] -= 1
|
inventory[ItemStore.ItemType.APPLE] -= 1
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ func hidePanel():
|
|||||||
await animator.animation_finished
|
await animator.animation_finished
|
||||||
visible = false
|
visible = false
|
||||||
afterClose()
|
afterClose()
|
||||||
func showPanel():
|
func showPanel(args: Array = []):
|
||||||
beforeOpen()
|
beforeOpen(args)
|
||||||
visible = true
|
visible = true
|
||||||
animator.play("show")
|
animator.play("show")
|
||||||
await animator.animation_finished
|
await animator.animation_finished
|
||||||
@@ -19,7 +19,7 @@ func _ready():
|
|||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
# 钩子
|
# 钩子
|
||||||
func beforeOpen():
|
func beforeOpen(_args: Array = []):
|
||||||
pass
|
pass
|
||||||
func afterClose():
|
func afterClose():
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -64,13 +64,13 @@ func _physics_process(_delta):
|
|||||||
if canOpen:
|
if canOpen:
|
||||||
setPanel("Weapon")
|
setPanel("Weapon")
|
||||||
|
|
||||||
static func setPanel(targetName: String = ""):
|
static func setPanel(targetName: String = "", args: Array = []):
|
||||||
currentPanel = null
|
currentPanel = null
|
||||||
for panel in panels.get_children():
|
for panel in panels.get_children():
|
||||||
if panel is FullscreenPanelBase:
|
if panel is FullscreenPanelBase:
|
||||||
if panel.name == targetName:
|
if panel.name == targetName:
|
||||||
currentPanel = panel
|
currentPanel = panel
|
||||||
panel.showPanel()
|
panel.showPanel(args)
|
||||||
else:
|
else:
|
||||||
panel.hidePanel()
|
panel.hidePanel()
|
||||||
static func closeCurrentPanel():
|
static func closeCurrentPanel():
|
||||||
|
|||||||
Reference in New Issue
Block a user