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

feat(初始选择): 添加初始增益和武器数量限制

- 新增OutGameStorage类存储最大初始数量配置
- 修改SelectInitialFeed面板逻辑以限制选择数量
- 优化FeedCardBase样式和布局
- 移除不必要的ScrollContainer简化UI结构
This commit is contained in:
2026-05-04 07:03:18 +08:00
parent 0eabde6852
commit e53af2a163
5 changed files with 60 additions and 56 deletions
+27 -26
View File
@@ -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="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"] [ext_resource type="PackedScene" uid="uid://bt370a1djjg5p" path="res://components/UI/FeedName.tscn" id="4_aewpy"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n2ewr"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3g2k7"]
content_margin_left = 30.0 content_margin_left = 20.0
content_margin_top = 20.0 content_margin_top = 20.0
content_margin_right = 30.0 content_margin_right = 20.0
content_margin_bottom = 20.0 content_margin_bottom = 20.0
bg_color = Color(0, 0, 0, 0.5) bg_color = Color(0, 0, 0, 0.70000005)
border_width_left = 2 border_width_left = 10
border_width_top = 2 border_width_top = 10
border_width_right = 2 border_width_right = 10
border_width_bottom = 2 border_width_bottom = 10
border_color = Color(0, 0, 0, 0.75) border_color = Color(1, 1, 1, 1)
corner_radius_top_left = 5 border_blend = true
corner_radius_top_right = 5 corner_radius_top_left = 15
corner_radius_bottom_right = 5 corner_radius_top_right = 15
corner_radius_bottom_left = 5 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_right = 200.0
offset_bottom = 300.0 offset_bottom = 300.0
theme_override_styles/panel = SubResource("StyleBoxFlat_n2ewr") theme_override_styles/panel = SubResource("StyleBoxFlat_3g2k7")
script = ExtResource("1_2ea75") 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 layout_mode = 2
theme_override_constants/separation = 10 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 unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
theme = ExtResource("2_lvrpo") theme = ExtResource("2_lvrpo")
text = "确定" text = "确定"
[node name="info" type="VBoxContainer" parent="container"] [node name="info" type="VBoxContainer" parent="container" unique_id=1288419607]
layout_mode = 2 layout_mode = 2
theme_override_constants/separation = 10 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 unique_name_in_owner = true
custom_minimum_size = Vector2(75, 75) custom_minimum_size = Vector2(75, 75)
layout_mode = 2 layout_mode = 2
@@ -50,20 +51,20 @@ size_flags_vertical = 0
expand_mode = 1 expand_mode = 1
stretch_mode = 5 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 unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
quality = 1 quality = 1
[node name="fields" type="VBoxContainer" parent="container"] [node name="fields" type="VBoxContainer" parent="container" unique_id=54224040]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 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 unique_name_in_owner = true
layout_mode = 2 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 unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_vertical = 10 size_flags_vertical = 10
@@ -27,14 +27,10 @@ size_flags_horizontal = 4
text = "在游戏开始前,你可以选择一项初始增益。" text = "在游戏开始前,你可以选择一项初始增益。"
label_settings = SubResource("LabelSettings_eugsq") label_settings = SubResource("LabelSettings_eugsq")
[node name="container" type="ScrollContainer" parent="content/wrapper/wrapper" index="1" unique_id=465067132] [node name="initialFeedSelection" type="HBoxContainer" parent="content/wrapper/wrapper" index="1" unique_id=1363721283]
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]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
alignment = 1
[node name="title2" type="Label" parent="content/wrapper/wrapper" index="2" unique_id=398646662] [node name="title2" type="Label" parent="content/wrapper/wrapper" index="2" unique_id=398646662]
unique_name_in_owner = true unique_name_in_owner = true
@@ -43,14 +39,10 @@ size_flags_horizontal = 4
text = "在游戏开始前,你可以选择一个初始武器。" text = "在游戏开始前,你可以选择一个初始武器。"
label_settings = SubResource("LabelSettings_eugsq") label_settings = SubResource("LabelSettings_eugsq")
[node name="container2" type="ScrollContainer" parent="content/wrapper/wrapper" index="3" unique_id=474299205] [node name="initialWeaponSelection" type="HBoxContainer" parent="content/wrapper/wrapper" index="3" unique_id=1933174501]
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]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
alignment = 1
[node name="startBtn" type="Button" parent="content/wrapper" index="1" unique_id=298849731] [node name="startBtn" type="Button" parent="content/wrapper" index="1" unique_id=298849731]
unique_name_in_owner = true unique_name_in_owner = true
+24 -18
View File
@@ -19,30 +19,36 @@ func _ready():
func beforeOpen(_args: Array = []): func beforeOpen(_args: Array = []):
clearFeeds() clearFeeds()
clearWeapons() clearWeapons()
var feedCounted = 0
var weaponCounted = 0
ComponentManager.feeds.shuffle() ComponentManager.feeds.shuffle()
for feed in ComponentManager.feeds: for feed in ComponentManager.feeds:
var card = feed.instantiate() as Feed var card = feed.instantiate() as Feed
card.freeToBuy = true card.freeToBuy = true
if card.topic == FeedName.Topic.WEAPON: if card.topic == FeedName.Topic.WEAPON:
initialWeaponSelection.add_child(card) if weaponCounted < OutGameStorage.maxInitialWeaponCount:
card.selected.connect( initialWeaponSelection.add_child(card)
func(_x): card.selected.connect(
if WorldManager.isRelease(): func(_x):
clearWeapons() if WorldManager.isRelease():
title2.hide() clearWeapons()
if !title1.visible: title2.hide()
startBtn.pressed.emit() if !title1.visible:
) startBtn.pressed.emit()
)
weaponCounted += 1
else: else:
initialFeedSelection.add_child(card) if feedCounted < OutGameStorage.maxInitialFeedCount:
card.selected.connect( initialFeedSelection.add_child(card)
func(_x): card.selected.connect(
if WorldManager.isRelease(): func(_x):
clearFeeds() if WorldManager.isRelease():
title1.hide() clearFeeds()
if !title2.visible: title1.hide()
startBtn.pressed.emit() if !title2.visible:
) startBtn.pressed.emit()
)
feedCounted += 1
func clearFeeds(): func clearFeeds():
for feed in initialFeedSelection.get_children(): for feed in initialFeedSelection.get_children():
+4
View File
@@ -0,0 +1,4 @@
class_name OutGameStorage
static var maxInitialFeedCount: int = 3
static var maxInitialWeaponCount: int = 3
+1
View File
@@ -0,0 +1 @@
uid://dum6mef633vej