1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00

feat(武器系统): 添加武器来源显示功能并优化光标刀碰撞

- 在武器卡片中添加来源显示标签和数组字段
- 将光标刀的碰撞形状从矩形改为线段
- 为光标刀添加命中时的击退效果
- 优化场景文件格式和节点唯一ID
This commit is contained in:
2026-04-04 08:55:15 +08:00
parent d4598e113d
commit 93fdb8e2b8
4 changed files with 57 additions and 38 deletions
+40 -24
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://ckq2cq6m23hq3"]
[gd_scene format=3 uid="uid://ckq2cq6m23hq3"]
[ext_resource type="Script" uid="uid://c7odfwtug8ds4" path="res://scripts/Structs/Weapon.gd" id="1_g802t"]
[ext_resource type="Theme" uid="uid://dhvs6urgf6jr5" path="res://themes/main.tres" id="2_fwkd3"]
@@ -22,55 +22,60 @@ corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[node name="WeaponCard" type="PanelContainer"]
[sub_resource type="LabelSettings" id="LabelSettings_b3nsw"]
font_size = 13
font_color = Color(0.55, 0.55, 0.55, 1)
[node name="WeaponCard" type="PanelContainer" unique_id=2085048785]
offset_right = 350.0
offset_bottom = 304.0
theme_override_styles/panel = SubResource("StyleBoxFlat_n2ewr")
script = ExtResource("1_g802t")
sources = Array[String](["无灵"])
metadata/_edit_lock_ = true
[node name="sounds" type="Node2D" parent="."]
[node name="sounds" type="Node2D" parent="." unique_id=1775425991]
unique_name_in_owner = true
[node name="attack" type="AudioStreamPlayer2D" parent="sounds"]
[node name="attack" type="AudioStreamPlayer2D" parent="sounds" unique_id=853583292]
process_mode = 3
[node name="container" type="VBoxContainer" parent="."]
[node name="container" type="VBoxContainer" parent="." unique_id=575698869]
layout_mode = 2
theme_override_constants/separation = 10
alignment = 1
[node name="wrapper" type="VBoxContainer" parent="container"]
[node name="wrapper" type="VBoxContainer" parent="container" unique_id=673686123]
layout_mode = 2
[node name="updateBtn" type="Button" parent="container/wrapper"]
[node name="updateBtn" type="Button" parent="container/wrapper" unique_id=248603389]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("2_fwkd3")
text = "升级"
[node name="souls" type="HBoxContainer" parent="container/wrapper"]
[node name="souls" type="HBoxContainer" parent="container/wrapper" unique_id=1439164733]
layout_mode = 2
[node name="extractBtn" type="Button" parent="container/wrapper/souls"]
[node name="extractBtn" type="Button" parent="container/wrapper/souls" unique_id=496889309]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("2_fwkd3")
text = "提炼"
[node name="inlayBtn" type="Button" parent="container/wrapper/souls"]
[node name="inlayBtn" type="Button" parent="container/wrapper/souls" unique_id=1008423578]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("2_fwkd3")
text = "镶嵌"
[node name="info" type="VBoxContainer" parent="container"]
[node name="info" type="VBoxContainer" parent="container" unique_id=1625294072]
layout_mode = 2
theme_override_constants/separation = 10
[node name="avatar" type="TextureRect" parent="container/info"]
[node name="avatar" type="TextureRect" parent="container/info" unique_id=1021985889]
unique_name_in_owner = true
custom_minimum_size = Vector2(75, 75)
layout_mode = 2
@@ -79,16 +84,16 @@ size_flags_vertical = 0
expand_mode = 1
stretch_mode = 5
[node name="infos" type="HBoxContainer" parent="container/info"]
[node name="infos" type="HBoxContainer" parent="container/info" unique_id=492799150]
layout_mode = 2
theme_override_constants/separation = 20
alignment = 1
[node name="energyInfo" type="HBoxContainer" parent="container/info/infos"]
[node name="energyInfo" type="HBoxContainer" parent="container/info/infos" unique_id=644675021]
layout_mode = 2
alignment = 1
[node name="icon" type="TextureRect" parent="container/info/infos/energyInfo"]
[node name="icon" type="TextureRect" parent="container/info/infos/energyInfo" unique_id=2073246581]
custom_minimum_size = Vector2(15, 15)
layout_mode = 2
size_flags_horizontal = 4
@@ -97,26 +102,30 @@ texture = ExtResource("4_6gohw")
expand_mode = 1
stretch_mode = 5
[node name="energy" type="Label" parent="container/info/infos/energyInfo"]
[node name="energy" type="Label" parent="container/info/infos/energyInfo" unique_id=1664028115]
unique_name_in_owner = true
layout_mode = 2
text = "0.0"
[node name="beachball" parent="container/info/infos" instance=ExtResource("4_k01vb")]
[node name="beachball" parent="container/info/infos" unique_id=653442983 instance=ExtResource("4_k01vb")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
type = 3
count = 500
[node name="soul" parent="container/info/infos" instance=ExtResource("4_k01vb")]
[node name="soul" parent="container/info/infos" unique_id=1367320807 instance=ExtResource("4_k01vb")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
type = 4
count = 1
[node name="name" parent="container/info" instance=ExtResource("3_qv0b1")]
[node name="VBoxContainer" type="VBoxContainer" parent="container/info" unique_id=784441328]
layout_mode = 2
theme_override_constants/separation = 0
[node name="name" parent="container/info/VBoxContainer" unique_id=1576068972 instance=ExtResource("3_qv0b1")]
unique_name_in_owner = true
layout_mode = 2
typeTopicColorMap = {
@@ -134,14 +143,21 @@ soulLevelColorMap = {
5: Color(1, 0.57713, 0.247421, 1)
}
[node name="description" type="RichTextLabel" parent="container"]
[node name="source" type="Label" parent="container/info/VBoxContainer" unique_id=365191794]
unique_name_in_owner = true
layout_mode = 2
text = "CVB"
label_settings = SubResource("LabelSettings_b3nsw")
horizontal_alignment = 1
[node name="description" type="RichTextLabel" parent="container" unique_id=566230682]
unique_name_in_owner = true
layout_mode = 2
bbcode_enabled = true
text = "[center]造成[color=cyan]10[/color]点伤害。[/center]"
fit_content = true
[node name="costs" type="GridContainer" parent="container"]
[node name="costs" type="GridContainer" parent="container" unique_id=1912749879]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 10
@@ -149,16 +165,16 @@ theme_override_constants/h_separation = 10
theme_override_constants/v_separation = 10
columns = 2
[node name="control" type="HBoxContainer" parent="container"]
[node name="control" type="HBoxContainer" parent="container" unique_id=1948685075]
layout_mode = 2
[node name="moveleft" type="Button" parent="container/control"]
[node name="moveleft" type="Button" parent="container/control" unique_id=2063008334]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "←"
[node name="moveright" type="Button" parent="container/control"]
[node name="moveright" type="Button" parent="container/control" unique_id=883570680]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
+12 -14
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://cxjsajua2a82n"]
[gd_scene format=3 uid="uid://cxjsajua2a82n"]
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_epcdw"]
[ext_resource type="Script" uid="uid://c337id4kvvj58" path="res://scripts/Contents/Bullets/CursorKnife.gd" id="2_glt8o"]
@@ -133,10 +133,11 @@ scale_curve = SubResource("CurveTexture_t6dk8")
color_initial_ramp = SubResource("GradientTexture1D_ioc4f")
alpha_curve = SubResource("CurveTexture_3757w")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_epcdw"]
size = Vector2(126, 388)
[sub_resource type="SegmentShape2D" id="SegmentShape2D_r4tbf"]
a = Vector2(0, -80)
b = Vector2(0, 80)
[node name="CursorKnife" instance=ExtResource("1_epcdw")]
[node name="CursorKnife" unique_id=736659683 instance=ExtResource("1_epcdw")]
script = ExtResource("2_glt8o")
speed = 5.0
penerate = 1.0
@@ -145,21 +146,18 @@ autoSpawnAnimation = true
autoDestroyOnHitMap = false
autoPlayTexture = true
freeAfterSpawn = true
knockback = 10.0
[node name="texture" parent="." index="0"]
[node name="texture" parent="." index="0" unique_id=162977358]
position = Vector2(-33, 4)
rotation = -0.6813664
scale = Vector2(1e-05, 1e-05)
sprite_frames = SubResource("SpriteFrames_vdv8l")
frame_progress = 1.0
[node name="animator" parent="texture" index="0"]
libraries = {
&"": SubResource("AnimationLibrary_t6dk8")
}
[node name="animator" parent="texture" index="0" unique_id=1114087117]
libraries/ = SubResource("AnimationLibrary_t6dk8")
[node name="trail" type="GPUParticles2D" parent="texture" index="1"]
[node name="trail" type="GPUParticles2D" parent="texture" index="1" unique_id=1234210493]
z_index = -1
position = Vector2(28.85057, 31.122555)
rotation = 0.6806784
@@ -167,6 +165,6 @@ amount = 100
preprocess = 1.0
process_material = SubResource("ParticleProcessMaterial_aqt0q")
[node name="hitbox" parent="." index="1"]
position = Vector2(45, 30)
shape = SubResource("RectangleShape2D_epcdw")
[node name="hitbox" parent="." index="1" unique_id=175349408]
position = Vector2(40, 0)
shape = SubResource("SegmentShape2D_r4tbf")
+2
View File
@@ -3,3 +3,5 @@ class_name CursorKnifeBullet
func ai():
PresetBulletAI.forward(self , rotation)
func succeedToHit(_dmg: float, entity: EntityBase):
entity.impluse(Vector2.from_angle(rotation) * 250)
+3
View File
@@ -17,6 +17,7 @@ class_name Weapon
"atk": FieldStore.DataType.INTEGER
}
@export_multiline var descriptionTemplate: String = "造成$atk点伤害。"
@export var sources: Array[String] = []
@export var needEnergy: float = 0
@export var cooldown: float = 100
@export var debugRebuild: bool = false
@@ -24,6 +25,7 @@ class_name Weapon
@onready var avatarRect: TextureRect = $"%avatar"
@onready var nameLabel: WeaponName = $"%name"
@onready var sourceLabel: Label = $"%source"
@onready var energyLabel: Label = $"%energy"
@onready var beachball: ItemShow = $"%beachball"
@onready var soul: ItemShow = $"%soul"
@@ -121,6 +123,7 @@ func rebuildInfo(showNext: bool = false):
nameLabel.typeTopic = typeTopic
nameLabel.soulLevel = soulLevel
nameLabel.level = level
sourceLabel.text = " × ".join(sources)
energyLabel.text = "%.1f" % needEnergy
beachball.count = costBeachball
soul.count = soulLevel