1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-27 22:41:56 +08:00

feat(初始选择面板): 添加武器选择功能并优化界面布局

- 在初始选择面板中增加武器选择功能
- 添加开始游戏按钮
- 优化界面布局,将标题和选择项分组显示
- 实现选择后自动关闭对应选择区域的功能
This commit is contained in:
2026-01-31 13:01:27 +08:00
parent 31025beda9
commit 82ae6b343a
2 changed files with 60 additions and 14 deletions
@@ -11,17 +11,39 @@ script = ExtResource("2_eugsq")
[node name="wrapper" parent="content" index="1"]
theme_override_constants/separation = 40
[node name="title" type="Label" parent="content/wrapper" index="0"]
layout_mode = 2
size_flags_horizontal = 4
text = "在游戏开始前,你可以选择一项初始增益。"
[node name="container" type="ScrollContainer" parent="content/wrapper" index="1"]
[node name="container" type="ScrollContainer" parent="content/wrapper" index="0"]
layout_mode = 2
follow_focus = true
vertical_scroll_mode = 0
[node name="initialFeedSelection" type="HBoxContainer" parent="content/wrapper/container" index="0"]
[node name="wrapper" type="VBoxContainer" parent="content/wrapper/container" index="0"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 10
alignment = 1
[node name="title1" type="Label" parent="content/wrapper/container/wrapper" index="0"]
unique_name_in_owner = true
layout_mode = 2
alignment = 1
size_flags_horizontal = 0
text = "在游戏开始前,你可以选择一项初始增益。"
[node name="initialFeedSelection" type="HBoxContainer" parent="content/wrapper/container/wrapper" index="1"]
unique_name_in_owner = true
layout_mode = 2
[node name="title2" type="Label" parent="content/wrapper/container/wrapper" index="2"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
text = "在游戏开始前,你可以选择一个初始武器。"
[node name="initialWeaponSelection" type="HBoxContainer" parent="content/wrapper/container/wrapper" index="3"]
unique_name_in_owner = true
layout_mode = 2
[node name="startBtn" type="Button" parent="content/wrapper" index="1"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
text = "开始游戏"
+30 -6
View File
@@ -2,15 +2,39 @@
extends FullscreenPanelBase
@onready var initialFeedSelection: HBoxContainer = $%initialFeedSelection
@onready var initialWeaponSelection: HBoxContainer = $%initialWeaponSelection
@onready var startBtn: Button = $%startBtn
@onready var title1: Label = $%title1
@onready var title2: Label = $%title2
func _ready():
startBtn.pressed.connect(func(): UIState.closeCurrentPanel())
func beforeOpen(_args: Array = []):
for feed in initialFeedSelection.get_children():
feed.queue_free()
clearFeeds()
clearWeapons()
ComponentManager.feeds.shuffle()
for feed in ComponentManager.feeds:
var card = feed.instantiate() as Feed
if card.topic == FeedName.Topic.WEAPON:
continue
card.freeToBuy = true
card.selected.connect(func(_success): UIState.closeCurrentPanel())
initialFeedSelection.add_child(card)
if card.topic == FeedName.Topic.WEAPON:
initialWeaponSelection.add_child(card)
card.selected.connect(
func(_x):
clearWeapons()
title2.hide()
)
else:
initialFeedSelection.add_child(card)
card.selected.connect(
func(_x):
clearFeeds()
title1.hide()
)
func clearFeeds():
for feed in initialFeedSelection.get_children():
feed.queue_free()
func clearWeapons():
for weapon in initialWeaponSelection.get_children():
weapon.queue_free()