1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-08 20:57:13 +08:00

feat: 添加角色选择系统及相关功能

新增角色卡片组件和角色选择逻辑
实现角色卡片动画效果和交互功能
添加初始角色数据配置
修改启动面板以支持角色选择
更新主题样式和UI布局
This commit is contained in:
2026-05-04 19:52:04 +08:00
parent e8ee2932bb
commit 492373a48e
13 changed files with 415 additions and 46 deletions
+204 -18
View File
@@ -1,44 +1,230 @@
[gd_scene format=3 uid="uid://m8a4nay1pmmg"]
[ext_resource type="Texture2D" uid="uid://dwwpkn4q07ja2" path="res://icon.svg" id="1_5td0u"]
[ext_resource type="Script" uid="uid://cd1xb8m6rvoph" path="res://scripts/Structs/Character.gd" id="1_dt83t"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dt83t"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5td0u"]
content_margin_left = 20.0
content_margin_top = 20.0
content_margin_right = 20.0
content_margin_bottom = 20.0
bg_color = Color(0, 0, 0, 0.70000005)
border_width_top = 10
border_width_bottom = 10
border_color = Color(1, 1, 1, 1)
border_blend = true
corner_radius_top_left = 15
corner_radius_bottom_right = 15
corner_detail = 1
[node name="CharacterCardBase" type="Control" unique_id=2051062087]
layout_mode = 3
anchors_preset = 0
offset_right = 200.0
offset_bottom = 300.0
[sub_resource type="LabelSettings" id="LabelSettings_dt83t"]
font_size = 20
outline_size = 1
[sub_resource type="LabelSettings" id="LabelSettings_myhk0"]
font_size = 12
font_color = Color(0.5, 0.5, 0.5, 1)
[sub_resource type="Animation" id="Animation_dt83t"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0.7, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:scale:y")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0.7, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0.5)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath(".:borderOpacity")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_myhk0"]
resource_name = "hide"
length = 0.5
step = 0.1
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(1, 0, 0, 0, -0.3, 0.7, 0, 0, 0, 0),
"times": PackedFloat32Array(0, 0.5)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:scale:y")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(2, 0),
"points": PackedFloat32Array(1, 0, 0, 0, -0.3, 0.7, 0, 0, 0, 0),
"times": PackedFloat32Array(0, 0.5)
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0.5)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath(".:borderOpacity")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.0, 0.0]
}
[sub_resource type="Animation" id="Animation_fnmic"]
resource_name = "hide"
length = 0.5
step = 0.1
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(0.7, 0, 0, 0, 0.3, 1, 0, 0, 0, 0),
"times": PackedFloat32Array(0, 0.5)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:scale:y")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(0.7, 0, 0, 0, 0.3, 1, 0, 0, 0, 0),
"times": PackedFloat32Array(0, 0.5)
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0.5), Color(1, 1, 1, 1)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath(".:borderOpacity")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, 1.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_xuke2"]
_data = {
&"RESET": SubResource("Animation_dt83t"),
&"hide": SubResource("Animation_myhk0"),
&"show": SubResource("Animation_fnmic")
}
[node name="CharacterCardBase" type="CenterContainer" unique_id=282163900]
offset_right = 226.0
offset_bottom = 212.0
script = ExtResource("1_dt83t")
[node name="panel" type="PanelContainer" parent="." unique_id=1046363300]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_dt83t")
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0.5)
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_5td0u")
[node name="wrapper" type="VBoxContainer" parent="panel" unique_id=2023039659]
layout_mode = 2
theme_override_constants/separation = 10
[node name="TextureRect" type="TextureRect" parent="panel/wrapper" unique_id=1334645594]
[node name="avatarTexture" type="TextureRect" parent="panel/wrapper" unique_id=1334645594]
unique_name_in_owner = true
custom_minimum_size = Vector2(100, 100)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
texture = ExtResource("1_5td0u")
expand_mode = 1
stretch_mode = 5
[node name="infoContainer" type="VBoxContainer" parent="panel/wrapper" unique_id=143242635]
layout_mode = 2
[node name="nameLabel" type="Label" parent="panel/wrapper/infoContainer" unique_id=516147781]
unique_name_in_owner = true
layout_mode = 2
text = "Unknown Character"
label_settings = SubResource("LabelSettings_dt83t")
horizontal_alignment = 1
[node name="descriptionLabel" type="Label" parent="panel/wrapper/infoContainer" unique_id=808054282]
unique_name_in_owner = true
custom_minimum_size = Vector2(100, 10)
layout_mode = 2
label_settings = SubResource("LabelSettings_myhk0")
autowrap_mode = 3
[node name="fields" type="VBoxContainer" parent="panel/wrapper" unique_id=437152370]
unique_name_in_owner = true
layout_mode = 2
[node name="animator" type="AnimationPlayer" parent="panel" unique_id=1012843997]
unique_name_in_owner = true
libraries/ = SubResource("AnimationLibrary_xuke2")
+16
View File
@@ -0,0 +1,16 @@
[gd_scene format=3 uid="uid://dfww6e0mpyjk4"]
[ext_resource type="PackedScene" uid="uid://m8a4nay1pmmg" path="res://components/Abstracts/CharacterCardBase.tscn" id="1_robpf"]
[node name="HCN" unique_id=1046363300 instance=ExtResource("1_robpf")]
displayName = "氰化氢"
description = "苦杏仁气息的致命剧毒物质,暗藏致命威能。触碰即引凶险,微量便可颠覆生机,是隐忍又致命的诡秘造物。"
fields = Array[int]([18, 27])
fieldValues = Array[float]([5.0, 1.0])
clickToRebuild = true
[node name="nameLabel" parent="wrapper/infoContainer" parent_id_path=PackedInt32Array(143242635) index="0" unique_id=516147781]
text = "氰化氢"
[node name="descriptionLabel" parent="wrapper/infoContainer" parent_id_path=PackedInt32Array(143242635) index="1" unique_id=808054282]
text = "微带苦杏仁气息的致命剧毒物质,静谧却暗藏致命威能。触碰即引凶险,微量便可颠覆生机,是隐忍又致命的诡秘造物。"
+28
View File
@@ -0,0 +1,28 @@
[gd_scene format=3 uid="uid://cygvim0mv4ssa"]
[ext_resource type="PackedScene" uid="uid://m8a4nay1pmmg" path="res://components/Abstracts/CharacterCardBase.tscn" id="1_xa4jc"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xa4jc"]
content_margin_left = 20.0
content_margin_top = 20.0
content_margin_right = 20.0
content_margin_bottom = 20.0
bg_color = Color(0, 0, 0, 0.70000005)
border_color = Color(1, 1, 1, 1)
border_blend = true
corner_radius_top_left = 15
corner_radius_bottom_right = 15
corner_detail = 1
[node name="Lynx" unique_id=1046363300 instance=ExtResource("1_xa4jc")]
theme_override_styles/panel = SubResource("StyleBoxFlat_xa4jc")
displayName = "猞猁"
description = "栖于寒域密林,生性冷傲孤高。诡秘警觉过人,向来独来独往。身负隐秘过往,不问世俗纷争,只以孤影独行世间。"
fields = Array[int]([3, 4, 10])
fieldValues = Array[float]([0.15, 0.06, -0.25])
[node name="nameLabel" parent="wrapper/infoContainer" parent_id_path=PackedInt32Array(143242635) index="0" unique_id=516147781]
text = "猞猁"
[node name="descriptionLabel" parent="wrapper/infoContainer" parent_id_path=PackedInt32Array(143242635) index="1" unique_id=808054282]
text = "栖于寒域密林,生性冷傲孤高。诡秘警觉过人,向来独来独往。身负隐秘过往,不问世俗纷争,只以孤影独行世间。"
+27
View File
@@ -0,0 +1,27 @@
[gd_scene format=3 uid="uid://bglwhggnbxxax"]
[ext_resource type="PackedScene" uid="uid://m8a4nay1pmmg" path="res://components/Abstracts/CharacterCardBase.tscn" id="1_wq25g"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wq25g"]
content_margin_left = 20.0
content_margin_top = 20.0
content_margin_right = 20.0
content_margin_bottom = 20.0
bg_color = Color(0, 0, 0, 0.70000005)
border_blend = true
corner_radius_top_left = 15
corner_radius_bottom_right = 15
corner_detail = 1
[node name="MuyangDog" unique_id=1046363300 instance=ExtResource("1_wq25g")]
theme_override_styles/panel = SubResource("StyleBoxFlat_wq25g")
displayName = "牧羊犬"
description = "恪守守护之责,性情沉稳忠诚。常年驻守边境旷野,坚守一方安宁,甘愿以身挡险,永远守护同伴与故土,恪守使命不离不弃。"
fields = Array[int]([0, 8, 3])
fieldValues = Array[float]([50.0, 0.15, -0.2])
[node name="nameLabel" parent="wrapper/infoContainer" parent_id_path=PackedInt32Array(143242635) index="0" unique_id=516147781]
text = "牧羊犬"
[node name="descriptionLabel" parent="wrapper/infoContainer" parent_id_path=PackedInt32Array(143242635) index="1" unique_id=808054282]
text = "恪守守护之责,性情沉稳忠诚。常年驻守边境旷野,坚守一方安宁,甘愿以身挡险,永远守护同伴与故土,恪守使命不离不弃。"
+34 -25
View File
@@ -185,11 +185,19 @@ theme_override_styles/panel = ExtResource("7_kl3ko")
[node name="container" type="VBoxContainer" parent="content/wrapper/layout/outGameWrapper/layout/character" index="0" unique_id=1167478166]
layout_mode = 2
theme_override_constants/separation = 20
[node name="title" type="Label" parent="content/wrapper/layout/outGameWrapper/layout/character/container" index="0" unique_id=1287813603]
layout_mode = 2
text = "选择角色"
[node name="characters" type="HBoxContainer" parent="content/wrapper/layout/outGameWrapper/layout/character/container" index="1" unique_id=1098596848]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 10
alignment = 1
[node name="outGame" type="PanelContainer" parent="content/wrapper/layout/outGameWrapper/layout" index="1" unique_id=1923951688]
layout_mode = 2
theme_override_styles/panel = ExtResource("7_kl3ko")
@@ -282,27 +290,7 @@ popup/item_1/id = 1
popup/item_2/text = "割草"
popup/item_2/id = 2
[node name="player" type="HBoxContainer" parent="content/wrapper/layout/startGameWrapper/start/starter/singleplayer/playConfig" index="2" unique_id=656225175]
layout_mode = 2
[node name="tip" type="Label" parent="content/wrapper/layout/startGameWrapper/start/starter/singleplayer/playConfig/player" index="0" unique_id=1899542373]
layout_mode = 2
text = "角色名:"
[node name="playerNameInput" type="LineEdit" parent="content/wrapper/layout/startGameWrapper/start/starter/singleplayer/playConfig/player" index="1" unique_id=1401004968]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
theme = ExtResource("4_lfxcn")
text = "公鸡"
placeholder_text = "角色名"
alignment = 1
expand_to_text_length = true
select_all_on_focus = true
virtual_keyboard_type = 7
[node name="useTutorial" type="HBoxContainer" parent="content/wrapper/layout/startGameWrapper/start/starter/singleplayer/playConfig" index="3" unique_id=2079979053]
[node name="useTutorial" type="HBoxContainer" parent="content/wrapper/layout/startGameWrapper/start/starter/singleplayer/playConfig" index="2" unique_id=2079979053]
layout_mode = 2
[node name="tip" type="Label" parent="content/wrapper/layout/startGameWrapper/start/starter/singleplayer/playConfig/useTutorial" index="0" unique_id=20976924]
@@ -358,24 +346,45 @@ size_flags_horizontal = 4
text = "状态:未连接到服务器。"
label_settings = SubResource("LabelSettings_kl3ko")
[node name="host" type="HBoxContainer" parent="content/wrapper/layout/startGameWrapper/start/starter/multiplayer/main" index="2" unique_id=105458555]
[node name="player" type="HBoxContainer" parent="content/wrapper/layout/startGameWrapper/start/starter/multiplayer/main" index="2" unique_id=656225175]
layout_mode = 2
[node name="tip" type="Label" parent="content/wrapper/layout/startGameWrapper/start/starter/multiplayer/main/player" index="0" unique_id=1899542373]
layout_mode = 2
text = "角色名:"
label_settings = SubResource("LabelSettings_sdsu8")
[node name="playerNameInput" type="LineEdit" parent="content/wrapper/layout/startGameWrapper/start/starter/multiplayer/main/player" index="1" unique_id=1401004968]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
theme = ExtResource("4_lfxcn")
text = "公鸡"
placeholder_text = "角色名"
alignment = 1
expand_to_text_length = true
select_all_on_focus = true
virtual_keyboard_type = 7
[node name="host" type="HBoxContainer" parent="content/wrapper/layout/startGameWrapper/start/starter/multiplayer/main" index="3" unique_id=105458555]
layout_mode = 2
[node name="tip" type="Label" parent="content/wrapper/layout/startGameWrapper/start/starter/multiplayer/main/host" index="0" unique_id=871253279]
layout_mode = 2
text = "地址"
text = "服务器地址"
label_settings = SubResource("LabelSettings_sdsu8")
[node name="hostInput" type="LineEdit" parent="content/wrapper/layout/startGameWrapper/start/starter/multiplayer/main/host" index="1" unique_id=1534443919]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("4_lfxcn")
text = "127.0.0.1"
placeholder_text = "主机"
alignment = 2
expand_to_text_length = true
emoji_menu_enabled = false
clear_button_enabled = true
select_all_on_focus = true
virtual_keyboard_type = 7
@@ -394,7 +403,7 @@ emoji_menu_enabled = false
select_all_on_focus = true
virtual_keyboard_type = 2
[node name="operation" type="HBoxContainer" parent="content/wrapper/layout/startGameWrapper/start/starter/multiplayer/main" index="3" unique_id=720531196]
[node name="operation" type="HBoxContainer" parent="content/wrapper/layout/startGameWrapper/start/starter/multiplayer/main" index="4" unique_id=720531196]
layout_mode = 2
alignment = 1