From e53af2a1638fe8b25656bf220556682482eb841a 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: Mon, 4 May 2026 07:03:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=88=9D=E5=A7=8B=E9=80=89=E6=8B=A9):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=9D=E5=A7=8B=E5=A2=9E=E7=9B=8A=E5=92=8C?= =?UTF-8?q?=E6=AD=A6=E5=99=A8=E6=95=B0=E9=87=8F=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增OutGameStorage类存储最大初始数量配置 - 修改SelectInitialFeed面板逻辑以限制选择数量 - 优化FeedCardBase样式和布局 - 移除不必要的ScrollContainer简化UI结构 --- components/Abstracts/FeedCardBase.tscn | 53 ++++++++++--------- .../FullscreenPanels/SelectInitialFeed.tscn | 16 ++---- scripts/Contents/Panels/SelectIntialFeed.gd | 42 ++++++++------- scripts/Tools/OutGameStorage.gd | 4 ++ scripts/Tools/OutGameStorage.gd.uid | 1 + 5 files changed, 60 insertions(+), 56 deletions(-) create mode 100644 scripts/Tools/OutGameStorage.gd create mode 100644 scripts/Tools/OutGameStorage.gd.uid diff --git a/components/Abstracts/FeedCardBase.tscn b/components/Abstracts/FeedCardBase.tscn index 4521371..2549d55 100644 --- a/components/Abstracts/FeedCardBase.tscn +++ b/components/Abstracts/FeedCardBase.tscn @@ -1,47 +1,48 @@ -[gd_scene load_steps=5 format=3 uid="uid://bykwevnv7keeh"] +[gd_scene format=3 uid="uid://bykwevnv7keeh"] -[ext_resource type="Script" path="res://scripts/Structs/Feed.gd" id="1_2ea75"] +[ext_resource type="Script" uid="uid://nt81whieye7h" path="res://scripts/Structs/Feed.gd" id="1_2ea75"] [ext_resource type="Theme" uid="uid://dhvs6urgf6jr5" path="res://themes/main.tres" id="2_lvrpo"] [ext_resource type="PackedScene" uid="uid://bt370a1djjg5p" path="res://components/UI/FeedName.tscn" id="4_aewpy"] -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n2ewr"] -content_margin_left = 30.0 +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3g2k7"] +content_margin_left = 20.0 content_margin_top = 20.0 -content_margin_right = 30.0 +content_margin_right = 20.0 content_margin_bottom = 20.0 -bg_color = Color(0, 0, 0, 0.5) -border_width_left = 2 -border_width_top = 2 -border_width_right = 2 -border_width_bottom = 2 -border_color = Color(0, 0, 0, 0.75) -corner_radius_top_left = 5 -corner_radius_top_right = 5 -corner_radius_bottom_right = 5 -corner_radius_bottom_left = 5 +bg_color = Color(0, 0, 0, 0.70000005) +border_width_left = 10 +border_width_top = 10 +border_width_right = 10 +border_width_bottom = 10 +border_color = Color(1, 1, 1, 1) +border_blend = true +corner_radius_top_left = 15 +corner_radius_top_right = 15 +corner_radius_bottom_right = 15 +corner_radius_bottom_left = 15 +corner_detail = 1 -[node name="FeedCard" type="PanelContainer"] +[node name="FeedCard" type="PanelContainer" unique_id=1794851856] offset_right = 200.0 offset_bottom = 300.0 -theme_override_styles/panel = SubResource("StyleBoxFlat_n2ewr") +theme_override_styles/panel = SubResource("StyleBoxFlat_3g2k7") script = ExtResource("1_2ea75") -metadata/_edit_lock_ = true -[node name="container" type="VBoxContainer" parent="."] +[node name="container" type="VBoxContainer" parent="." unique_id=2054000756] layout_mode = 2 theme_override_constants/separation = 10 -[node name="selectBtn" type="Button" parent="container"] +[node name="selectBtn" type="Button" parent="container" unique_id=775671566] unique_name_in_owner = true layout_mode = 2 theme = ExtResource("2_lvrpo") text = "确定" -[node name="info" type="VBoxContainer" parent="container"] +[node name="info" type="VBoxContainer" parent="container" unique_id=1288419607] layout_mode = 2 theme_override_constants/separation = 10 -[node name="avatar" type="TextureRect" parent="container/info"] +[node name="avatar" type="TextureRect" parent="container/info" unique_id=239110315] unique_name_in_owner = true custom_minimum_size = Vector2(75, 75) layout_mode = 2 @@ -50,20 +51,20 @@ size_flags_vertical = 0 expand_mode = 1 stretch_mode = 5 -[node name="name" parent="container/info" instance=ExtResource("4_aewpy")] +[node name="name" parent="container/info" unique_id=1202819558 instance=ExtResource("4_aewpy")] unique_name_in_owner = true layout_mode = 2 quality = 1 -[node name="fields" type="VBoxContainer" parent="container"] +[node name="fields" type="VBoxContainer" parent="container" unique_id=54224040] unique_name_in_owner = true layout_mode = 2 -[node name="weapons" type="VBoxContainer" parent="container"] +[node name="weapons" type="VBoxContainer" parent="container" unique_id=2041301443] unique_name_in_owner = true layout_mode = 2 -[node name="costs" type="GridContainer" parent="container"] +[node name="costs" type="GridContainer" parent="container" unique_id=1806594453] unique_name_in_owner = true layout_mode = 2 size_flags_vertical = 10 diff --git a/components/Scenes/FullscreenPanels/SelectInitialFeed.tscn b/components/Scenes/FullscreenPanels/SelectInitialFeed.tscn index b384e73..1fa2d51 100644 --- a/components/Scenes/FullscreenPanels/SelectInitialFeed.tscn +++ b/components/Scenes/FullscreenPanels/SelectInitialFeed.tscn @@ -27,14 +27,10 @@ size_flags_horizontal = 4 text = "在游戏开始前,你可以选择一项初始增益。" label_settings = SubResource("LabelSettings_eugsq") -[node name="container" type="ScrollContainer" parent="content/wrapper/wrapper" index="1" unique_id=465067132] -layout_mode = 2 -follow_focus = true -vertical_scroll_mode = 0 - -[node name="initialFeedSelection" type="HBoxContainer" parent="content/wrapper/wrapper/container" index="0" unique_id=1363721283] +[node name="initialFeedSelection" type="HBoxContainer" parent="content/wrapper/wrapper" index="1" unique_id=1363721283] unique_name_in_owner = true layout_mode = 2 +alignment = 1 [node name="title2" type="Label" parent="content/wrapper/wrapper" index="2" unique_id=398646662] unique_name_in_owner = true @@ -43,14 +39,10 @@ size_flags_horizontal = 4 text = "在游戏开始前,你可以选择一个初始武器。" label_settings = SubResource("LabelSettings_eugsq") -[node name="container2" type="ScrollContainer" parent="content/wrapper/wrapper" index="3" unique_id=474299205] -layout_mode = 2 -follow_focus = true -vertical_scroll_mode = 0 - -[node name="initialWeaponSelection" type="HBoxContainer" parent="content/wrapper/wrapper/container2" index="0" unique_id=1933174501] +[node name="initialWeaponSelection" type="HBoxContainer" parent="content/wrapper/wrapper" index="3" unique_id=1933174501] unique_name_in_owner = true layout_mode = 2 +alignment = 1 [node name="startBtn" type="Button" parent="content/wrapper" index="1" unique_id=298849731] unique_name_in_owner = true diff --git a/scripts/Contents/Panels/SelectIntialFeed.gd b/scripts/Contents/Panels/SelectIntialFeed.gd index 3cf7703..d46fd5b 100644 --- a/scripts/Contents/Panels/SelectIntialFeed.gd +++ b/scripts/Contents/Panels/SelectIntialFeed.gd @@ -19,30 +19,36 @@ func _ready(): func beforeOpen(_args: Array = []): clearFeeds() clearWeapons() + var feedCounted = 0 + var weaponCounted = 0 ComponentManager.feeds.shuffle() for feed in ComponentManager.feeds: var card = feed.instantiate() as Feed card.freeToBuy = true if card.topic == FeedName.Topic.WEAPON: - initialWeaponSelection.add_child(card) - card.selected.connect( - func(_x): - if WorldManager.isRelease(): - clearWeapons() - title2.hide() - if !title1.visible: - startBtn.pressed.emit() - ) + if weaponCounted < OutGameStorage.maxInitialWeaponCount: + initialWeaponSelection.add_child(card) + card.selected.connect( + func(_x): + if WorldManager.isRelease(): + clearWeapons() + title2.hide() + if !title1.visible: + startBtn.pressed.emit() + ) + weaponCounted += 1 else: - initialFeedSelection.add_child(card) - card.selected.connect( - func(_x): - if WorldManager.isRelease(): - clearFeeds() - title1.hide() - if !title2.visible: - startBtn.pressed.emit() - ) + if feedCounted < OutGameStorage.maxInitialFeedCount: + initialFeedSelection.add_child(card) + card.selected.connect( + func(_x): + if WorldManager.isRelease(): + clearFeeds() + title1.hide() + if !title2.visible: + startBtn.pressed.emit() + ) + feedCounted += 1 func clearFeeds(): for feed in initialFeedSelection.get_children(): diff --git a/scripts/Tools/OutGameStorage.gd b/scripts/Tools/OutGameStorage.gd new file mode 100644 index 0000000..360d1f6 --- /dev/null +++ b/scripts/Tools/OutGameStorage.gd @@ -0,0 +1,4 @@ +class_name OutGameStorage + +static var maxInitialFeedCount: int = 3 +static var maxInitialWeaponCount: int = 3 diff --git a/scripts/Tools/OutGameStorage.gd.uid b/scripts/Tools/OutGameStorage.gd.uid new file mode 100644 index 0000000..2ea1c3b --- /dev/null +++ b/scripts/Tools/OutGameStorage.gd.uid @@ -0,0 +1 @@ +uid://dum6mef633vej