Compare commits

...

6 Commits

Author SHA1 Message Date
059753b9ab 修复分裂子弹会影响近战武器伤害的bug 2024-03-17 18:59:22 +08:00
e663872858 Merge remote-tracking branch 'gitee/develop' into develop 2024-03-17 18:44:12 +08:00
2613785c98 重构主动道具中 2024-03-17 18:43:59 +08:00
王晗智
fbce547370 Merge branch 'develop' of https://gitee.com/xlljc/DungeonShooting into develop 2024-03-17 15:40:48 +08:00
王晗智
4deaacc135 10 2024-03-17 15:37:02 +08:00
王晗智
7fd4533e61 7 2024-03-16 22:57:49 +08:00
72 changed files with 848 additions and 471 deletions

View File

@ -13,122 +13,10 @@ namespace Generator;
/// </summary>
public static class BuffGenerator
{
private const string SavePath = "src/game/manager/BuffRegister.cs";
public static bool Generate()
{
try
{
var str = "";
var buffInfos = new Dictionary<string, BuffInfo>();
var types = typeof(BuffGenerator).Assembly.GetTypes();
//包含[BuffAttribute]特性
var enumerable = types.Where(type =>
type.IsClass && !type.IsAbstract && type.IsAssignableTo(typeof(BuffFragment)));
foreach (var type in enumerable)
{
var attribute = (BuffAttribute)type.GetCustomAttribute(typeof(BuffAttribute), false);
if (attribute != null)
{
if (buffInfos.ContainsKey(attribute.BuffName))
{
GD.PrintErr($"Buff '{attribute.BuffName}' 重名!");
return false;
}
var buffInfo = new BuffInfo(attribute.BuffName, attribute.Description, type);
str += $"{buffInfo.Name}: {buffInfo.Description}\n";
buffInfos.Add(attribute.BuffName, buffInfo);
//判断重写参数情况
//1参数
var methodInfo1 = type.GetMethod(nameof(BuffFragment.InitParam),
BindingFlags.Instance | BindingFlags.Public, new Type[] { typeof(float) });
if (methodInfo1 != null &&
methodInfo1.GetBaseDefinition().DeclaringType != methodInfo1.DeclaringType)
{
buffInfo.Params.Add(1);
}
//2参数
var methodInfo2 = type.GetMethod(nameof(BuffFragment.InitParam),
BindingFlags.Instance | BindingFlags.Public, new Type[] { typeof(float), typeof(float) });
if (methodInfo2 != null &&
methodInfo2.GetBaseDefinition().DeclaringType != methodInfo2.DeclaringType)
{
buffInfo.Params.Add(2);
}
//3参数
var methodInfo3 = type.GetMethod(nameof(BuffFragment.InitParam),
BindingFlags.Instance | BindingFlags.Public,
new Type[] { typeof(float), typeof(float), typeof(float) });
if (methodInfo3 != null &&
methodInfo3.GetBaseDefinition().DeclaringType != methodInfo3.DeclaringType)
{
buffInfo.Params.Add(3);
}
//4参数
var methodInfo4 = type.GetMethod(nameof(BuffFragment.InitParam),
BindingFlags.Instance | BindingFlags.Public,
new Type[] { typeof(float), typeof(float), typeof(float), typeof(float) });
if (methodInfo4 != null &&
methodInfo4.GetBaseDefinition().DeclaringType != methodInfo4.DeclaringType)
{
buffInfo.Params.Add(4);
}
}
}
GenerateCode(buffInfos);
GD.Print("-----------------------------");
GD.Print(str);
}
catch (Exception e)
{
GD.PrintErr(e.Message + "\n" + e.StackTrace);
return false;
}
return true;
}
private static void GenerateCode(Dictionary<string, BuffInfo> buffInfo)
{
var str = "";
foreach (var kv in buffInfo)
{
var info = kv.Value;
var s = "";
for (var i = 0; i < info.Params.Count; i++)
{
if (i > 0) s += ", ";
s += info.Params[i];
}
str += $" BuffInfos.Add(\"{info.Name}\", new BuffInfo(\"{info.Name}\", null, new List<int>() {{ {s} }}, typeof({info.Type.FullName})));\n";
}
var code = $"using System.Collections.Generic;\n" +
$"/// <summary>\n" +
$"/// buff 注册类, 调用 Init() 函数初始化数据\n" +
$"/// 注意: 该类为 Tools 面板下自动生成的, 请不要手动编辑!\n" +
$"/// </summary>\n" +
$"public class BuffRegister\n" +
$"{{\n" +
$" /// <summary>\n" +
$" /// 所有 buff 信息\n" +
$" /// </summary>\n" +
$" public static Dictionary<string, BuffInfo> BuffInfos {{ get; private set; }}\n" +
$" /// <summary>\n" +
$" /// 初始化 buff\n" +
$" /// </summary>\n" +
$" public static void Init()\n" +
$" {{\n" +
$" BuffInfos = new Dictionary<string, BuffInfo>();\n" +
str +
$" }}\n" +
$"}}";
File.WriteAllText(SavePath, code);
}
}
#endif

View File

@ -1,12 +1,11 @@
[gd_scene load_steps=7 format=3 uid="uid://crwflnrd6so2i"]
[gd_scene load_steps=6 format=3 uid="uid://drjkrimgii1u0"]
[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="1_f18nu"]
[ext_resource type="Script" path="res://src/game/activity/prop/active/ActiveProp5000.cs" id="1_nkhdg"]
[ext_resource type="SpriteFrames" uid="uid://cvosq47nbdnus" path="res://resource/spriteFrames/prop/active/ActiveProp5000.tres" id="3_4xrrj"]
[ext_resource type="Script" path="res://src/game/activity/prop/ActiveProp.cs" id="1_n541c"]
[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_75di4"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_mrkt4"]
resource_local_to_scene = true
shader = ExtResource("1_f18nu")
shader = ExtResource("2_75di4")
shader_parameter/blend = Color(0, 0, 0, 0.470588)
shader_parameter/schedule = 1.0
shader_parameter/modulate = Color(1, 1, 1, 1)
@ -18,7 +17,7 @@ shader_parameter/grey = 0.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_b6ii6"]
resource_local_to_scene = true
shader = ExtResource("1_f18nu")
shader = ExtResource("2_75di4")
shader_parameter/blend = Color(1, 1, 1, 1)
shader_parameter/schedule = 0.0
shader_parameter/modulate = Color(1, 1, 1, 1)
@ -31,9 +30,9 @@ shader_parameter/grey = 0.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cpqup"]
size = Vector2(12, 10)
[node name="ActiveProp5000" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")]
[node name="ActiveProp" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")]
collision_layer = 4
script = ExtResource("1_nkhdg")
script = ExtResource("1_n541c")
ShadowSprite = NodePath("ShadowSprite")
AnimatedSprite = NodePath("AnimatedSprite")
Collision = NodePath("Collision")
@ -44,7 +43,6 @@ material = SubResource("ShaderMaterial_mrkt4")
[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."]
material = SubResource("ShaderMaterial_b6ii6")
sprite_frames = ExtResource("3_4xrrj")
[node name="Collision" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_cpqup")

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://dfpic4nubu7cf"]
[gd_scene load_steps=6 format=3 uid="uid://dfpic4nubu7cf"]
[ext_resource type="Script" path="res://src/game/activity/prop/BuffProp.cs" id="1_nlcp6"]
[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_imicp"]
@ -27,9 +27,6 @@ shader_parameter/outline_rainbow = false
shader_parameter/outline_use_blend = true
shader_parameter/grey = 0.0
[sub_resource type="SpriteFrames" id="SpriteFrames_y5dlc"]
resource_local_to_scene = true
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cpqup"]
size = Vector2(12, 10)
@ -46,7 +43,6 @@ material = SubResource("ShaderMaterial_mrkt4")
[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."]
material = SubResource("ShaderMaterial_b6ii6")
sprite_frames = SubResource("SpriteFrames_y5dlc")
[node name="Collision" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_cpqup")

View File

@ -1,50 +0,0 @@
[gd_scene load_steps=7 format=3 uid="uid://dlf83ph0msl2l"]
[ext_resource type="Script" path="res://src/game/activity/prop/active/ActiveProp5001.cs" id="1_klvlf"]
[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_2cgdl"]
[ext_resource type="SpriteFrames" uid="uid://bbjyakayescy5" path="res://resource/spriteFrames/prop/active/ActiveProp5001.tres" id="3_fagk1"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_mrkt4"]
resource_local_to_scene = true
shader = ExtResource("2_2cgdl")
shader_parameter/blend = Color(0, 0, 0, 0.470588)
shader_parameter/schedule = 1.0
shader_parameter/modulate = Color(1, 1, 1, 1)
shader_parameter/show_outline = false
shader_parameter/outline_color = Color(0, 0, 0, 1)
shader_parameter/outline_rainbow = false
shader_parameter/outline_use_blend = true
shader_parameter/grey = 0.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_b6ii6"]
resource_local_to_scene = true
shader = ExtResource("2_2cgdl")
shader_parameter/blend = Color(1, 1, 1, 1)
shader_parameter/schedule = 0.0
shader_parameter/modulate = Color(1, 1, 1, 1)
shader_parameter/show_outline = true
shader_parameter/outline_color = Color(0, 0, 0, 1)
shader_parameter/outline_rainbow = false
shader_parameter/outline_use_blend = true
shader_parameter/grey = 0.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cpqup"]
size = Vector2(12, 10)
[node name="ActiveProp5001" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")]
collision_layer = 4
script = ExtResource("1_klvlf")
ShadowSprite = NodePath("ShadowSprite")
AnimatedSprite = NodePath("AnimatedSprite")
Collision = NodePath("Collision")
[node name="ShadowSprite" type="Sprite2D" parent="."]
z_index = -1
material = SubResource("ShaderMaterial_mrkt4")
[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."]
material = SubResource("ShaderMaterial_b6ii6")
sprite_frames = ExtResource("3_fagk1")
[node name="Collision" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_cpqup")

View File

@ -1 +1,38 @@
[]
[
{
"Id": "0001",
"Remark": "\u533B\u836F\u7BB1",
"__Activity": "prop5000",
"Buff": null,
"Condition": {
"HpFull": [
0
]
},
"Effect": {
"Hp": [
2
]
},
"CooldownTime": 0,
"IsConsumables": true,
"MaxCount": 10
},
{
"Id": "0002",
"Remark": "\u5F39\u836F\u7BB1",
"__Activity": "prop5001",
"Buff": null,
"Condition": {
"AmmoFull": [
0
]
},
"Effect": {
"TotalAmmo": []
},
"CooldownTime": 0,
"IsConsumables": true,
"MaxCount": 10
}
]

View File

@ -653,7 +653,7 @@
"Details": "",
"IsStatic": false,
"__Material": "",
"Prefab": "res://prefab/prop/active/ActiveProp5000.tscn",
"Prefab": "res://prefab/prop/ActiveProp.tscn",
"Icon": "res://resource/sprite/prop/active/ActiveProp5000.png",
"ShowInMapEditor": true
},
@ -667,7 +667,7 @@
"Details": "",
"IsStatic": false,
"__Material": "",
"Prefab": "res://prefab/prop/active/ActiveProp5001.tscn",
"Prefab": "res://prefab/prop/ActiveProp.tscn",
"Icon": "res://resource/sprite/prop/active/ActiveProp5001.png",
"ShowInMapEditor": true
},

View File

@ -44,7 +44,7 @@
"Remark": "\u6740\u4F24\u5F39",
"__Activity": "prop0005",
"Buff": {
"Damage": [
"BulletDamage": [
2,
0.2
]
@ -108,7 +108,7 @@
-8,
8
],
"Damage": [
"BulletDamage": [
2,
-0.35
],

View File

@ -49,7 +49,7 @@
"RewardList": [
{
"ErrorType": 0,
"Path": "resource/map/tileMaps/Test1/reward/Award1"
"Path": "resource/map/tileMaps/Test1/reward/Reward1"
}
],
"ShopList": [

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1 +1 @@
{"Position":{"X":-8,"Y":-7},"Size":{"X":15,"Y":18},"DoorAreaInfos":[{"Direction":3,"Start":32,"End":176},{"Direction":0,"Start":80,"End":160},{"Direction":2,"Start":48,"End":128},{"Direction":1,"Start":96,"End":192}],"GroupName":"Test1","RoomType":1,"RoomName":"Battle6","Weight":100,"Remark":""}
{"Position":{"X":-8,"Y":-9},"Size":{"X":15,"Y":20},"DoorAreaInfos":[{"Direction":3,"Start":32,"End":176},{"Direction":0,"Start":112,"End":192},{"Direction":2,"Start":48,"End":128},{"Direction":1,"Start":128,"End":224}],"GroupName":"Test1","RoomType":1,"RoomName":"Battle6","Weight":100,"Remark":""}

View File

@ -1 +1 @@
{"NavigationVertices":[{"X":74,"Y":22},{"X":74,"Y":106},{"X":26,"Y":106},{"X":22,"Y":86},{"X":22,"Y":42},{"X":10,"Y":22},{"X":-38,"Y":42},{"X":-74,"Y":38},{"X":-58,"Y":-58},{"X":74,"Y":-58},{"X":74,"Y":-22},{"X":10,"Y":-22},{"X":-58,"Y":-42},{"X":26,"Y":154},{"X":-42,"Y":154},{"X":-42,"Y":138},{"X":-38,"Y":86},{"X":-90,"Y":138},{"X":-90,"Y":38},{"X":-74,"Y":-42}],"NavigationPolygon":[[0,1,2,3,4],[5,0,4,6,7],[8,9,10,11,12],[2,13,14,15,16,3],[15,17,18,7,6,16],[7,19,12,11,5]],"Floor":[-4,-4,0,3,-3,-4,0,3,-2,-4,0,3,-1,-4,0,3,0,-4,0,3,1,-4,0,3,2,-4,0,3,3,-4,0,3,4,-4,0,3,4,-3,0,3,3,-3,0,3,2,-3,0,3,1,-3,0,3,0,-3,0,3,-1,-3,0,3,-2,-3,0,3,-3,-3,0,3,-5,-3,0,3,-5,-2,0,3,-5,-1,0,3,-5,0,0,3,-5,1,0,3,-5,2,0,3,-4,-3,0,3,-4,-2,0,3,-4,-1,0,3,-4,0,0,3,-4,1,0,3,-4,2,0,3,-3,-2,0,3,-3,-1,0,3,-3,0,0,3,-3,1,0,3,-3,2,0,3,-2,-2,0,3,-2,-1,0,3,-2,0,0,3,-2,1,0,3,-1,-2,0,3,-1,-1,0,3,-1,0,0,3,-1,1,0,3,0,-2,0,3,0,-1,0,3,0,0,0,3,0,1,0,3,0,5,0,3,1,1,0,3,1,2,0,3,1,3,0,3,1,4,0,3,1,5,0,3,2,1,0,3,2,2,0,3,2,3,0,3,2,4,0,3,2,5,0,3,3,1,0,3,3,2,0,3,3,3,0,3,3,4,0,3,3,5,0,3,4,1,0,3,4,2,0,3,4,3,0,3,4,4,0,3,4,5,0,3,-3,3,0,3,-3,4,0,3,-3,5,0,3,-2,5,0,3,-1,5,0,3,-6,2,0,3,-6,3,0,3,-6,4,0,3,-6,5,0,3,-6,6,0,3,-6,7,0,3,-5,3,0,3,-5,4,0,3,-5,5,0,3,-5,6,0,3,-5,7,0,3,-4,3,0,3,-4,4,0,3,-4,5,0,3,-4,6,0,3,-4,7,0,3,-3,6,0,3,-3,7,0,3,-3,8,0,3,-2,6,0,3,-2,7,0,3,-2,8,0,3,-1,6,0,3,-1,7,0,3,-1,8,0,3,0,6,0,3,0,7,0,3,0,8,0,3,1,6,0,3,1,7,0,3,1,8,0,3],"CustomFloor1":[],"CustomFloor2":[],"CustomFloor3":[],"CustomMiddle1":[],"CustomMiddle2":[],"CustomTop":[]}
{"NavigationVertices":[{"X":74,"Y":22},{"X":74,"Y":106},{"X":26,"Y":106},{"X":22,"Y":86},{"X":22,"Y":42},{"X":10,"Y":22},{"X":-38,"Y":42},{"X":-74,"Y":38},{"X":58,"Y":-58},{"X":74,"Y":-58},{"X":74,"Y":-22},{"X":10,"Y":-22},{"X":26,"Y":154},{"X":-42,"Y":154},{"X":-42,"Y":138},{"X":-38,"Y":86},{"X":-90,"Y":138},{"X":-90,"Y":38},{"X":-74,"Y":-42},{"X":-58,"Y":-42},{"X":-58,"Y":-58},{"X":-42,"Y":-58},{"X":-42,"Y":-90},{"X":58,"Y":-90}],"NavigationPolygon":[[0,1,2,3,4],[5,0,4,6,7],[8,9,10,11],[2,12,13,14,15,3],[14,16,17,7,6,15],[7,18,19,11,5],[19,20,21,11],[21,22,23,8,11]],"Floor":[-4,-4,0,3,-3,-4,0,3,-2,-4,0,3,-1,-4,0,3,0,-4,0,3,1,-4,0,3,2,-4,0,3,3,-4,0,3,4,-4,0,3,4,-3,0,3,3,-3,0,3,2,-3,0,3,1,-3,0,3,0,-3,0,3,-1,-3,0,3,-2,-3,0,3,-3,-3,0,3,-5,-3,0,3,-5,-2,0,3,-5,-1,0,3,-5,0,0,3,-5,1,0,3,-5,2,0,3,-4,-3,0,3,-4,-2,0,3,-4,-1,0,3,-4,0,0,3,-4,1,0,3,-4,2,0,3,-3,-2,0,3,-3,-1,0,3,-3,0,0,3,-3,1,0,3,-3,2,0,3,-2,-2,0,3,-2,-1,0,3,-2,0,0,3,-2,1,0,3,-1,-2,0,3,-1,-1,0,3,-1,0,0,3,-1,1,0,3,0,-2,0,3,0,-1,0,3,0,0,0,3,0,1,0,3,0,5,0,3,1,1,0,3,1,2,0,3,1,3,0,3,1,4,0,3,1,5,0,3,2,1,0,3,2,2,0,3,2,3,0,3,2,4,0,3,2,5,0,3,3,1,0,3,3,2,0,3,3,3,0,3,3,4,0,3,3,5,0,3,4,1,0,3,4,2,0,3,4,3,0,3,4,4,0,3,4,5,0,3,-3,3,0,3,-3,4,0,3,-3,5,0,3,-2,5,0,3,-1,5,0,3,-6,2,0,3,-6,3,0,3,-6,4,0,3,-6,5,0,3,-6,6,0,3,-6,7,0,3,-5,3,0,3,-5,4,0,3,-5,5,0,3,-5,6,0,3,-5,7,0,3,-4,3,0,3,-4,4,0,3,-4,5,0,3,-4,6,0,3,-4,7,0,3,-3,6,0,3,-3,7,0,3,-3,8,0,3,-2,6,0,3,-2,7,0,3,-2,8,0,3,-1,6,0,3,-1,7,0,3,-1,8,0,3,0,6,0,3,0,7,0,3,0,8,0,3,1,6,0,3,1,7,0,3,1,8,0,3,-3,-5,0,3,-3,-6,0,3,-2,-6,0,3,-1,-6,0,3,0,-6,0,3,1,-6,0,3,2,-6,0,3,3,-6,0,3,3,-5,0,3,2,-5,0,3,1,-5,0,3,0,-5,0,3,-1,-5,0,3,-2,-5,0,3],"CustomFloor1":[],"CustomFloor2":[],"CustomFloor3":[],"CustomMiddle1":[],"CustomMiddle2":[],"CustomTop":[]}

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -1 +1 @@
{"Position":{"X":-9,"Y":-7},"Size":{"X":20,"Y":17},"DoorAreaInfos":[{"Direction":2,"Start":48,"End":176},{"Direction":3,"Start":64,"End":208},{"Direction":0,"Start":16,"End":144},{"Direction":1,"Start":16,"End":160}],"GroupName":"Test1","RoomType":2,"RoomName":"Start","Weight":100,"Remark":""}
{"Position":{"X":-9,"Y":-11},"Size":{"X":20,"Y":21},"DoorAreaInfos":[{"Direction":2,"Start":48,"End":176},{"Direction":3,"Start":64,"End":208},{"Direction":0,"Start":80,"End":208},{"Direction":1,"Start":80,"End":224}],"GroupName":"Test1","RoomType":2,"RoomName":"Start","Weight":100,"Remark":""}

View File

@ -1 +1 @@
{"NavigationVertices":[{"X":138,"Y":-42},{"X":138,"Y":90},{"X":134,"Y":38},{"X":134,"Y":-6},{"X":74,"Y":10},{"X":74,"Y":54},{"X":58,"Y":90},{"X":-26,"Y":38},{"X":-26,"Y":-6},{"X":90,"Y":-42},{"X":90,"Y":-6},{"X":90,"Y":10},{"X":118,"Y":54},{"X":118,"Y":38},{"X":58,"Y":138},{"X":-58,"Y":138},{"X":-58,"Y":106},{"X":-86,"Y":38},{"X":-106,"Y":106},{"X":-106,"Y":-42},{"X":-86,"Y":-6},{"X":-42,"Y":-42},{"X":-42,"Y":-58},{"X":90,"Y":-58}],"NavigationPolygon":[[0,1,2,3],[4,5,6,7,8],[9,0,3,10],[10,11,4],[12,13,2,1],[12,1,6,5],[7,6,14,15,16],[17,7,16,18],[17,18,19,20],[20,19,21,8],[4,8,21,22,23,9],[4,9,10]],"Floor":[-3,-4,0,3,-2,-4,0,3,-2,-3,0,3,-3,-3,0,3,-7,-2,0,3,-7,-1,0,3,-7,0,0,3,-7,1,0,3,-7,2,0,3,-7,3,0,3,-7,4,0,3,-7,5,0,3,-6,-3,0,3,-6,-2,0,3,-6,-1,0,3,-6,0,0,3,-6,1,0,3,-6,2,0,3,-6,3,0,3,-6,4,0,3,-6,5,0,3,-5,-3,0,3,-5,-2,0,3,-5,2,0,3,-5,3,0,3,-5,4,0,3,-5,5,0,3,-4,-3,0,3,-4,-2,0,3,-4,2,0,3,-4,3,0,3,-4,4,0,3,-4,5,0,3,-3,-2,0,3,-3,2,0,3,-3,3,0,3,-3,4,0,3,-3,5,0,3,-2,-2,0,3,-2,-1,0,3,-2,0,0,3,-2,1,0,3,-2,2,0,3,-2,3,0,3,-2,4,0,3,-2,5,0,3,-4,6,0,3,-4,7,0,3,-3,6,0,3,-3,7,0,3,-2,6,0,3,-2,7,0,3,-1,3,0,3,-1,4,0,3,-1,7,0,3,0,3,0,3,0,4,0,3,0,7,0,3,1,3,0,3,1,4,0,3,1,5,0,3,1,6,0,3,1,7,0,3,2,3,0,3,2,4,0,3,2,5,0,3,2,6,0,3,2,7,0,3,3,3,0,3,3,4,0,3,3,5,0,3,3,6,0,3,3,7,0,3,-1,-4,0,3,-1,-3,0,3,-1,-2,0,3,-1,-1,0,3,-1,0,0,3,0,-4,0,3,0,-3,0,3,0,-2,0,3,0,-1,0,3,0,0,0,3,1,-4,0,3,1,-3,0,3,1,-2,0,3,1,-1,0,3,1,0,0,3,2,-4,0,3,2,-3,0,3,2,-2,0,3,2,-1,0,3,2,0,0,3,3,-4,0,3,3,-3,0,3,3,-2,0,3,3,-1,0,3,3,0,0,3,4,-4,0,3,4,-3,0,3,4,-2,0,3,4,-1,0,3,4,0,0,3,5,-4,0,3,5,-3,0,3,5,-1,0,3,3,1,0,3,3,2,0,3,4,1,0,3,4,2,0,3,4,3,0,3,4,4,0,3,5,3,0,3,5,4,0,3,6,3,0,3,6,4,0,3,6,-3,0,3,7,-3,0,3,7,-2,0,3,7,2,0,3,7,3,0,3,7,4,0,3,8,-3,0,3,8,-2,0,3,8,-1,0,3,8,0,0,3,8,1,0,3,8,2,0,3,8,3,0,3,8,4,0,3,-1,2,0,3,0,2,0,3,1,2,0,3,2,2,0,3,2,1,0,3,1,1,0,3,0,1,0,3,-1,1,0,3,-1,5,0,3,0,5,0,3,0,6,0,3,-1,6,0,3,-7,-3,0,3,6,-2,0,3,5,-2,0,3],"CustomFloor1":[-4,2,1,7,14,-3,3,1,8,15,-4,3,1,7,15,-5,3,1,6,15,6,4,1,8,15,5,4,1,7,15,-5,2,1,6,14,4,3,1,6,14,4,4,1,6,15,6,3,1,8,14,5,3,1,7,14,-3,2,1,8,14],"CustomFloor2":[],"CustomFloor3":[],"CustomMiddle1":[-3,4,1,10,5,-3,5,1,10,6,2,4,1,10,5,2,5,1,10,6],"CustomMiddle2":[5,-4,1,6,0,5,-3,1,6,1,-2,-1,1,5,0,-2,0,1,5,1],"CustomTop":[]}
{"NavigationVertices":[{"X":134,"Y":38},{"X":134,"Y":-6},{"X":138,"Y":-42},{"X":138,"Y":138},{"X":90,"Y":-122},{"X":90,"Y":-42},{"X":86,"Y":-58},{"X":86,"Y":-102},{"X":-42,"Y":-122},{"X":-38,"Y":-102},{"X":-42,"Y":-42},{"X":-38,"Y":-58},{"X":74,"Y":10},{"X":74,"Y":54},{"X":58,"Y":90},{"X":-26,"Y":38},{"X":-26,"Y":-6},{"X":90,"Y":-6},{"X":90,"Y":10},{"X":118,"Y":54},{"X":118,"Y":38},{"X":134,"Y":90},{"X":134,"Y":138},{"X":58,"Y":138},{"X":-58,"Y":138},{"X":-58,"Y":106},{"X":-86,"Y":38},{"X":-106,"Y":106},{"X":-106,"Y":-42},{"X":-86,"Y":-6}],"NavigationPolygon":[[0,1,2,3],[4,5,6,7],[8,4,7,9],[10,8,9,11],[12,13,14,15,16],[5,2,1,17],[17,18,12],[19,20,0,21],[3,22,21],[0,3,21],[19,21,14,13],[15,14,23,24,25],[26,15,25,27],[26,27,28,29],[29,28,10,16],[12,16,10,11,6,5,17]],"Floor":[-3,-4,0,3,-2,-4,0,3,-2,-3,0,3,-3,-3,0,3,-7,-2,0,3,-7,-1,0,3,-7,0,0,3,-7,1,0,3,-7,2,0,3,-7,3,0,3,-7,4,0,3,-7,5,0,3,-6,-3,0,3,-6,-2,0,3,-6,-1,0,3,-6,0,0,3,-6,1,0,3,-6,2,0,3,-6,3,0,3,-6,4,0,3,-6,5,0,3,-5,-3,0,3,-5,-2,0,3,-5,2,0,3,-5,3,0,3,-5,4,0,3,-5,5,0,3,-4,-3,0,3,-4,-2,0,3,-4,2,0,3,-4,3,0,3,-4,4,0,3,-4,5,0,3,-3,-2,0,3,-3,2,0,3,-3,3,0,3,-3,4,0,3,-3,5,0,3,-2,-2,0,3,-2,-1,0,3,-2,0,0,3,-2,1,0,3,-2,2,0,3,-2,3,0,3,-2,4,0,3,-2,5,0,3,-4,6,0,3,-4,7,0,3,-3,6,0,3,-3,7,0,3,-2,6,0,3,-2,7,0,3,-1,3,0,3,-1,4,0,3,-1,7,0,3,0,3,0,3,0,4,0,3,0,7,0,3,1,3,0,3,1,4,0,3,1,5,0,3,1,6,0,3,1,7,0,3,2,3,0,3,2,4,0,3,2,5,0,3,2,6,0,3,2,7,0,3,3,3,0,3,3,4,0,3,3,5,0,3,3,6,0,3,-1,-4,0,3,-1,-3,0,3,-1,-2,0,3,-1,-1,0,3,-1,0,0,3,0,-4,0,3,0,-3,0,3,0,-2,0,3,0,-1,0,3,0,0,0,3,1,-4,0,3,1,-3,0,3,1,-2,0,3,1,-1,0,3,1,0,0,3,2,-4,0,3,2,-3,0,3,2,-2,0,3,2,-1,0,3,2,0,0,3,3,-4,0,3,3,-3,0,3,3,-2,0,3,3,-1,0,3,3,0,0,3,4,-4,0,3,4,-3,0,3,4,-2,0,3,4,-1,0,3,4,0,0,3,5,-4,0,3,5,-3,0,3,5,-1,0,3,3,1,0,3,3,2,0,3,4,1,0,3,4,2,0,3,4,3,0,3,4,4,0,3,5,3,0,3,5,4,0,3,6,3,0,3,6,4,0,3,6,-3,0,3,7,-3,0,3,7,-2,0,3,7,2,0,3,7,3,0,3,7,4,0,3,8,-3,0,3,8,-2,0,3,8,-1,0,3,8,0,0,3,8,1,0,3,8,2,0,3,8,3,0,3,8,4,0,3,-1,2,0,3,0,2,0,3,1,2,0,3,2,2,0,3,2,1,0,3,1,1,0,3,0,1,0,3,-1,1,0,3,-1,5,0,3,0,5,0,3,0,6,0,3,-1,6,0,3,-7,-3,0,3,6,-2,0,3,5,-2,0,3,8,5,0,3,8,6,0,3,8,7,0,3,-3,-5,0,3,-3,-6,0,3,5,-6,0,3,5,-5,0,3,5,-7,0,3,-3,-7,0,3,5,-8,0,3,4,-8,0,3,3,-8,0,3,2,-8,0,3,1,-8,0,3,0,-8,0,3,-1,-8,0,3,-2,-8,0,3,-3,-8,0,3,3,7,0,3],"CustomFloor1":[-4,2,1,7,14,-3,3,1,8,15,-4,3,1,7,15,-5,3,1,6,15,6,4,1,8,15,5,4,1,7,15,-5,2,1,6,14,4,3,1,6,14,4,4,1,6,15,6,3,1,8,14,5,3,1,7,14,-3,2,1,8,14],"CustomFloor2":[],"CustomFloor3":[],"CustomMiddle1":[-3,4,1,10,5,-3,5,1,10,6,2,4,1,10,5,2,5,1,10,6],"CustomMiddle2":[5,-4,1,6,0,5,-3,1,6,1,-2,-1,1,5,0,-2,0,1,5,1],"CustomTop":[]}

View File

@ -0,0 +1 @@
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[]]}]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cugykjrqe8wil"
path="res://.godot/imported/Preview.png-d591ad3d03347a3f1bfee6cb6974156c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/map/tileMaps/Test1/reward/Reward1/Preview.png"
dest_files=["res://.godot/imported/Preview.png-d591ad3d03347a3f1bfee6cb6974156c.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@ -0,0 +1 @@
{"Position":{"X":-2,"Y":-5},"Size":{"X":10,"Y":11},"DoorAreaInfos":[],"GroupName":"Test1","RoomType":16,"RoomName":"Reward1","Weight":100,"Remark":""}

View File

@ -0,0 +1 @@
{"NavigationVertices":[{"X":90,"Y":74},{"X":6,"Y":74},{"X":6,"Y":-26},{"X":90,"Y":-26}],"NavigationPolygon":[[0,1,2,3]],"Floor":[0,-2,0,3,0,-1,0,3,0,0,0,3,0,1,0,3,0,2,0,3,0,3,0,3,1,-2,0,3,1,-1,0,3,1,0,0,3,1,1,0,3,1,2,0,3,1,3,0,3,2,-2,0,3,2,-1,0,3,2,0,0,3,2,1,0,3,2,2,0,3,2,3,0,3,3,-2,0,3,3,-1,0,3,3,0,0,3,3,1,0,3,3,2,0,3,3,3,0,3,4,-2,0,3,4,-1,0,3,4,0,0,3,4,1,0,3,4,2,0,3,4,3,0,3,5,-2,0,3,5,-1,0,3,5,0,0,3,5,1,0,3,5,2,0,3,5,3,0,3],"CustomFloor1":[1,-2,2,2,6,1,-1,2,4,8,0,-1,2,1,7,0,-2,2,1,6,1,0,2,3,7,0,0,2,1,7,1,1,2,3,7,0,1,2,1,7,1,2,2,4,9,0,2,2,1,7,1,3,2,2,8,0,3,2,1,8,2,2,2,2,6,2,3,2,2,8,3,2,2,2,6,3,3,2,2,8,4,2,2,5,9,4,3,2,2,8,5,2,2,3,7,5,3,2,3,8,5,1,2,3,7,4,1,2,1,7,5,0,2,3,7,4,0,2,1,7,5,-1,2,3,7,4,-1,2,5,8,5,-2,2,3,6,4,-2,2,2,6,3,-1,2,2,8,3,-2,2,2,6,2,-1,2,2,8,2,-2,2,2,6],"CustomFloor2":[],"CustomFloor3":[],"CustomMiddle1":[],"CustomMiddle2":[],"CustomTop":[]}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 854 B

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 764 B

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 B

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 482 B

View File

@ -1,14 +0,0 @@
[gd_resource type="SpriteFrames" load_steps=2 format=3 uid="uid://cvosq47nbdnus"]
[ext_resource type="Texture2D" uid="uid://cu0wlvrbntvyd" path="res://resource/sprite/prop/active/ActiveProp5000.png" id="1_mkqgb"]
[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_mkqgb")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]

View File

@ -1,14 +0,0 @@
[gd_resource type="SpriteFrames" load_steps=2 format=3 uid="uid://bbjyakayescy5"]
[ext_resource type="Texture2D" uid="uid://fby848tbodc" path="res://resource/sprite/prop/active/ActiveProp5001.png" id="1_1xlxo"]
[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_1xlxo")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=50 format=3 uid="uid://c2hynqudkykxl"]
[gd_scene load_steps=52 format=3 uid="uid://c2hynqudkykxl"]
[ext_resource type="PackedScene" uid="uid://bqf2vks5ggnsp" path="res://scene/Dungeon.tscn" id="1_31od0"]
[ext_resource type="Script" path="res://src/game/hall/Hall.cs" id="2_43fdu"]
@ -44,6 +44,8 @@
[ext_resource type="Texture2D" uid="uid://jrkqwsh08jpb" path="res://resource/sprite/item/hall_c/item _09.png" id="47_l5708"]
[ext_resource type="Texture2D" uid="uid://pkmc2lhvnejo" path="res://resource/sprite/item/hall_b/item-17.png" id="47_mf13m"]
[ext_resource type="Texture2D" uid="uid://n28j32tve2e0" path="res://resource/sprite/item/hall_b/item-20.png" id="48_2erjm"]
[ext_resource type="Texture2D" uid="uid://i1qpk06s6a4q" path="res://resource/sprite/item/hall_c/item _14.png" id="48_sfnvr"]
[ext_resource type="Texture2D" uid="uid://blusrop7675k4" path="res://resource/sprite/item/hall_c/item _02.png" id="49_06fin"]
[ext_resource type="Texture2D" uid="uid://w3uubg6lwsjl" path="res://resource/sprite/item/hall_b/item-21.png" id="49_j5ytr"]
[ext_resource type="Texture2D" uid="uid://ms8v1g1nhqv3" path="res://resource/sprite/item/hall_c/item _07.png" id="49_yocgq"]
[ext_resource type="Texture2D" uid="uid://rrxkyras3kdw" path="res://resource/sprite/item/hall_c/item _12.png" id="52_1n1p3"]
@ -91,14 +93,14 @@ position = Vector2(536, 310)
[node name="DungeonEntrance" type="Area2D" parent="." index="4"]
z_index = 15
position = Vector2(461, 209)
position = Vector2(346, 179)
collision_layer = 0
collision_mask = 8
monitorable = false
script = ExtResource("3_t3my6")
[node name="CollisionShape2D" type="CollisionShape2D" parent="DungeonEntrance" index="0"]
position = Vector2(5, -73)
position = Vector2(118, -41)
shape = SubResource("RectangleShape2D_ru8u4")
[node name="ItemRoot" type="Node2D" parent="." index="5"]
@ -154,7 +156,7 @@ position = Vector2(18, -2)
texture = ExtResource("8_61dkg")
[node name="Item0017" type="Node2D" parent="ItemRoot" index="4"]
position = Vector2(863, 352)
position = Vector2(847, 355)
script = ExtResource("5_lowqi")
Id = "item_0017"
DefaultLayer = 1
@ -205,12 +207,12 @@ texture = ExtResource("12_agfji")
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0002" index="1"]
material = SubResource("ShaderMaterial_i7git")
position = Vector2(-1, -15)
position = Vector2(0, -15)
scale = Vector2(1, -1)
texture = ExtResource("15_1xqxd")
[node name="Item0003" type="Node2D" parent="ItemRoot" index="8"]
position = Vector2(542, 226)
position = Vector2(658, 154)
script = ExtResource("5_lowqi")
Id = "item_0003"
DefaultLayer = 1
@ -232,13 +234,14 @@ Id = "item_0005"
DefaultLayer = 1
[node name="Item0036" type="Node2D" parent="ItemRoot" index="11"]
position = Vector2(983, 312)
position = Vector2(959, 353)
scale = Vector2(1.04988, 0.889278)
script = ExtResource("5_lowqi")
Id = "item_0036"
DefaultLayer = 1
[node name="Item0054" type="Node2D" parent="ItemRoot" index="12"]
position = Vector2(1005, 480)
position = Vector2(313, 235)
script = ExtResource("5_lowqi")
Id = "item_0054"
DefaultLayer = 1
@ -375,13 +378,13 @@ Id = "item_0025"
DefaultLayer = 1
[node name="Item0056" type="Node2D" parent="ItemRoot" index="31"]
position = Vector2(906, 235)
position = Vector2(776, 253)
script = ExtResource("5_lowqi")
Id = "item_0056"
DefaultLayer = 1
[node name="Item0026" type="Node2D" parent="ItemRoot" index="32"]
position = Vector2(469, 234)
position = Vector2(380, 251)
script = ExtResource("5_lowqi")
Id = "item_0026"
DefaultLayer = 1
@ -402,35 +405,35 @@ position = Vector2(17, -116)
texture = ExtResource("20_gxw54")
[node name="Item24" type="Sprite2D" parent="Node2D" index="3"]
position = Vector2(88, -76)
position = Vector2(9, -3)
texture = ExtResource("21_svc76")
[node name="Item27" type="Sprite2D" parent="Node2D" index="4"]
position = Vector2(65, -39)
position = Vector2(-14, 34)
texture = ExtResource("22_7bbkr")
[node name="Item29" type="Sprite2D" parent="Node2D" index="5"]
position = Vector2(35, -121)
position = Vector2(10, -75)
texture = ExtResource("23_kydek")
[node name="Item32" type="Sprite2D" parent="Node2D" index="6"]
position = Vector2(-59.5, -65.5)
position = Vector2(-59, -61)
texture = ExtResource("25_fsrqa")
[node name="Item19" type="Sprite2D" parent="Node2D" index="7"]
position = Vector2(48, -24)
position = Vector2(56, -14)
texture = ExtResource("26_bae0v")
[node name="Item15" type="Sprite2D" parent="Node2D" index="8"]
position = Vector2(-74, -233)
position = Vector2(-1, -227)
texture = ExtResource("27_gaatx")
[node name="Item16" type="Sprite2D" parent="Node2D" index="9"]
position = Vector2(-72, -1)
position = Vector2(134, -197)
texture = ExtResource("28_1l3ls")
[node name="Item59" type="Sprite2D" parent="Node2D" index="10"]
position = Vector2(-86, -36)
position = Vector2(-353, -170)
texture = ExtResource("29_4dx8t")
[node name="Item23" type="Sprite2D" parent="Node2D" index="11"]
@ -475,7 +478,7 @@ position = Vector2(-458, -324)
texture = ExtResource("45_7i1j7")
[node name="Item-17" type="Sprite2D" parent="Node2D" index="20"]
position = Vector2(-289, -195)
position = Vector2(-201, -206)
texture = ExtResource("47_mf13m")
[node name="Item-20" type="Sprite2D" parent="Node2D" index="21"]
@ -496,7 +499,7 @@ texture = ExtResource("49_j5ytr")
[node name="Item06" type="Sprite2D" parent="Node2D" index="25"]
z_index = -1
position = Vector2(-13, -151)
position = Vector2(-73, -135)
texture = ExtResource("7_42rdc")
[node name="Item07" type="Sprite2D" parent="Node2D" index="26"]
@ -504,7 +507,7 @@ position = Vector2(-110, 19)
texture = ExtResource("49_yocgq")
[node name="Item12" type="Sprite2D" parent="Node2D" index="27"]
position = Vector2(58, -103)
position = Vector2(-101, -75)
texture = ExtResource("52_1n1p3")
flip_h = true
@ -516,3 +519,12 @@ texture = ExtResource("13_swsmq")
[node name="Item09" type="Sprite2D" parent="." index="7"]
position = Vector2(919, 384)
texture = ExtResource("47_l5708")
[node name="Item14" type="Sprite2D" parent="." index="8"]
position = Vector2(262, 487)
texture = ExtResource("48_sfnvr")
[node name="Item02" type="Sprite2D" parent="." index="9"]
z_index = -1
position = Vector2(896, 216)
texture = ExtResource("49_06fin")

View File

@ -34,13 +34,36 @@ public static partial class ExcelConfig
public Dictionary<string, float[]> Buff;
/// <summary>
/// 使用完成后是否自动销毁
/// 道具使用条件 <br/>
/// 参数配置方式与buff字段相同 <br/>
/// 性名称请参阅condition属性表
/// </summary>
[JsonInclude]
public bool AutoDestroy;
public Dictionary<string, float[]> Condition;
/// <summary>
/// 最大叠加次数
/// 道具使用效果 <br/>
/// 参数配置方式与buff字段相同 <br/>
/// 性名称请参阅effect属性表
/// </summary>
[JsonInclude]
public Dictionary<string, float[]> Effect;
/// <summary>
/// 使用一次后的冷却时间 <br/>
/// 单位: 秒
/// </summary>
[JsonInclude]
public float CooldownTime;
/// <summary>
/// 是否是消耗品, 如果为true, 则每次使用都会消耗叠加数量
/// </summary>
[JsonInclude]
public bool IsConsumables;
/// <summary>
/// 最大叠加次数, 仅当IsConsumables为true时有效
/// </summary>
[JsonInclude]
public uint MaxCount;
@ -55,7 +78,10 @@ public static partial class ExcelConfig
inst.Remark = Remark;
inst.Activity = Activity;
inst.Buff = Buff;
inst.AutoDestroy = AutoDestroy;
inst.Condition = Condition;
inst.Effect = Effect;
inst.CooldownTime = CooldownTime;
inst.IsConsumables = IsConsumables;
inst.MaxCount = MaxCount;
return inst;
}

View File

@ -91,7 +91,7 @@ public partial class GameApplication : Node2D, ICoroutine
//初始化配置表
ExcelConfig.Init();
PreinstallMarkManager.Init();
BuffRegister.Init();
PropFragmentRegister.Init();
//初始化房间配置数据
InitRoomConfig();
//初始化TileSet配置数据
@ -102,6 +102,8 @@ public partial class GameApplication : Node2D, ICoroutine
Enemy.InitEnemyAttribute();
//初始化buff数据
BuffProp.InitBuffAttribute();
//初始化主动道具数据
ActiveProp.InitActiveAttribute();
DungeonConfig = new DungeonConfig();
DungeonConfig.GroupName = "Test1";

View File

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using Config;
using Godot;
/// <summary>
@ -8,6 +10,11 @@ using Godot;
[Tool]
public partial class ActiveProp : PropActivity, IPackageItem<Role>
{
/// <summary>
/// 配置数据
/// </summary>
public ExcelConfig.ActivePropBase Attribute { get; private set; }
public int PackageIndex { get; set; }
/// <summary>
@ -52,17 +59,7 @@ public partial class ActiveProp : PropActivity, IPackageItem<Role>
}
private int _maxCount = 1;
/// <summary>
/// 使用一次后的冷却时间, 单位: 秒
/// </summary>
public float CooldownTime { get; set; } = 2f;
/// <summary>
/// 当道具使用完后是否自动销毁
/// </summary>
public bool AutoDestroy { get; set; } = false;
/// <summary>
/// 道具充能进度, 必须要充能完成才能使用, 值范围: 0 - 1
/// </summary>
@ -89,21 +86,192 @@ public partial class ActiveProp : PropActivity, IPackageItem<Role>
//冷却计时器
private float _cooldownTimer = 0;
//被动属性
private readonly List<BuffFragment> _buffFragment = new List<BuffFragment>();
//条件
private readonly List<ConditionFragment> _conditionFragment = new List<ConditionFragment>();
//效果
private readonly List<EffectFragment> _effectFragment = new List<EffectFragment>();
public override void OnInit()
{
base.OnInit();
var buffAttribute = GetActiveAttribute(ActivityBase.Id);
Attribute = buffAttribute;
//初始化buff属性
if (buffAttribute.Buff != null)
{
foreach (var keyValuePair in buffAttribute.Buff)
{
var buffInfo = PropFragmentRegister.BuffFragmentInfos[keyValuePair.Key];
var item = keyValuePair.Value;
switch (item.Length)
{
case 0:
{
var buff = (BuffFragment)AddComponent(buffInfo.Type);
_buffFragment.Add(buff);
}
break;
case 1:
{
var buff = (BuffFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0]);
_buffFragment.Add(buff);
}
break;
case 2:
{
var buff = (BuffFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0], item[1]);
_buffFragment.Add(buff);
}
break;
case 3:
{
var buff = (BuffFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0], item[1], item[2]);
_buffFragment.Add(buff);
}
break;
case 4:
{
var buff = (BuffFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0], item[1], item[2], item[3]);
_buffFragment.Add(buff);
}
break;
}
}
}
//初始化条件属性
if (buffAttribute.Condition != null)
{
foreach (var keyValuePair in buffAttribute.Condition)
{
var buffInfo = PropFragmentRegister.ConditionFragmentInfos[keyValuePair.Key];
var item = keyValuePair.Value;
switch (item.Length)
{
case 0:
{
var buff = (ConditionFragment)AddComponent(buffInfo.Type);
_conditionFragment.Add(buff);
}
break;
case 1:
{
var buff = (ConditionFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0]);
_conditionFragment.Add(buff);
}
break;
case 2:
{
var buff = (ConditionFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0], item[1]);
_conditionFragment.Add(buff);
}
break;
case 3:
{
var buff = (ConditionFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0], item[1], item[2]);
_conditionFragment.Add(buff);
}
break;
case 4:
{
var buff = (ConditionFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0], item[1], item[2], item[3]);
_conditionFragment.Add(buff);
}
break;
}
}
}
//初始化效果属性
if (buffAttribute.Effect != null)
{
foreach (var keyValuePair in buffAttribute.Effect)
{
var buffInfo = PropFragmentRegister.EffectFragmentInfos[keyValuePair.Key];
var item = keyValuePair.Value;
switch (item.Length)
{
case 0:
{
var buff = (EffectFragment)AddComponent(buffInfo.Type);
_effectFragment.Add(buff);
}
break;
case 1:
{
var buff = (EffectFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0]);
_effectFragment.Add(buff);
}
break;
case 2:
{
var buff = (EffectFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0], item[1]);
_effectFragment.Add(buff);
}
break;
case 3:
{
var buff = (EffectFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0], item[1], item[2]);
_effectFragment.Add(buff);
}
break;
case 4:
{
var buff = (EffectFragment)AddComponent(buffInfo.Type);
buff.InitParam(item[0], item[1], item[2], item[3]);
_effectFragment.Add(buff);
}
break;
}
}
}
//显示纹理
if (!string.IsNullOrEmpty(ActivityBase.Icon))
{
SetDefaultTexture(ResourceManager.LoadTexture2D(ActivityBase.Icon));
}
MaxCount = (int)Attribute.MaxCount;
}
/// <summary>
/// 当检测是否可以使用时调用
/// </summary>
public virtual bool OnCheckUse()
{
foreach (var fragment in _conditionFragment)
{
if (!fragment.OnCheckUse()) return false;
}
return true;
}
/// <summary>
/// 当道具被使用时调用, 函数返回值为消耗数量
/// 当道具被使用时调用
/// </summary>
protected virtual int OnUse()
protected virtual void OnUse()
{
return 1;
foreach (var fragment in _effectFragment)
{
fragment.OnUse();
}
}
/// <summary>
@ -173,7 +341,7 @@ public partial class ActiveProp : PropActivity, IPackageItem<Role>
//检测是否达到自动销毁的条件
private bool CheckAutoDestroy()
{
if (Count == 0 && AutoDestroy) //用光了, 自动销毁
if (Count == 0 && Attribute.IsConsumables) //用光了, 自动销毁
{
if (Master != null)
{
@ -205,14 +373,14 @@ public partial class ActiveProp : PropActivity, IPackageItem<Role>
}
if (CheckUse()) //可以使用道具
{
var num = OnUse();
if (num != 0)
OnUse();
if (Attribute.IsConsumables)
{
Count -= num;
Count -= 1;
}
//冷却计时器
_cooldownTimer = CooldownTime;
_cooldownTimer = Attribute.CooldownTime;
}
}
@ -226,7 +394,7 @@ public partial class ActiveProp : PropActivity, IPackageItem<Role>
return 1;
}
return (CooldownTime - _cooldownTimer) / CooldownTime;
return (Attribute.CooldownTime - _cooldownTimer) / Attribute.CooldownTime;
}
public override void Interactive(ActivityObject master)
@ -309,10 +477,18 @@ public partial class ActiveProp : PropActivity, IPackageItem<Role>
public override void OnPickUpItem()
{
foreach (var buffFragment in _buffFragment)
{
buffFragment.OnPickUpItem();
}
}
public override void OnRemoveItem()
{
foreach (var buffFragment in _buffFragment)
{
buffFragment.OnRemoveItem();
}
}
public virtual void OnActiveItem()
@ -327,4 +503,119 @@ public partial class ActiveProp : PropActivity, IPackageItem<Role>
{
Master.ThrowActiveProp(PackageIndex);
}
/// <summary>
/// 添加被动属性
/// </summary>
public void AddBuffFragment<T>() where T : BuffFragment, new()
{
var fragment = AddComponent<T>();
_buffFragment.Add(fragment);
if (Master != null)
{
fragment.OnPickUpItem();
}
}
/// <summary>
/// 添加被动属性
/// </summary>
public void AddBuffFragment<T>(float arg1) where T : BuffFragment, new()
{
var fragment = AddComponent<T>();
_buffFragment.Add(fragment);
fragment.InitParam(arg1);
if (Master != null)
{
fragment.OnPickUpItem();
}
}
/// <summary>
/// 添加被动属性
/// </summary>
public void AddBuffFragment<T>(float arg1, float arg2) where T : BuffFragment, new()
{
var fragment = AddComponent<T>();
_buffFragment.Add(fragment);
fragment.InitParam(arg1, arg2);
if (Master != null)
{
fragment.OnPickUpItem();
}
}
/// <summary>
/// 添加被动属性
/// </summary>
public void AddBuffFragment<T>(float arg1, float arg2, float arg3) where T : BuffFragment, new()
{
var fragment = AddComponent<T>();
_buffFragment.Add(fragment);
fragment.InitParam(arg1, arg2, arg3);
if (Master != null)
{
fragment.OnPickUpItem();
}
}
/// <summary>
/// 添加被动属性
/// </summary>
public void AddBuffFragment<T>(float arg1, float arg2, float arg3, float arg4) where T : BuffFragment, new()
{
var fragment = AddComponent<T>();
_buffFragment.Add(fragment);
fragment.InitParam(arg1, arg2, arg3, arg4);
if (Master != null)
{
fragment.OnPickUpItem();
}
}
private static bool _init = false;
private static Dictionary<string, ExcelConfig.ActivePropBase> _activeAttributeMap =
new Dictionary<string, ExcelConfig.ActivePropBase>();
/// <summary>
/// 初始化主动道具属性数据
/// </summary>
public static void InitActiveAttribute()
{
if (_init)
{
return;
}
_init = true;
foreach (var buffAttr in ExcelConfig.ActivePropBase_List)
{
if (buffAttr.Activity != null)
{
if (!_activeAttributeMap.TryAdd(buffAttr.Activity.Id, buffAttr))
{
Debug.LogError("发现重复注册的主动道具属性: " + buffAttr.Id);
}
}
}
}
/// <summary>
/// 根据 ActivityBase.Id 获取对应主动道具的属性数据
/// </summary>
public static ExcelConfig.ActivePropBase GetActiveAttribute(string itemId)
{
if (itemId == null)
{
return null;
}
if (_activeAttributeMap.TryGetValue(itemId, out var attr))
{
return attr;
}
throw new Exception($"主动道具'{itemId}'没有在 ActivePropBase 表中配置属性数据!");
}
}

View File

@ -10,6 +10,11 @@ using Godot;
[Tool]
public partial class BuffProp : PropActivity
{
/// <summary>
/// 配置数据
/// </summary>
public ExcelConfig.BuffPropBase Attribute { get; private set; }
//被动属性
private readonly List<BuffFragment> _buffFragment = new List<BuffFragment>();
@ -17,12 +22,13 @@ public partial class BuffProp : PropActivity
{
base.OnInit();
var buffAttribute = GetBuffAttribute(ActivityBase.Id);
if (buffAttribute != null)
Attribute = buffAttribute;
//初始化buff属性
if (buffAttribute.Buff != null)
{
//初始化buff属性
foreach (var keyValuePair in buffAttribute.Buff)
{
var buffInfo = BuffRegister.BuffInfos[keyValuePair.Key];
var buffInfo = PropFragmentRegister.BuffFragmentInfos[keyValuePair.Key];
var item = keyValuePair.Value;
switch (item.Length)
{
@ -62,11 +68,12 @@ public partial class BuffProp : PropActivity
break;
}
}
//显示纹理
if (!string.IsNullOrEmpty(ActivityBase.Icon))
{
SetDefaultTexture(ResourceManager.LoadTexture2D(ActivityBase.Icon));
}
}
//显示纹理
if (!string.IsNullOrEmpty(ActivityBase.Icon))
{
SetDefaultTexture(ResourceManager.LoadTexture2D(ActivityBase.Icon));
}
}
@ -215,6 +222,6 @@ public partial class BuffProp : PropActivity
return attr;
}
throw new Exception($"buff'{itemId}'没有在 BuffBase 表中配置属性数据!");
throw new Exception($"buff'{itemId}'没有在 BuffPropBase 表中配置属性数据!");
}
}

View File

@ -1,27 +0,0 @@

using Godot;
/// <summary>
/// 医药箱, 使用后恢复一颗红心
/// </summary>
[Tool]
public partial class ActiveProp5000 : ActiveProp
{
public override void OnInit()
{
base.OnInit();
AutoDestroy = true;
MaxCount = 10;
}
public override bool OnCheckUse()
{
return !Master.IsHpFull();
}
protected override int OnUse()
{
Master.Hp += 2;
return 1;
}
}

View File

@ -1,33 +0,0 @@

using Godot;
/// <summary>
/// 弹药箱, 使用后补全当前武器备用弹药
/// </summary>
[Tool]
public partial class ActiveProp5001 : ActiveProp
{
public override void OnInit()
{
base.OnInit();
AutoDestroy = true;
MaxCount = 10;
}
public override bool OnCheckUse()
{
return Master.WeaponPack.ActiveItem != null && !Master.WeaponPack.ActiveItem.IsAmmoFull();
}
protected override int OnUse()
{
var weapon = Master.WeaponPack.ActiveItem;
if (weapon != null)
{
weapon.SetTotalAmmo(weapon.Attribute.MaxAmmoCapacity);
return 1;
}
return 0;
}
}

View File

@ -45,6 +45,11 @@ public abstract partial class Weapon : ActivityObject, IPackageItem<Role>
/// 剩余弹药量(备用弹药)
/// </summary>
public int ResidueAmmo { get; private set; }
/// <summary>
/// 总弹药量(备用弹药 + 当前弹夹弹药)
/// </summary>
public int TotalAmmon => CurrAmmo + ResidueAmmo;
/// <summary>
/// 武器管的开火点

View File

@ -4,13 +4,8 @@ using System;
/// <summary>
/// 被动属性逻辑基类
/// </summary>
public abstract class BuffFragment : Component<BuffProp>
public abstract class BuffFragment : PropFragment
{
/// <summary>
/// 所属角色对象
/// </summary>
public Role Role => Master?.Master;
/// <summary>
/// 当道具被拾起时调用 (在 Master 赋值之后调用)
/// </summary>
@ -20,36 +15,4 @@ public abstract class BuffFragment : Component<BuffProp>
/// 当道具被移除时调用 (在 Master 置为 null 之前调用)
/// </summary>
public abstract void OnRemoveItem();
/// <summary>
/// 初始化被动属性参数
/// </summary>
public virtual void InitParam(float arg1)
{
Debug.LogError($"'{GetType().FullName}'为实现1参数初始化函数!");
}
/// <summary>
/// 初始化被动属性参数
/// </summary>
public virtual void InitParam(float arg1, float arg2)
{
Debug.LogError($"'{GetType().FullName}'为实现2参数初始化函数!");
}
/// <summary>
/// 初始化被动属性参数
/// </summary>
public virtual void InitParam(float arg1, float arg2, float arg3)
{
Debug.LogError($"'{GetType().FullName}'为实现4参数初始化函数!");
}
/// <summary>
/// 初始化被动属性参数
/// </summary>
public virtual void InitParam(float arg1, float arg2, float arg3, float arg4)
{
Debug.LogError($"'{GetType().FullName}'为实现4参数初始化函数!");
}
}

View File

@ -1,7 +1,7 @@
using System;
[AttributeUsage(AttributeTargets.Class)]
public class BuffAttribute : Attribute
public class BuffFragmentAttribute : Attribute
{
/// <summary>
/// Buff属性名称
@ -13,7 +13,7 @@ public class BuffAttribute : Attribute
/// </summary>
public string Description { get; set; }
public BuffAttribute(string buffName, string description)
public BuffFragmentAttribute(string buffName, string description)
{
BuffName = buffName;
Description = description;

View File

@ -0,0 +1,11 @@
/// <summary>
/// 主动道具使用条件基类
/// </summary>
public abstract class ConditionFragment : PropFragment
{
/// <summary>
/// 当检测是否可以使用时调用
/// </summary>
public abstract bool OnCheckUse();
}

View File

@ -0,0 +1,22 @@
using System;
[AttributeUsage(AttributeTargets.Class)]
public class ConditionFragmentAttribute : Attribute
{
/// <summary>
/// 条件名称
/// </summary>
public string ConditionName { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
public ConditionFragmentAttribute(string conditionName, string description)
{
ConditionName = conditionName;
Description = description;
}
}

View File

@ -0,0 +1,11 @@
/// <summary>
/// 主动道具使用效果基类
/// </summary>
public abstract class EffectFragment : PropFragment
{
/// <summary>
/// 使用道具的回调
/// </summary>
public abstract void OnUse();
}

View File

@ -0,0 +1,21 @@
using System;
[AttributeUsage(AttributeTargets.Class)]
public class EffectFragmentAttribute : Attribute
{
/// <summary>
/// 效果名称
/// </summary>
public string EffectName { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
public EffectFragmentAttribute(string effectName, string description)
{
EffectName = effectName;
Description = description;
}
}

View File

@ -0,0 +1,43 @@
/// <summary>
/// 道具逻辑片段组件
/// </summary>
public abstract class PropFragment : Component<PropActivity>
{
/// <summary>
/// 所属角色对象
/// </summary>
public Role Role => Master?.Master;
/// <summary>
/// 初始化被动属性参数
/// </summary>
public virtual void InitParam(float arg1)
{
Debug.LogError($"'{GetType().FullName}'为实现1参数初始化函数!");
}
/// <summary>
/// 初始化被动属性参数
/// </summary>
public virtual void InitParam(float arg1, float arg2)
{
Debug.LogError($"'{GetType().FullName}'为实现2参数初始化函数!");
}
/// <summary>
/// 初始化被动属性参数
/// </summary>
public virtual void InitParam(float arg1, float arg2, float arg3)
{
Debug.LogError($"'{GetType().FullName}'为实现4参数初始化函数!");
}
/// <summary>
/// 初始化被动属性参数
/// </summary>
public virtual void InitParam(float arg1, float arg2, float arg3, float arg4)
{
Debug.LogError($"'{GetType().FullName}'为实现4参数初始化函数!");
}
}

View File

@ -1,5 +1,5 @@
[Buff("ActivePropsCapacity", "主动道具背包容量 buff, 参数1为主动道具背包增加的容量")]
[BuffFragment("ActivePropsCapacity", "主动道具背包容量 buff, 参数1为主动道具背包增加的容量")]
public class Buff_ActivePropsCapacity : BuffFragment
{
private int _value;

View File

@ -1,5 +1,5 @@
[Buff("BulletBounceCount", "子弹弹射数量 buff, 参数1为增加的弹射次数")]
[BuffFragment("BulletBounceCount", "子弹弹射数量 buff, 参数1为增加的弹射次数")]
public class Buff_BulletBounceCount : BuffFragment
{
private int _value;

View File

@ -1,7 +1,7 @@
using Godot;
[Buff("BulletCount",
[BuffFragment("BulletCount",
"子弹数量 buff, " +
"参数1为子弹数量添加类型, 1: 具体数量, 2:百分比(小数), " +
"参数2为增加子弹的数量")]

View File

@ -1,11 +1,11 @@
using Godot;
[Buff("Damage",
"提升伤害buff, " +
[BuffFragment("BulletDamage",
"提升子弹伤害buff, " +
"参数1为伤害增加类型: 1:具体伤害, 2:百分比伤害(小数), " +
"参数2为增益伤害值")]
public class Buff_Damage : BuffFragment
public class Buff_BulletDamage : BuffFragment
{
private int _type;
private float _value;
@ -42,11 +42,19 @@ public class Buff_Damage : BuffFragment
private void CalcDamage1(int originDamage, RefValue<int> refValue)
{
if (Role.WeaponPack.ActiveItem != null && Role.WeaponPack.ActiveItem.Attribute.IsMelee)
{
return;
}
refValue.Value += Mathf.CeilToInt(_value);
}
private void CalcDamage2(int originDamage, RefValue<int> refValue)
{
if (Role.WeaponPack.ActiveItem != null && Role.WeaponPack.ActiveItem.Attribute.IsMelee)
{
return;
}
if (_value > 0)
{
refValue.Value += Mathf.CeilToInt(originDamage * _value);

View File

@ -1,5 +1,5 @@
[Buff("BulletDeviationAngle",
[BuffFragment("BulletDeviationAngle",
"子弹偏移角度 buff, " +
"参数1为增加子弹偏移角度下限, " +
"参数2为增加子弹偏移角度上限, 单位角度制, 会从上限和下限随机抽取值")]

View File

@ -1,5 +1,5 @@
[Buff("BulletDistance",
[BuffFragment("BulletDistance",
"子弹射程 buff, " +
"参数1为射程增加类型: 1:具体射程, 2:百分比射程(小数), " +
"参数2为子弹增加的射程值")]

View File

@ -1,5 +1,5 @@
[Buff("BulletPenetration", "子弹穿透次数 buff, 参数1为增加的穿透次数")]
[BuffFragment("BulletPenetration", "子弹穿透次数 buff, 参数1为增加的穿透次数")]
public class Buff_BulletPenetration : BuffFragment
{
private int _value;

View File

@ -1,7 +1,7 @@
using Godot;
[Buff("BulletRepel",
[BuffFragment("BulletRepel",
"子弹击退 buff, " +
"参数1为击退增加类型: 1:具体击退值, 2:百分比击退值(小数), " +
"参数2为子弹增加的击退值")]

View File

@ -1,5 +1,5 @@
[Buff("BulletSpeed",
[BuffFragment("BulletSpeed",
"子弹速度 buff, " +
"参数1为射速增加类型: 1:具体射速, 2:百分比射速(小数), " +
"参数2为子弹增加的射速值")]

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
[Buff("MaxHp", "血量上限 buff, 参数1为血量上限值")]
[BuffFragment("MaxHp", "血量上限 buff, 参数1为血量上限值")]
public class Buff_MaxHp : BuffFragment
{
private List<ulong> _cacheId = new List<ulong>();

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
[Buff("MaxShield", "护盾上限buff, 参数1为护盾上限")]
[BuffFragment("MaxShield", "护盾上限buff, 参数1为护盾上限")]
public class Buff_MaxShield : BuffFragment
{
private List<ulong> _cacheId = new List<ulong>();

View File

@ -1,5 +1,5 @@
[Buff("MoveSpeed", "移速 buff, 参数1为移动速度值")]
[BuffFragment("MoveSpeed", "移速 buff, 参数1为移动速度值")]
public class Buff_MoveSpeed : BuffFragment
{
private float _moveSpeed;

View File

@ -1,5 +1,5 @@
[Buff("OffsetInjury", "受伤时有概率抵消伤害的buff, 参数1为抵消伤害概率百分比(小数)")]
[BuffFragment("OffsetInjury", "受伤时有概率抵消伤害的buff, 参数1为抵消伤害概率百分比(小数)")]
public class Buff_OffsetInjury : BuffFragment
{
private float _value;

View File

@ -1,5 +1,5 @@
[Buff("RandomBulletSpeed",
[BuffFragment("RandomBulletSpeed",
"子弹增加随机速度 buff, " +
"参数1为增加子弹速度下限, " +
"参数2为增加子弹速度上限, 会从上限和下限随机抽取值")]

View File

@ -1,7 +1,7 @@
using Godot;
[Buff("Scattering", "提高武器精准度buff, 参数1为提升的精准度百分比值(小数)")]
[BuffFragment("Scattering", "提高武器精准度buff, 参数1为提升的精准度百分比值(小数)")]
public class Buff_Scattering : BuffFragment
{
private float _value;

View File

@ -1,5 +1,5 @@
[Buff("ShieldRecoveryTime", "单格护盾减少的恢复时间, 参数1单位: 秒")]
[BuffFragment("ShieldRecoveryTime", "单格护盾减少的恢复时间, 参数1单位: 秒")]
public class Buff_ShieldRecoveryTime : BuffFragment
{
private float _time;

View File

@ -1,5 +1,5 @@
[Buff("WeaponCapacity", "武器背包容量 buff, 参数1为武器背包增加的容量")]
[BuffFragment("WeaponCapacity", "武器背包容量 buff, 参数1为武器背包增加的容量")]
public class Buff_WeaponCapacity : BuffFragment
{
private int _value;

View File

@ -1,5 +1,5 @@
[Buff("WoundedInvincibleTime", "延长无敌时间buff, 参数1为延长时间, 单位秒")]
[BuffFragment("WoundedInvincibleTime", "延长无敌时间buff, 参数1为延长时间, 单位秒")]
public class Buff_WoundedInvincibleTime : BuffFragment
{
private float _time;

View File

@ -0,0 +1,29 @@
[ConditionFragment("AmmoFull",
"判断当前武器弹药状态, " +
"参数1可选值: 0:判断非满弹药, 1:判断满弹药")]
public class Cond_AmmoFull : ConditionFragment
{
private int _type;
public override void InitParam(float arg1)
{
_type = (int)arg1;
}
public override bool OnCheckUse()
{
if (Role.WeaponPack.ActiveItem == null)
{
return false;
}
if (_type == 0)
{
return !Role.WeaponPack.ActiveItem.IsAmmoFull();
}
else
{
return Role.WeaponPack.ActiveItem.IsAmmoFull();
}
}
}

View File

@ -0,0 +1,25 @@
[ConditionFragment("HpFull",
"判断满血状态, " +
"参数1可选值: 0:判断非满血, 1:判断满血")]
public class Cond_HpFull : ConditionFragment
{
private int _type;
public override void InitParam(float arg1)
{
_type = (int)arg1;
}
public override bool OnCheckUse()
{
if (_type == 0)
{
return !Role.IsHpFull();
}
else
{
return Role.IsHpFull();
}
}
}

View File

@ -0,0 +1,16 @@
[EffectFragment("Hp", "修改血量, 参数1为血量变化的具体值")]
public class Eff_Hp : EffectFragment
{
private int _value;
public override void InitParam(float arg1)
{
_value = (int) arg1;
}
public override void OnUse()
{
Role.Hp += _value;
}
}

View File

@ -0,0 +1,28 @@
[EffectFragment("TotalAmmo",
"修改武器总弹药量, " +
"参数1(选填)为弹药变化的具体值, 如果不传则表示补满弹药")]
public class Eff_TotalAmmo : EffectFragment
{
private bool _initParam = false;
private int _value;
public override void InitParam(float arg1)
{
_initParam = true;
_value = (int) arg1;
}
public override void OnUse()
{
var weapon = Role.WeaponPack.ActiveItem;
if (_initParam)
{
weapon.SetTotalAmmo(weapon.TotalAmmon + _value);
}
else
{
weapon.SetTotalAmmo(weapon.Attribute.MaxAmmoCapacity);
}
}
}

View File

@ -1,45 +0,0 @@
using System;
using System.Collections.Generic;
/// <summary>
/// buff 属性数据
/// </summary>
public class BuffInfo
{
/// <summary>
/// buff 名称
/// </summary>
public string Name;
/// <summary>
/// buff 描述
/// </summary>
public string Description;
/// <summary>
/// buff 可传参数
/// </summary>
public List<int> Params;
/// <summary>
/// buff 类
/// </summary>
public Type Type;
public BuffInfo(string name, string description, Type type)
{
Name = name;
Description = description;
Type = type;
Params = new List<int>();
}
public BuffInfo(string name, string description, List<int> paramsList, Type type)
{
Name = name;
Description = description;
Params = paramsList;
Type = type;
}
}

View File

@ -0,0 +1,30 @@
using System;
/// <summary>
/// 道具逻辑片段数据
/// </summary>
public class PropFragmentInfo
{
/// <summary>
/// buff 名称
/// </summary>
public string Name;
/// <summary>
/// buff 描述
/// </summary>
public string Description;
/// <summary>
/// buff 类
/// </summary>
public Type Type;
public PropFragmentInfo(string name, string description, Type type)
{
Name = name;
Description = description;
Type = type;
}
}

View File

@ -1,37 +0,0 @@
using System.Collections.Generic;
/// <summary>
/// buff 注册类, 调用 Init() 函数初始化数据
/// 注意: 该类为 Tools 面板下自动生成的, 请不要手动编辑!
/// </summary>
public class BuffRegister
{
/// <summary>
/// 所有 buff 信息
/// </summary>
public static Dictionary<string, BuffInfo> BuffInfos { get; private set; }
/// <summary>
/// 初始化 buff
/// </summary>
public static void Init()
{
BuffInfos = new Dictionary<string, BuffInfo>();
BuffInfos.Add("ActivePropsCapacity", new BuffInfo("ActivePropsCapacity", null, new List<int>() { 1 }, typeof(Buff_ActivePropsCapacity)));
BuffInfos.Add("BulletBounceCount", new BuffInfo("BulletBounceCount", null, new List<int>() { 1 }, typeof(Buff_BulletBounceCount)));
BuffInfos.Add("BulletCount", new BuffInfo("BulletCount", null, new List<int>() { 2 }, typeof(Buff_BulletCount)));
BuffInfos.Add("BulletDeviationAngle", new BuffInfo("BulletDeviationAngle", null, new List<int>() { 2 }, typeof(Buff_BulletDeviationAngle)));
BuffInfos.Add("BulletDistance", new BuffInfo("BulletDistance", null, new List<int>() { 2 }, typeof(Buff_BulletDistance)));
BuffInfos.Add("BulletPenetration", new BuffInfo("BulletPenetration", null, new List<int>() { 1 }, typeof(Buff_BulletPenetration)));
BuffInfos.Add("BulletRepel", new BuffInfo("BulletRepel", null, new List<int>() { 2 }, typeof(Buff_BulletRepel)));
BuffInfos.Add("BulletSpeed", new BuffInfo("BulletSpeed", null, new List<int>() { 2 }, typeof(Buff_BulletSpeed)));
BuffInfos.Add("Damage", new BuffInfo("Damage", null, new List<int>() { 2 }, typeof(Buff_Damage)));
BuffInfos.Add("MaxHp", new BuffInfo("MaxHp", null, new List<int>() { 1 }, typeof(Buff_MaxHp)));
BuffInfos.Add("MaxShield", new BuffInfo("MaxShield", null, new List<int>() { 1 }, typeof(Buff_MaxShield)));
BuffInfos.Add("MoveSpeed", new BuffInfo("MoveSpeed", null, new List<int>() { 1 }, typeof(Buff_MoveSpeed)));
BuffInfos.Add("OffsetInjury", new BuffInfo("OffsetInjury", null, new List<int>() { 1 }, typeof(Buff_OffsetInjury)));
BuffInfos.Add("RandomBulletSpeed", new BuffInfo("RandomBulletSpeed", null, new List<int>() { 2 }, typeof(Buff_RandomBulletSpeed)));
BuffInfos.Add("Scattering", new BuffInfo("Scattering", null, new List<int>() { 1 }, typeof(Buff_Scattering)));
BuffInfos.Add("ShieldRecoveryTime", new BuffInfo("ShieldRecoveryTime", null, new List<int>() { 1 }, typeof(Buff_ShieldRecoveryTime)));
BuffInfos.Add("WeaponCapacity", new BuffInfo("WeaponCapacity", null, new List<int>() { 1 }, typeof(Buff_WeaponCapacity)));
BuffInfos.Add("WoundedInvincibleTime", new BuffInfo("WoundedInvincibleTime", null, new List<int>() { 1 }, typeof(Buff_WoundedInvincibleTime)));
}
}

View File

@ -0,0 +1,91 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Godot;
/// <summary>
/// buff 属性注册类, 调用 Init() 函数初始化数据
/// </summary>
public class PropFragmentRegister
{
/// <summary>
/// 所有 buff 属性信息
/// </summary>
public static Dictionary<string, PropFragmentInfo> BuffFragmentInfos { get; private set; }
/// <summary>
/// 所有主动道具条件数据
/// </summary>
public static Dictionary<string, PropFragmentInfo> ConditionFragmentInfos { get; private set; }
/// <summary>
/// 所有主动道具效果数据
/// </summary>
public static Dictionary<string, PropFragmentInfo> EffectFragmentInfos { get; private set; }
/// <summary>
/// 初始化 buff
/// </summary>
public static void Init()
{
BuffFragmentInfos = new Dictionary<string, PropFragmentInfo>();
ConditionFragmentInfos = new Dictionary<string, PropFragmentInfo>();
EffectFragmentInfos = new Dictionary<string, PropFragmentInfo>();
var types = typeof(PropFragmentRegister).Assembly.GetTypes();
//包含[BuffAttribute]特性
var buffs = types.Where(type =>
type.IsClass && !type.IsAbstract && type.IsAssignableTo(typeof(BuffFragment)));
foreach (var type in buffs)
{
var attribute = (BuffFragmentAttribute)type.GetCustomAttribute(typeof(BuffFragmentAttribute), false);
if (attribute != null)
{
if (BuffFragmentInfos.ContainsKey(attribute.BuffName))
{
GD.PrintErr($"Buff '{attribute.BuffName}' 重名!");
continue;
}
var buffInfo = new PropFragmentInfo(attribute.BuffName, attribute.Description, type);
BuffFragmentInfos.Add(attribute.BuffName, buffInfo);
}
}
//包含[ConditionAttribute]特性
var conditions = types.Where(type =>
type.IsClass && !type.IsAbstract && type.IsAssignableTo(typeof(ConditionFragment)));
foreach (var type in conditions)
{
var attribute = (ConditionFragmentAttribute)type.GetCustomAttribute(typeof(ConditionFragmentAttribute), false);
if (attribute != null)
{
if (ConditionFragmentInfos.ContainsKey(attribute.ConditionName))
{
GD.PrintErr($"Condition '{attribute.ConditionName}' 重名!");
continue;
}
var conditionInfo = new PropFragmentInfo(attribute.ConditionName, attribute.Description, type);
ConditionFragmentInfos.Add(attribute.ConditionName, conditionInfo);
}
}
//包含[EffectAttribute]特性
var effects = types.Where(type =>
type.IsClass && !type.IsAbstract && type.IsAssignableTo(typeof(EffectFragment)));
foreach (var type in effects)
{
var attribute = (EffectFragmentAttribute)type.GetCustomAttribute(typeof(EffectFragmentAttribute), false);
if (attribute != null)
{
if (EffectFragmentInfos.ContainsKey(attribute.EffectName))
{
GD.PrintErr($"Effect '{attribute.EffectName}' 重名!");
continue;
}
var effectInfo = new PropFragmentInfo(attribute.EffectName, attribute.Description, type);
EffectFragmentInfos.Add(attribute.EffectName, effectInfo);
}
}
}
}