From 82ae6b343a7434edc35f152d130381685a4a38b0 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: Sat, 31 Jan 2026 13:01:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=88=9D=E5=A7=8B=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF):=20=E6=B7=BB=E5=8A=A0=E6=AD=A6=E5=99=A8?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在初始选择面板中增加武器选择功能 - 添加开始游戏按钮 - 优化界面布局,将标题和选择项分组显示 - 实现选择后自动关闭对应选择区域的功能 --- .../FullscreenPanels/SelectInitialFeed.tscn | 38 +++++++++++++++---- scripts/Contents/Panels/SelectIntialFeed.gd | 36 +++++++++++++++--- 2 files changed, 60 insertions(+), 14 deletions(-) diff --git a/components/Scenes/FullscreenPanels/SelectInitialFeed.tscn b/components/Scenes/FullscreenPanels/SelectInitialFeed.tscn index 1f5b1d6..dd3a0ae 100644 --- a/components/Scenes/FullscreenPanels/SelectInitialFeed.tscn +++ b/components/Scenes/FullscreenPanels/SelectInitialFeed.tscn @@ -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 = "开始游戏" diff --git a/scripts/Contents/Panels/SelectIntialFeed.gd b/scripts/Contents/Panels/SelectIntialFeed.gd index 791f9ce..68b4076 100644 --- a/scripts/Contents/Panels/SelectIntialFeed.gd +++ b/scripts/Contents/Panels/SelectIntialFeed.gd @@ -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()