1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-27 14:02:29 +08:00

Compare commits

...

8 Commits

Author SHA1 Message Date
fallingshrimp edc31d876e fix(MuyangDog): 修复格挡计数器逻辑错误
将parryCounter.start()判断改为parryCounter.isCooldowned(),并在成功格挡后启动计数器
2026-05-04 22:07:03 +08:00
fallingshrimp b5c2152d4c fix(EntityBase): 限制能量值不超过最大值
style(Starter): 更新游戏模式选项文本描述
2026-05-04 21:56:37 +08:00
fallingshrimp 8137b398a9 fix(Feed): 修复字段应用逻辑并确保数值范围正确
调整字段值应用顺序,先增加值再检查applier回调。如果applier存在且返回true,则减去之前增加的值。最后确保所有字段值在有效范围内。
2026-05-04 21:52:04 +08:00
fallingshrimp 5c85b4c10c refactor(角色): 修改HCN技能效果为储能并随机选择初始角色
将HCN的召唤物死亡效果从恢复生命值改为储能10点
修改初始角色选择逻辑为随机选择
更新角色卡牌描述以匹配新技能效果
2026-05-04 21:45:21 +08:00
fallingshrimp fac8d82157 fix(角色平衡): 调整牧羊犬格挡冷却时间和治疗量
将牧羊犬的格挡冷却时间从5秒减少到3秒
将HCN的治疗量从3点提升到5点
移除牧羊犬卡片的clickToRebuild属性
2026-05-04 21:39:56 +08:00
fallingshrimp dc4b080a09 feat: 新增角色系统及基础功能实现
新增HCN、Lynx和MuyangDog三个可玩角色及其相关资源
实现角色选择界面和角色属性系统
重构玩家生成逻辑以支持角色选择
优化角色卡片UI显示效果
2026-05-04 21:34:57 +08:00
fallingshrimp 4d1f68cac1 feat(角色卡片): 添加新角色卡片资源并优化显示逻辑
添加猞猁、牧羊犬和氰化氢的角色卡片资源
优化卡片选中状态的动画显示逻辑
调整卡片样式和主题配置
移除冗余的panel节点引用
2026-05-04 20:32:07 +08:00
fallingshrimp 492373a48e feat: 添加角色选择系统及相关功能
新增角色卡片组件和角色选择逻辑
实现角色卡片动画效果和交互功能
添加初始角色数据配置
修改启动面板以支持角色选择
更新主题样式和UI布局
2026-05-04 19:52:04 +08:00
35 changed files with 911 additions and 69 deletions
+225 -19
View File
@@ -1,44 +1,250 @@
[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"]
[ext_resource type="Texture2D" uid="uid://dwwpkn4q07ja2" path="res://icon.svg" id="2_dt83t"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dt83t"]
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
bg_color = Color(0, 0, 0, 0.8)
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
[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
[sub_resource type="LabelSettings" id="LabelSettings_fnmic"]
font_size = 12
font_color = Color(1, 1, 1, 0.39215687)
[sub_resource type="LabelSettings" id="LabelSettings_myhk0"]
font_size = 12
[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.85, -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.85, -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.85, 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.85, 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.85, 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.85, 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="panel" type="PanelContainer" unique_id=1046363300]
modulate = Color(1, 1, 1, 0.5)
offset_right = 226.0
offset_bottom = 212.0
scale = Vector2(0.85, 0.85)
theme_override_styles/panel = SubResource("StyleBoxFlat_dt83t")
script = ExtResource("1_dt83t")
avatar = ExtResource("2_dt83t")
description = "这是一个描述,"
fields = Array[int]([0])
fieldValues = Array[float]([0.0])
[node name="wrapper" type="VBoxContainer" parent="panel" unique_id=2023039659]
[node name="wrapper" type="VBoxContainer" parent="." 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="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")
texture = ExtResource("2_dt83t")
expand_mode = 1
stretch_mode = 5
[node name="infoContainer" type="VBoxContainer" parent="wrapper" unique_id=143242635]
layout_mode = 2
theme_override_constants/separation = 10
[node name="VBoxContainer" type="VBoxContainer" parent="wrapper/infoContainer" unique_id=533915880]
layout_mode = 2
theme_override_constants/separation = 0
[node name="nameLabel" type="Label" parent="wrapper/infoContainer/VBoxContainer" unique_id=516147781]
unique_name_in_owner = true
layout_mode = 2
text = "Unknown Character"
label_settings = SubResource("LabelSettings_dt83t")
horizontal_alignment = 1
[node name="sloganLabel" type="Label" parent="wrapper/infoContainer/VBoxContainer" unique_id=280562204]
unique_name_in_owner = true
layout_mode = 2
text = "“Slogan”"
label_settings = SubResource("LabelSettings_fnmic")
horizontal_alignment = 1
[node name="descriptionLabel" type="Label" parent="wrapper/infoContainer" unique_id=808054282]
unique_name_in_owner = true
custom_minimum_size = Vector2(100, 10)
layout_mode = 2
text = "这是一个描述,"
label_settings = SubResource("LabelSettings_myhk0")
horizontal_alignment = 1
autowrap_mode = 3
[node name="fields" type="VBoxContainer" parent="wrapper" unique_id=437152370]
unique_name_in_owner = true
layout_mode = 2
[node name="animator" type="AnimationPlayer" parent="." unique_id=1012843997]
unique_name_in_owner = true
libraries/ = SubResource("AnimationLibrary_xuke2")
+129
View File
@@ -0,0 +1,129 @@
[gd_scene format=3 uid="uid://bs863g2s8r770"]
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_6i3xq"]
[ext_resource type="Script" uid="uid://r5gm7rcya35p" path="res://scripts/Contents/Characters/PlayerBase.gd" id="2_t2kq6"]
[ext_resource type="AudioStream" uid="uid://cdrevrq7n6yqa" path="res://resources/sounds/effect/Boing.mp3" id="3_lv2jw"]
[ext_resource type="AudioStream" uid="uid://benyec5bqni0b" path="res://resources/sounds/effect/Chomp.wav" id="4_7bgj3"]
[ext_resource type="AudioStream" uid="uid://dmxh3bpk8vyy5" path="res://resources/sounds/effect/Coin.mp3" id="5_na3ea"]
[ext_resource type="AudioStream" uid="uid://4wuuf1osk0yv" path="res://resources/sounds/effect/Low Boing.wav" id="6_0o8ke"]
[ext_resource type="Texture2D" uid="uid://dwwpkn4q07ja2" path="res://icon.svg" id="7_kwh6m"]
[sub_resource type="Curve" id="Curve_da2ca"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_0omr3"]
curve = SubResource("Curve_da2ca")
[sub_resource type="Curve" id="Curve_joj4g"]
_limits = [-360.0, 1.0, 0.0, 1.0]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, -360), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_jluqw"]
curve = SubResource("Curve_joj4g")
[sub_resource type="Curve" id="Curve_0omr3"]
_data = [Vector2(0.5, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_joj4g"]
curve = SubResource("Curve_0omr3")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_joj4g"]
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 300.0
angle_min = 1.0728835e-05
angle_max = 360.00003
angle_curve = SubResource("CurveTexture_jluqw")
gravity = Vector3(0, 0, 0)
radial_accel_min = -200.0
radial_accel_max = -200.0
scale_min = 5.0
scale_max = 10.0
scale_curve = SubResource("CurveTexture_joj4g")
alpha_curve = SubResource("CurveTexture_0omr3")
[sub_resource type="SpriteFrames" id="SpriteFrames_4v2ol"]
animations = [{
"frames": [],
"loop": true,
"name": &"idle",
"speed": 1.0
}, {
"frames": [],
"loop": true,
"name": &"walk",
"speed": 3.0
}]
[sub_resource type="SpriteFrames" id="SpriteFrames_jluqw"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("7_kwh6m")
}],
"loop": true,
"name": &"idle",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("7_kwh6m")
}],
"loop": true,
"name": &"walk",
"speed": 5.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_h1v0q"]
radius = 61.204575
[node name="PlayerBase" unique_id=1711205167 instance=ExtResource("1_6i3xq")]
script = ExtResource("2_t2kq6")
displayName = "玩家实体"
metadata/_edit_horizontal_guides_ = [-188.0]
metadata/_edit_vertical_guides_ = [71.0]
[node name="chargeParticle" type="GPUParticles2D" parent="." index="0" unique_id=1592717470]
unique_name_in_owner = true
position = Vector2(0, -54)
amount = 100
process_material = SubResource("ParticleProcessMaterial_joj4g")
[node name="weaponStore" parent="." index="2"]
process_mode = 4
[node name="sprint" parent="sounds" index="0"]
stream = ExtResource("3_lv2jw")
[node name="heal" parent="sounds" index="1"]
stream = ExtResource("4_7bgj3")
[node name="miss" parent="sounds" index="2"]
stream = ExtResource("5_na3ea")
[node name="hurt" parent="sounds" index="3"]
stream = ExtResource("6_0o8ke")
[node name="texture" parent="." index="4"]
position = Vector2(0, -47)
sprite_frames = SubResource("SpriteFrames_4v2ol")
animation = &"walk"
[node name="staticAnimation" parent="texture" index="1"]
position = Vector2(0, -17)
sprite_frames = SubResource("SpriteFrames_jluqw")
animation = &"walk"
[node name="hitbox" parent="texture/hurtbox" index="0"]
position = Vector2(-2, -18)
shape = SubResource("CircleShape2D_h1v0q")
[node name="normal" type="Node2D" parent="texture/weapons" index="0" unique_id=1939030218]
position = Vector2(1, -13)
[node name="statebar" parent="." index="5" node_paths=PackedStringArray("entity")]
position = Vector2(0, -150)
entity = NodePath("..")
+38
View File
@@ -0,0 +1,38 @@
[gd_scene format=3 uid="uid://dfww6e0mpyjk4"]
[ext_resource type="PackedScene" uid="uid://m8a4nay1pmmg" path="res://components/Abstracts/CharacterCardBase.tscn" id="1_robpf"]
[ext_resource type="Texture2D" uid="uid://2xmrkvyrcqq1" path="res://resources/characterCards/hcn.png" id="2_1yfsg"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1yfsg"]
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.8)
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="HCN" unique_id=1046363300 instance=ExtResource("1_robpf")]
theme_override_styles/panel = SubResource("StyleBoxFlat_1yfsg")
displayName = "氰化氢"
slogan = "微量便可颠覆生机"
avatar = ExtResource("2_1yfsg")
description = "在召唤物死亡时储能。"
fields = Array[int]([18, 27])
fieldValues = Array[float]([5.0, 1.0])
clickToRebuild = true
[node name="avatarTexture" parent="wrapper" parent_id_path=PackedInt32Array(2023039659) index="0" unique_id=1334645594]
texture = ExtResource("2_1yfsg")
[node name="nameLabel" parent="wrapper/infoContainer/VBoxContainer" parent_id_path=PackedInt32Array(533915880) index="0" unique_id=516147781]
text = "氰化氢"
[node name="sloganLabel" parent="wrapper/infoContainer/VBoxContainer" parent_id_path=PackedInt32Array(533915880) index="1" unique_id=280562204]
text = "“微量便可颠覆生机”"
[node name="descriptionLabel" parent="wrapper/infoContainer" parent_id_path=PackedInt32Array(143242635) index="1" unique_id=808054282]
text = "召唤物死亡时为自身恢复生命值。"
+38
View File
@@ -0,0 +1,38 @@
[gd_scene format=3 uid="uid://cygvim0mv4ssa"]
[ext_resource type="PackedScene" uid="uid://m8a4nay1pmmg" path="res://components/Abstracts/CharacterCardBase.tscn" id="1_xa4jc"]
[ext_resource type="Texture2D" uid="uid://b1ogllqvamcun" path="res://resources/characterCards/lynx.png" id="2_1s675"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1s675"]
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_1s675")
displayName = "猞猁"
slogan = "栖于寒域密林,孤影独行世间"
avatar = ExtResource("2_1s675")
description = "拥有更大的冲刺速度。"
fields = Array[int]([3, 4, 10])
fieldValues = Array[float]([0.15, 0.04, -0.3])
clickToRebuild = true
[node name="avatarTexture" parent="wrapper" parent_id_path=PackedInt32Array(2023039659) index="0" unique_id=1334645594]
texture = ExtResource("2_1s675")
[node name="nameLabel" parent="wrapper/infoContainer/VBoxContainer" parent_id_path=PackedInt32Array(533915880) index="0" unique_id=516147781]
text = "猞猁"
[node name="sloganLabel" parent="wrapper/infoContainer/VBoxContainer" parent_id_path=PackedInt32Array(533915880) index="1" unique_id=280562204]
text = "“栖于寒域密林,孤影独行世间”"
[node name="descriptionLabel" parent="wrapper/infoContainer" parent_id_path=PackedInt32Array(143242635) index="1" unique_id=808054282]
text = "拥有更大的冲刺速度。"
+36
View File
@@ -0,0 +1,36 @@
[gd_scene format=3 uid="uid://bglwhggnbxxax"]
[ext_resource type="PackedScene" uid="uid://m8a4nay1pmmg" path="res://components/Abstracts/CharacterCardBase.tscn" id="1_wq25g"]
[ext_resource type="Texture2D" uid="uid://dhu4i24hfhxvn" path="res://resources/characterCards/muyang-dog.png" id="2_fi2nw"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fi2nw"]
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_fi2nw")
displayName = "牧羊犬"
slogan = "以身挡险,恪守使命不离不弃"
avatar = ExtResource("2_fi2nw")
description = "每3秒发动格挡,弹反一切子弹。"
fields = Array[int]([0, 8, 3])
fieldValues = Array[float]([50.0, 0.15, -0.2])
[node name="avatarTexture" parent="wrapper" parent_id_path=PackedInt32Array(2023039659) index="0" unique_id=1334645594]
texture = ExtResource("2_fi2nw")
[node name="nameLabel" parent="wrapper/infoContainer/VBoxContainer" parent_id_path=PackedInt32Array(533915880) index="0" unique_id=516147781]
text = "牧羊犬"
[node name="sloganLabel" parent="wrapper/infoContainer/VBoxContainer" parent_id_path=PackedInt32Array(533915880) index="1" unique_id=280562204]
text = "“以身挡险,恪守使命不离不弃”"
[node name="descriptionLabel" parent="wrapper/infoContainer" parent_id_path=PackedInt32Array(143242635) index="1" unique_id=808054282]
text = "每3秒发动格挡,弹反一切子弹。"
+8
View File
@@ -0,0 +1,8 @@
[gd_scene format=3 uid="uid://bes88ipm71b75"]
[ext_resource type="PackedScene" uid="uid://bs863g2s8r770" path="res://components/Abstracts/PlayerBase.tscn" id="1_eeneu"]
[ext_resource type="Script" uid="uid://bevc4f6apql4t" path="res://scripts/Contents/Characters/HCN.gd" id="2_f7uj3"]
[node name="HCN" unique_id=1711205167 instance=ExtResource("1_eeneu")]
script = ExtResource("2_f7uj3")
displayName = "氰化氢"
+8
View File
@@ -0,0 +1,8 @@
[gd_scene format=3 uid="uid://ben3wi047p3hj"]
[ext_resource type="PackedScene" uid="uid://bs863g2s8r770" path="res://components/Abstracts/PlayerBase.tscn" id="1_ns0m5"]
[ext_resource type="Script" uid="uid://b8g0hkqvyeptg" path="res://scripts/Contents/Characters/Lynx.gd" id="2_d6nve"]
[node name="Lynx" unique_id=1711205167 instance=ExtResource("1_ns0m5")]
script = ExtResource("2_d6nve")
displayName = "猞猁"
+8
View File
@@ -0,0 +1,8 @@
[gd_scene format=3 uid="uid://c7xe5swtkyhbg"]
[ext_resource type="PackedScene" uid="uid://bs863g2s8r770" path="res://components/Abstracts/PlayerBase.tscn" id="1_y3l4w"]
[ext_resource type="Script" uid="uid://bbmb572iba42l" path="res://scripts/Contents/Characters/MuyangDog.gd" id="2_mr6nm"]
[node name="MuyangDog" unique_id=1711205167 instance=ExtResource("1_y3l4w")]
script = ExtResource("2_mr6nm")
displayName = "牧羊犬"
-4
View File
@@ -2,7 +2,6 @@
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_e5pl8"]
[ext_resource type="Script" uid="uid://cthtupc6dtbav" path="res://scripts/Contents/Characters/Rooster.gd" id="2_oqdqd"]
[ext_resource type="PackedScene" uid="uid://dlaks67h2osms" path="res://components/Weapons/ChainGun.tscn" id="3_s7kxe"]
[ext_resource type="AudioStream" uid="uid://cdrevrq7n6yqa" path="res://resources/sounds/effect/Boing.mp3" id="4_66s6c"]
[ext_resource type="AudioStream" uid="uid://benyec5bqni0b" path="res://resources/sounds/effect/Chomp.wav" id="4_k0yme"]
[ext_resource type="AudioStream" uid="uid://dmxh3bpk8vyy5" path="res://resources/sounds/effect/Coin.mp3" id="5_xnbhq"]
@@ -97,9 +96,6 @@ process_material = SubResource("ParticleProcessMaterial_joj4g")
[node name="weaponStore" parent="." index="2"]
process_mode = 4
[node name="ChainGun" parent="weaponStore" index="0" unique_id=1992324853 instance=ExtResource("3_s7kxe")]
debugRebuild = false
[node name="sprint" parent="sounds" index="0"]
stream = ExtResource("4_66s6c")
+53 -28
View File
@@ -16,6 +16,22 @@ shader_parameter/prog = 0.5000000074506
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4ekdw"]
content_margin_left = 60.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4ekdw"]
content_margin_left = 30.0
content_margin_top = 30.0
content_margin_right = 30.0
content_margin_bottom = 30.0
bg_color = Color(0, 0, 0, 0.70000005)
border_width_left = 10
border_width_right = 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
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_sdsu8"]
content_margin_right = 60.0
@@ -181,15 +197,23 @@ theme_override_constants/separation = 30
[node name="character" type="PanelContainer" parent="content/wrapper/layout/outGameWrapper/layout" index="0" unique_id=1828402109]
layout_mode = 2
theme_override_styles/panel = ExtResource("7_kl3ko")
theme_override_styles/panel = SubResource("StyleBoxFlat_4ekdw")
[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")
@@ -275,34 +299,14 @@ theme = ExtResource("4_lfxcn")
selected = 0
allow_reselect = true
item_count = 3
popup/item_0/text = "无尽波次"
popup/item_0/text = "无尽波次·标准游戏体验"
popup/item_0/id = 0
popup/item_1/text = "Boss Rush"
popup/item_1/id = 1
popup/item_2/text = "割草"
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 +362,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 +419,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
Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

+40
View File
@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://2xmrkvyrcqq1"
path="res://.godot/imported/hcn.png-c27fe878ce57f16ec0714a09f8662903.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resources/characterCards/hcn.png"
dest_files=["res://.godot/imported/hcn.png-c27fe878ce57f16ec0714a09f8662903.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

+40
View File
@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b1ogllqvamcun"
path="res://.godot/imported/lynx.png-0ad864fef53fe9b6c7e72f50bca44f0a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resources/characterCards/lynx.png"
dest_files=["res://.godot/imported/lynx.png-0ad864fef53fe9b6c7e72f50bca44f0a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dhu4i24hfhxvn"
path="res://.godot/imported/muyang-dog.png-faa1da78f374818f4f65cd75128b936f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resources/characterCards/muyang-dog.png"
dest_files=["res://.godot/imported/muyang-dog.png-faa1da78f374818f4f65cd75128b936f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
+4
View File
@@ -0,0 +1,4 @@
extends PlayerBase
func summoned(entity: SummonBase):
entity.died.connect(func(): storeEnergy(10))
+1
View File
@@ -0,0 +1 @@
uid://bevc4f6apql4t
+5
View File
@@ -0,0 +1,5 @@
extends PlayerBase
func register():
super.register()
sprintMultiplier += 3
+1
View File
@@ -0,0 +1 @@
uid://b8g0hkqvyeptg
+12
View File
@@ -0,0 +1,12 @@
extends PlayerBase
var parryCounter: CooldownTimer = CooldownTimer.new(3000)
func ai():
super.ai()
if parryCounter.isCooldowned():
var track = getTrackingAnchor()
var bullet = BulletTool.findClosetBulletCanDamage(track, get_tree(), self , 400)
if is_instance_valid(bullet):
BulletBase.generate(ComponentManager.getBullet("Parrier"), self , track, track.angle_to_point(bullet.position))
parryCounter.start()
@@ -0,0 +1 @@
uid://bbmb572iba42l
+80
View File
@@ -0,0 +1,80 @@
extends EntityBase
class_name PlayerBase
var chargeStartTime = {}
@onready var chargeParticle: GPUParticles2D = $%chargeParticle
func register():
attackCooldownMap[0] = 200
attackCooldownMap[1] = 6000
hit.connect(
func(_damage: float, bullet: BulletBase, _crit: bool):
if bullet is DogCircle:
EffectController.create(ComponentManager.getEffect("FeatherFall"), texture.global_position).shot()
elif bullet is FoxZhua:
EffectController.create(ComponentManager.getEffect("BloodFall"), texture.global_position).shot()
)
chargeParticle.emitting = false
func ai():
currentFocusedPosition = get_global_mouse_position()
texture.play("walk")
var direction = Vector2(
Input.get_axis("m_left", "m_right"),
Input.get_axis("m_up", "m_down")
)
move(direction)
if direction.length() == 0:
texture.play("idle")
tryLaunch("attack", 0)
tryLaunch("attack2", 1)
tryLaunch("smallSkill", 2)
tryLaunch("superSkill", 3)
for i in range(3):
tryLaunch("cardSkill%d" % i, 4 + i)
if Input.is_action_just_pressed("sprint"):
trySprint()
if Input.is_action_just_pressed("heal"):
if health < fields.get(FieldStore.Entity.MAX_HEALTH):
if useItem({
ItemStore.ItemType.APPLE: 1
}):
tryHeal(20)
func sprint():
move(Vector2(
Input.get_axis("m_left", "m_right"),
Input.get_axis("m_up", "m_down")
) * sprintMultiplier, true)
func tryLaunch(action: String, weaponIndex: int):
if Input.is_action_just_pressed(action):
if len(weapons) > weaponIndex:
var weapon = weapons[weaponIndex]
if weapon.emitType == Weapon.EmitType.CHARGE:
if weapon.canAttackBy(self ):
chargeStartTime[weaponIndex] = Time.get_ticks_msec()
chargeParticle.emitting = true
chargeParticle.speed_scale = 1
elif weapon.emitType == Weapon.EmitType.CLICK_SHOOT || weapon.emitType == Weapon.EmitType.HOLD_LOOP:
tryAttack(weaponIndex)
if Input.is_action_pressed(action):
if len(weapons) > weaponIndex:
var weapon = weapons[weaponIndex]
if chargeStartTime.has(weaponIndex):
chargeParticle.speed_scale += 0.01 * self.fields.get(FieldStore.Entity.CHARGE_SPEED)
elif weapon.emitType == Weapon.EmitType.HOLD_SHOOT || weapon.emitType == Weapon.EmitType.HOLD_LOOP:
tryAttack(weaponIndex)
if Input.is_action_just_released(action):
if len(weapons) > weaponIndex:
var weapon = weapons[weaponIndex]
if weapon.emitType == Weapon.EmitType.CHARGE:
if chargeStartTime.has(weaponIndex):
var startTime = chargeStartTime[weaponIndex]
var endTime = Time.get_ticks_msec()
var chargedTime = endTime - startTime
chargeStartTime.erase(weaponIndex)
weapon.chargedTime = chargedTime * self.fields.get(FieldStore.Entity.CHARGE_SPEED)
tryAttack(weaponIndex)
chargeParticle.emitting = false
elif weapon.emitType == Weapon.EmitType.HOLD_LOOP:
weapon.exitLoop(self )
@@ -0,0 +1 @@
uid://r5gm7rcya35p
+30 -3
View File
@@ -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 = MathTool.randomChoiceFrom(START_CHARACTERS)
@rpc("any_peer")
func mutexPlayer(player: String):
@@ -72,14 +76,18 @@ func startMultiplayerGame():
MultiplayerState.connection = multiplayer.multiplayer_peer
WorldManager.rootNode.multiplayer.multiplayer_peer = multiplayer.multiplayer_peer
for i in getPlayerNames():
EntityBase.generatePlayer(i)
EntityBase.generatePlayer(i, selectedCharacter)
UIState.closeCurrentPanel()
func startSingleplayerGame():
startSingleplayerBtn.disabled = true
MultiplayerState.isMultiplayer = false
MultiplayerState.playerName = playerNameInput.text
Wave.usingWaveData = GAMEMODE_MAP_WAVE[gamemodeOption.selected]
UIState.player = EntityBase.generatePlayer(playerNameInput.text)
var extras = ArrayTool.mergeDictionary(ArrayTool.dictionaryFromEntries(
getCurrentSelectedCharacter().fields,
getCurrentSelectedCharacter().fieldValues
), OutGameStorage.upgradableFieldsValue)
UIState.player = EntityBase.generatePlayer(playerNameInput.text, selectedCharacter, extras)
WorldManager.rootNode.spawnWave(Vector2.ZERO)
UIState.setPanel("CompilingTip")
@@ -159,6 +167,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 +202,19 @@ 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)
if selectedCharacter == card.name:
card.animator.play("show")
else:
card.animator.play("hide")
+5 -5
View File
@@ -7,16 +7,16 @@ var speedScale: float = 1
func _init(cd: float = 100):
cooldown = cd
func centralTime():
func centralTime() -> float:
return cooldown / speedScale
func isCooldowned():
func isCooldowned() -> bool:
return timeSinceLastStart() >= centralTime()
func start():
func start() -> bool:
var state = isCooldowned()
if state:
lastStart = WorldManager.getTime()
return state
func timeSinceLastStart():
func timeSinceLastStart() -> float:
return WorldManager.getTime() - lastStart
func percent():
func percent() -> float:
return timeSinceLastStart() / centralTime()
+14 -7
View File
@@ -138,7 +138,7 @@ func _ready():
UIState.player = self
if WorldManager.isRelease():
for i in weaponStore.get_children():
i.free()
i.queue_free()
weaponStore.add_child(ComponentManager.getWeapon("PurpleCrystal").instantiate())
for i in weaponStore.get_children():
i.hide()
@@ -322,6 +322,7 @@ func collectItem(itemType: ItemStore.ItemType, amount: int):
UIState.showTip("[b]%s[/b]已自动强化!" % weapon.displayName)
func storeEnergy(value: float, dontChangeDirection: bool = false):
energy += value * fields.get(FieldStore.Entity.ENERGY_MULTIPILER)
energy = clamp(energy, 0, fields[FieldStore.Entity.MAX_ENERGY])
energyChanged.emit(energy, dontChangeDirection)
func finalEnergy(base: float):
return base / fields.get(FieldStore.Entity.SAVE_ENERGY)
@@ -505,6 +506,7 @@ func summon(who: PackedScene, syncFields: bool = true, lockValue: bool = true) -
var instance: SummonBase = who.instantiate()
instance.position = get_global_mouse_position()
instance.myMaster = self
summoned(instance)
if isPlayer(): instance.add_to_group("players")
if syncFields:
if lockValue:
@@ -550,20 +552,22 @@ func enterStage(_stage: int):
pass
func kill():
pass
func summoned(_entity: SummonBase):
pass
static func findPlayer(playerName: String) -> EntityBase:
for i in getPlayers():
if i.displayName == playerName:
return i
return null
static func generatePlayer(playerName: String) -> EntityBase:
var player = generate(ComponentManager.getCharacter("Rooster"), Vector2.ZERO, false)
player.displayName = playerName
static func generatePlayer(playerName: String, character: String, extraFields: Dictionary = {}) -> EntityBase:
var player = generate(ComponentManager.getCharacter(character), Vector2.ZERO, false, false, true, playerName)
player.name = "Player_%s" % playerName
print(extraFields)
var feed = ComponentManager.getAbstract("FeedCardBase").instantiate() as Feed
for field in OutGameStorage.upgradableFieldsValue:
for field in extraFields:
feed.fields.append(field)
feed.fieldValues.append(OutGameStorage.upgradableFieldsValue[field])
feed.fieldValues.append(extraFields[field])
feed.freeToBuy = true
feed.apply(player)
return player
@@ -572,12 +576,15 @@ static func generate(
spawnPosition: Vector2,
isMob: bool = true,
spawnAsBoss: bool = false,
addToWorld: bool = true
addToWorld: bool = true,
disName: String = ""
):
var instance: EntityBase = entity.instantiate()
instance.position = spawnPosition
instance.isBoss = spawnAsBoss
instance.level = clamp((round(Wave.current * (1 + GameRule.entityLevelOffsetByWave * randf_range(-1, 1)))), 1, INF)
if disName:
instance.displayName = disName
if isMob:
instance.add_to_group("mobs")
else:
+13
View File
@@ -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()
+1
View File
@@ -0,0 +1 @@
uid://7uhyhrta5ld1
+56
View File
@@ -0,0 +1,56 @@
@tool
extends Control
class_name CharacterCard
signal select()
@export var displayName: String = "Unknown Character"
@export var slogan: String = "Slogan"
@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 avatarTexture: TextureRect = $%avatarTexture
@onready var nameLebel: Label = $%nameLabel
@onready var sloganLabel: Label = $%sloganLabel
@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 = get_theme_stylebox("panel").duplicate()
func _ready():
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
sloganLabel.text = "%s" % slogan
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)
+1
View File
@@ -0,0 +1 @@
uid://cd1xb8m6rvoph
+4 -3
View File
@@ -49,10 +49,11 @@ func apply(entity: EntityBase):
for i in range(min(fields.size(), fieldValues.size())):
var field = fields[i]
var value = fieldValues[i]
entity.fields[field] += value
var applier = FieldStore.entityApplier.get(field)
if !applier or applier.call(entity, value):
entity.fields[field] += value
entity.fields[field] = clamp(entity.fields[field], FieldStore.entityMinValueMap.get(field, 0), FieldStore.entityMaxValueMap.get(field, INF))
if applier and applier.call(entity, value):
entity.fields[field] -= value
entity.fields[field] = clamp(entity.fields[field], FieldStore.entityMinValueMap.get(field, 0), FieldStore.entityMaxValueMap.get(field, INF))
for i in weapons:
var instance = i.instantiate() as Weapon
if UIState.player.weaponBag.has(instance.displayName):
+14
View File
@@ -31,3 +31,17 @@ static func fill(origin: Dictionary, filler: Callable) -> Dictionary:
return accum,
{}
)
static func dictionaryFromEntries(keys: Array, values: Array) -> Dictionary:
var result = {}
for index in len(keys):
var key = keys[index]
var value = values[index]
result[key] = value
return result
static func mergeDictionary(a: Dictionary, b: Dictionary) -> Dictionary:
var result := {}
for key in a:
result[key] = a[key]
for key in b:
result[key] = result.get(key, 0.0) + b[key]
return result
@@ -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:
BIN
View File
Binary file not shown.