mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat: 添加角色选择系统及相关功能
新增角色卡片组件和角色选择逻辑 实现角色卡片动画效果和交互功能 添加初始角色数据配置 修改启动面板以支持角色选择 更新主题样式和UI布局
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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 = "微带苦杏仁气息的致命剧毒物质,静谧却暗藏致命威能。触碰即引凶险,微量便可颠覆生机,是隐忍又致命的诡秘造物。"
|
||||
@@ -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 = "栖于寒域密林,生性冷傲孤高。诡秘警觉过人,向来独来独往。身负隐秘过往,不问世俗纷争,只以孤影独行世间。"
|
||||
@@ -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 = "恪守守护之责,性情沉稳忠诚。常年驻守边境旷野,坚守一方安宁,甘愿以身挡险,永远守护同伴与故土,恪守使命不离不弃。"
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ class_name StarterPanel
|
||||
@onready var crystalShow: ItemShow = $%crystal
|
||||
@onready var diamondShow: ItemShow = $%diamond
|
||||
|
||||
@onready var charactersBox: Control = $%characters
|
||||
|
||||
@onready var startSingleplayerBtn: Button = $%startSingleplayerBtn
|
||||
@onready var startMultiplayerBtn: Button = $%startMultiplayerBtn
|
||||
@onready var levelShow: Label = $%levelShow
|
||||
@@ -27,9 +29,11 @@ class_name StarterPanel
|
||||
|
||||
var historyStack
|
||||
|
||||
static var GAMEMODE_MAP_WAVE = [Wave.WAVE_NORMAL, Wave.WAVE_BOSSRUSH, Wave.WAVE_MOWING]
|
||||
static var START_CHARACTERS = ["MuyangDog", "Lynx", "HCN"]
|
||||
static var buildingShader: bool = true
|
||||
static var selectingFeed: bool = true
|
||||
static var GAMEMODE_MAP_WAVE = [Wave.WAVE_NORMAL, Wave.WAVE_BOSSRUSH, Wave.WAVE_MOWING]
|
||||
static var selectedCharacter: String = START_CHARACTERS[1]
|
||||
|
||||
@rpc("any_peer")
|
||||
func mutexPlayer(player: String):
|
||||
@@ -159,6 +163,9 @@ func getPlayerNames() -> Array[String]:
|
||||
result.append(i.text)
|
||||
return result
|
||||
|
||||
func getCurrentSelectedCharacter() -> CharacterCard:
|
||||
return charactersBox.get_node(selectedCharacter as NodePath)
|
||||
|
||||
func beforeOpen(_args: Array = []):
|
||||
diffEdit.min_value = GameRule.difficultyRange.x
|
||||
diffEdit.max_value = GameRule.difficultyRange.y
|
||||
@@ -191,3 +198,15 @@ func rebuildInfo():
|
||||
rebuildInfo()
|
||||
)
|
||||
upgradeFieldsBox.add_child(fieldShow)
|
||||
for child in charactersBox.get_children():
|
||||
charactersBox.remove_child(child)
|
||||
for character in START_CHARACTERS:
|
||||
var card = ComponentManager.getCharacterCard(character).instantiate() as CharacterCard
|
||||
card.select.connect(
|
||||
func():
|
||||
if card.name == selectedCharacter: return
|
||||
getCurrentSelectedCharacter().animator.play("hide")
|
||||
selectedCharacter = card.name
|
||||
getCurrentSelectedCharacter().animator.play("show")
|
||||
)
|
||||
charactersBox.add_child(card)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class_name Watcher
|
||||
|
||||
signal changed()
|
||||
|
||||
var currentState = null
|
||||
|
||||
func _init(initialState):
|
||||
currentState = initialState
|
||||
|
||||
func setState(newState):
|
||||
if newState != currentState:
|
||||
currentState = newState
|
||||
changed.emit()
|
||||
@@ -0,0 +1 @@
|
||||
uid://7uhyhrta5ld1
|
||||
@@ -0,0 +1,54 @@
|
||||
@tool
|
||||
extends Control
|
||||
class_name CharacterCard
|
||||
|
||||
signal select()
|
||||
|
||||
@export var displayName: String = "Unknown Character"
|
||||
@export var avatar: Texture2D = null
|
||||
@export_multiline var description: String = ""
|
||||
@export var fields: Array[FieldStore.Entity] = []
|
||||
@export var fieldValues: Array[float] = []
|
||||
@export var clickToRebuild: bool = false
|
||||
@export var borderOpacity: float = 0
|
||||
|
||||
@onready var panel: PanelContainer = $%panel
|
||||
@onready var avatarTexture: TextureRect = $%avatarTexture
|
||||
@onready var nameLebel: Label = $%nameLabel
|
||||
@onready var descriptionLabel: Label = $%descriptionLabel
|
||||
@onready var fieldsBox: Control = $%fields
|
||||
@onready var animator: AnimationPlayer = $%animator
|
||||
|
||||
var watcher: Watcher = Watcher.new(false)
|
||||
@onready var panelStyleBox: StyleBoxFlat = panel.get_theme_stylebox("panel").duplicate()
|
||||
|
||||
func _ready():
|
||||
panel.add_theme_stylebox_override("panel", panelStyleBox)
|
||||
watcher.changed.connect(rebuildInfo)
|
||||
gui_input.connect(
|
||||
func(event):
|
||||
if event is InputEventMouseButton:
|
||||
if !(event.pressed && event.button_index == MouseButton.MOUSE_BUTTON_LEFT): return
|
||||
if animator.is_playing(): return
|
||||
select.emit()
|
||||
)
|
||||
rebuildInfo()
|
||||
func _process(_delta):
|
||||
watcher.setState(clickToRebuild)
|
||||
panelStyleBox.border_width_top = int(10 * borderOpacity)
|
||||
panelStyleBox.border_width_bottom = int(10 * borderOpacity)
|
||||
|
||||
func rebuildInfo():
|
||||
avatarTexture.texture = avatar
|
||||
nameLebel.text = displayName
|
||||
descriptionLabel.text = description
|
||||
for child in fieldsBox.get_children():
|
||||
fieldsBox.remove_child(child)
|
||||
for index in len(fields):
|
||||
var field = fields[index]
|
||||
var value = fieldValues[index]
|
||||
var fieldShow = ComponentManager.getUIComponent("FieldShow").instantiate() as FieldShow
|
||||
fieldShow.field = field
|
||||
fieldShow.showAdvantage = true
|
||||
fieldShow.value = value
|
||||
fieldsBox.add_child(fieldShow)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cd1xb8m6rvoph
|
||||
@@ -4,6 +4,7 @@ class_name ComponentManager
|
||||
|
||||
static var abstracts = {}
|
||||
static var bullets = {}
|
||||
static var characterCards = {}
|
||||
static var characters = {}
|
||||
static var weapons = {}
|
||||
static var summons = {}
|
||||
@@ -21,6 +22,8 @@ static func init():
|
||||
abstracts[DirTool.getBasenameWithoutExtension(i)] = load(i)
|
||||
for i in DirTool.listdir("res://components/Bullets"):
|
||||
bullets[DirTool.getBasenameWithoutExtension(i)] = load(i)
|
||||
for i in DirTool.listdir("res://components/CharacterCards"):
|
||||
characterCards[DirTool.getBasenameWithoutExtension(i)] = load(i)
|
||||
for i in DirTool.listdir("res://components/Characters"):
|
||||
characters[DirTool.getBasenameWithoutExtension(i)] = load(i)
|
||||
for i in DirTool.listdir("res://components/Weapons"):
|
||||
@@ -48,6 +51,8 @@ static func getAbstract(t: String) -> PackedScene:
|
||||
return MathTool.priority(abstracts.get(t, false), load("res://components/Abstracts/%s.tscn" % t))
|
||||
static func getBullet(t: String) -> PackedScene:
|
||||
return MathTool.priority(bullets.get(t, false), load("res://components/Bullets/%s.tscn" % t))
|
||||
static func getCharacterCard(t: String) -> PackedScene:
|
||||
return MathTool.priority(characterCards.get(t, false), load("res://components/CharacterCards/%s.tscn" % t))
|
||||
static func getCharacter(t: String) -> PackedScene:
|
||||
return MathTool.priority(characters.get(t, false), load("res://components/Characters/%s.tscn" % t))
|
||||
static func getWeapon(t: String) -> PackedScene:
|
||||
|
||||
+12
-2
@@ -10,8 +10,12 @@ content_margin_left = 20.0
|
||||
content_margin_top = 5.0
|
||||
content_margin_right = 20.0
|
||||
content_margin_bottom = 5.0
|
||||
bg_color = Color(0, 0, 0, 0.5)
|
||||
border_color = Color(1, 1, 1, 1)
|
||||
bg_color = Color(1, 0, 0, 0.2)
|
||||
border_width_left = 5
|
||||
border_width_top = 4
|
||||
border_width_right = 5
|
||||
border_width_bottom = 4
|
||||
border_color = Color(1, 0, 0, 1)
|
||||
border_blend = true
|
||||
corner_radius_top_left = 1000
|
||||
corner_radius_top_right = 1000
|
||||
@@ -129,6 +133,12 @@ corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[resource]
|
||||
Button/colors/font_color = Color(1, 1, 1, 1)
|
||||
Button/colors/font_disabled_color = Color(1, 1, 1, 1)
|
||||
Button/colors/font_focus_color = Color(0.95, 0.95, 0.95, 1)
|
||||
Button/colors/font_hover_color = Color(1, 1, 1, 1)
|
||||
Button/colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
||||
Button/colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
Button/font_sizes/font_size = 14
|
||||
Button/styles/disabled = SubResource("StyleBoxFlat_78ekx")
|
||||
Button/styles/hover = SubResource("StyleBoxFlat_1id7b")
|
||||
|
||||
Reference in New Issue
Block a user