Compare commits

...

6 Commits

Author SHA1 Message Date
dc5519dcdc buff系统重构中 2024-03-15 10:24:53 +08:00
181e5d3d6d buff系统重构中 2024-03-15 01:35:14 +08:00
49c664c90c 重构buff中 2024-03-14 15:14:23 +08:00
76d4c08041 buff系统重构中 2024-03-14 01:37:51 +08:00
c4f1104f43 重构buff中 2024-03-13 22:01:29 +08:00
dfad25e513 buff系统重构中 2024-03-13 13:48:42 +08:00
65 changed files with 1622 additions and 192 deletions

View File

@ -0,0 +1,130 @@
#if TOOLS
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Godot;
namespace Generator;
/// <summary>
/// 生成 Buff 属性表
/// </summary>
public static class BuffGenerator
{
private const string SavePath = "src/game/manager/BuffRegister.cs";
public static bool Generate()
{
try
{
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);
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);
}
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

Binary file not shown.

View File

@ -20,6 +20,7 @@ public static class ExcelGenerator
public string TypeStr;
public string TypeName;
public CollectionsType CollectionsType;
public bool AutoParentheses = false;
public bool IsRefExcel;
public string RefTypeStr;
@ -392,7 +393,15 @@ public static class ExcelGenerator
MappingData mappingData;
try
{
var autoParentheses = false;
if (typeString.EndsWith('*'))
{
autoParentheses = true;
typeString = typeString.TrimEnd('*');
}
mappingData = ConvertToType(typeString.Replace(" ", ""));
mappingData.AutoParentheses = autoParentheses;
}
catch (Exception e)
{
@ -545,6 +554,17 @@ public static class ExcelGenerator
}
else
{
if (mappingData.AutoParentheses)
{
if (mappingData.CollectionsType == CollectionsType.Array)
{
cellStringValue = "[" + cellStringValue.TrimEnd(',') + "]";
}
if (mappingData.CollectionsType == CollectionsType.Map)
{
cellStringValue = "{" + cellStringValue.TrimEnd(',') + "}";
}
}
data.Add(field, JsonSerializer.Deserialize(cellStringValue, excelData.ColumnType[fieldName]));
}
}

View File

@ -1 +1 @@
5
6

View File

@ -0,0 +1,52 @@
[gd_scene load_steps=7 format=3 uid="uid://dfpic4nubu7cf"]
[ext_resource type="Script" path="res://src/game/activity/prop/BuffActivity.cs" id="1_3ya6n"]
[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_p5e2l"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_mrkt4"]
resource_local_to_scene = true
shader = ExtResource("2_p5e2l")
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_p5e2l")
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="SpriteFrames" id="SpriteFrames_y5dlc"]
resource_local_to_scene = true
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cpqup"]
size = Vector2(12, 10)
[node name="BuffActivity" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")]
collision_layer = 4
script = ExtResource("1_3ya6n")
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 = SubResource("SpriteFrames_y5dlc")
[node name="Collision" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_cpqup")

View File

@ -88,6 +88,18 @@ text = "重新生成UiManagerMethods.cs代码"
layout_mode = 2
text = "运行"
[node name="HBoxContainer6" type="HBoxContainer" parent="ScrollContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 5
[node name="Label" type="Label" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer6"]
layout_mode = 2
text = "生成Buff属性表"
[node name="Button" type="Button" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer6"]
layout_mode = 2
text = "运行"
[node name="HBoxContainer7" type="HBoxContainer" parent="ScrollContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 5

View File

@ -1,8 +1,8 @@
[
{
"Id": "role0001",
"Type": 3,
"Name": "\u73A9\u5BB6",
"Type": 3,
"Quality": 0,
"Price": 0,
"Intro": "\u73A9\u5BB6",
@ -15,8 +15,8 @@
},
{
"Id": "enemy0001",
"Type": 4,
"Name": "\u654C\u4EBA",
"Type": 4,
"Quality": 0,
"Price": 0,
"Intro": "\u654C\u4EBA",
@ -29,8 +29,8 @@
},
{
"Id": "enemy0002",
"Type": 4,
"Name": "\u654C\u4EBA2",
"Type": 4,
"Quality": 0,
"Price": 0,
"Intro": "\u654C\u4EBA2",
@ -43,8 +43,8 @@
},
{
"Id": "weapon0001",
"Type": 5,
"Name": "\u6B65\u67AA",
"Type": 5,
"Quality": 3,
"Price": 0,
"Intro": "",
@ -57,8 +57,8 @@
},
{
"Id": "weapon0002",
"Type": 5,
"Name": "\u9730\u5F39\u67AA",
"Type": 5,
"Quality": 3,
"Price": 0,
"Intro": "",
@ -71,8 +71,8 @@
},
{
"Id": "weapon0003",
"Type": 5,
"Name": "\u624B\u67AA",
"Type": 5,
"Quality": 2,
"Price": 0,
"Intro": "",
@ -85,8 +85,8 @@
},
{
"Id": "weapon0004",
"Type": 5,
"Name": "\u5200",
"Type": 5,
"Quality": 4,
"Price": 0,
"Intro": "",
@ -99,8 +99,8 @@
},
{
"Id": "weapon0005",
"Type": 5,
"Name": "\u72D9\u51FB\u67AA",
"Type": 5,
"Quality": 4,
"Price": 0,
"Intro": "",
@ -113,8 +113,8 @@
},
{
"Id": "weapon0006",
"Type": 5,
"Name": "\u51B2\u950B\u67AA",
"Type": 5,
"Quality": 2,
"Price": 0,
"Intro": "",
@ -127,8 +127,8 @@
},
{
"Id": "weapon0007",
"Type": 5,
"Name": "\u6C64\u59C6\u900A\u51B2\u950B\u67AA",
"Type": 5,
"Quality": 4,
"Price": 0,
"Intro": "",
@ -141,8 +141,8 @@
},
{
"Id": "weapon0008",
"Type": 5,
"Name": "\u6FC0\u5149\u624B\u67AA",
"Type": 5,
"Quality": 3,
"Price": 0,
"Intro": "",
@ -155,8 +155,8 @@
},
{
"Id": "weapon0009",
"Type": 5,
"Name": "\u69B4\u5F39\u53D1\u5C04\u5668",
"Type": 5,
"Quality": 4,
"Price": 0,
"Intro": "",
@ -169,8 +169,8 @@
},
{
"Id": "weapon0010",
"Type": 5,
"Name": "M1\u578B\u70ED\u80FD\u72D9\u51FB\u67AA",
"Type": 5,
"Quality": 5,
"Price": 0,
"Intro": "",
@ -183,8 +183,8 @@
},
{
"Id": "weapon0011",
"Type": 5,
"Name": "weapon0011",
"Type": 5,
"Quality": 5,
"Price": 0,
"Intro": "",
@ -197,8 +197,8 @@
},
{
"Id": "weapon0013",
"Type": 5,
"Name": "P90",
"Type": 5,
"Quality": 4,
"Price": 0,
"Intro": "",
@ -211,8 +211,8 @@
},
{
"Id": "weapon0014",
"Type": 5,
"Name": "\u5DE6\u8F6E",
"Type": 5,
"Quality": 2,
"Price": 0,
"Intro": "",
@ -225,8 +225,8 @@
},
{
"Id": "weapon0016",
"Type": 5,
"Name": "\u6728\u8D28\u77ED\u5F13",
"Type": 5,
"Quality": 2,
"Price": 0,
"Intro": "",
@ -239,8 +239,8 @@
},
{
"Id": "bullet0001",
"Type": 6,
"Name": "",
"Type": 6,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -253,8 +253,8 @@
},
{
"Id": "bullet0002",
"Type": 6,
"Name": "",
"Type": 6,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -267,8 +267,8 @@
},
{
"Id": "bullet0003",
"Type": 6,
"Name": "",
"Type": 6,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -281,8 +281,8 @@
},
{
"Id": "bullet0004",
"Type": 6,
"Name": "\u69B4\u5F39\u70AE",
"Type": 6,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -295,8 +295,8 @@
},
{
"Id": "bullet0005",
"Type": 6,
"Name": "\u629B\u7269\u7EBF\u7C98\u6DB2\u5B50\u5F39",
"Type": 6,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -309,8 +309,8 @@
},
{
"Id": "bullet0006",
"Type": 6,
"Name": "\u62D6\u5C3E\u5B50\u5F39",
"Type": 6,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -323,8 +323,8 @@
},
{
"Id": "bullet0007",
"Type": 6,
"Name": "",
"Type": 6,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -337,8 +337,8 @@
},
{
"Id": "bullet0008",
"Type": 6,
"Name": "",
"Type": 6,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -351,8 +351,8 @@
},
{
"Id": "bullet0009",
"Type": 6,
"Name": "\u5F13\u7BAD",
"Type": 6,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -365,8 +365,8 @@
},
{
"Id": "shell0001",
"Type": 7,
"Name": "",
"Type": 7,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -379,8 +379,8 @@
},
{
"Id": "shell0002",
"Type": 7,
"Name": "",
"Type": 7,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -393,8 +393,8 @@
},
{
"Id": "shell0003",
"Type": 7,
"Name": "",
"Type": 7,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -407,8 +407,8 @@
},
{
"Id": "shell0004",
"Type": 7,
"Name": "",
"Type": 7,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -421,8 +421,8 @@
},
{
"Id": "enemy_dead0001",
"Type": 8,
"Name": "",
"Type": 8,
"Quality": 0,
"Price": 0,
"Intro": "\u654C\u4EBA1\u6B7B\u4EA1\u788E\u7247",
@ -435,8 +435,8 @@
},
{
"Id": "enemy_dead0002",
"Type": 8,
"Name": "",
"Type": 8,
"Quality": 0,
"Price": 0,
"Intro": "\u654C\u4EBA2\u6B7B\u4EA1",
@ -449,22 +449,22 @@
},
{
"Id": "prop0001",
"Type": 9,
"Name": "\u978B\u5B50",
"Type": 9,
"Quality": 4,
"Price": 0,
"Intro": "\u63D0\u9AD8\u79FB\u52A8\u901F\u5EA6",
"Details": "",
"Details": "\u63D0\u9AD8\u89D2\u8272\u7684\u57FA\u7840\u79FB\u52A8\u901F\u5EA6",
"IsStatic": false,
"__Material": "",
"Prefab": "res://prefab/prop/buff/BuffProp0001.tscn",
"Prefab": "res://prefab/prop/BuffActivity.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0001.png",
"ShowInMapEditor": true
},
{
"Id": "prop0002",
"Type": 9,
"Name": "\u5FC3\u4E4B\u5BB9\u5668",
"Type": 9,
"Quality": 3,
"Price": 0,
"Intro": "\u63D0\u9AD8\u8840\u91CF\u4E0A\u9650",
@ -477,8 +477,8 @@
},
{
"Id": "prop0003",
"Type": 9,
"Name": "\u62A4\u76FE",
"Type": 9,
"Quality": 3,
"Price": 0,
"Intro": "\u53EF\u4EE5\u62B5\u6321\u5B50\u5F39\uFF0C\u968F\u65F6\u95F4\u63A8\u79FB\u81EA\u52A8\u6062\u590D",
@ -491,8 +491,8 @@
},
{
"Id": "prop0004",
"Type": 9,
"Name": "\u62A4\u76FE\u8BA1\u65F6\u5668",
"Type": 9,
"Quality": 4,
"Price": 0,
"Intro": "\u63D0\u9AD8\u62A4\u76FE\u6062\u590D\u901F\u5EA6",
@ -505,8 +505,8 @@
},
{
"Id": "prop0005",
"Type": 9,
"Name": "\u6740\u4F24\u5F39",
"Type": 9,
"Quality": 4,
"Price": 0,
"Intro": "\u63D0\u9AD8\u5B50\u5F39\u4F24\u5BB3",
@ -519,8 +519,8 @@
},
{
"Id": "prop0006",
"Type": 9,
"Name": "\u7EA2\u5B9D\u77F3\u6212\u6307",
"Type": 9,
"Quality": 4,
"Price": 0,
"Intro": "\u53D7\u4F24\u540E\u5EF6\u957F\u65E0\u654C\u65F6\u95F4",
@ -533,8 +533,8 @@
},
{
"Id": "prop0007",
"Type": 9,
"Name": "\u5907\u7528\u62A4\u76FE",
"Type": 9,
"Quality": 3,
"Price": 0,
"Intro": "\u53D7\u4F24\u65F6\u6709\u4E00\u5B9A\u6982\u7387\u62B5\u6D88\u4F24\u5BB3",
@ -547,8 +547,8 @@
},
{
"Id": "prop0008",
"Type": 9,
"Name": "\u773C\u955C",
"Type": 9,
"Quality": 3,
"Price": 0,
"Intro": "\u63D0\u9AD8\u6B66\u5668\u7CBE\u51C6\u5EA6",
@ -561,8 +561,8 @@
},
{
"Id": "prop0009",
"Type": 9,
"Name": "\u9AD8\u901F\u5B50\u5F39",
"Type": 9,
"Quality": 3,
"Price": 0,
"Intro": "\u63D0\u9AD8\u5B50\u5F39\u901F\u5EA6\u548C\u5C04\u7A0B",
@ -575,22 +575,22 @@
},
{
"Id": "prop0010",
"Type": 9,
"Name": "\u5206\u88C2\u5B50\u5F39",
"Type": 9,
"Quality": 4,
"Price": 0,
"Intro": "\u5B50\u5F39\u6570\u91CF\u7FFB\u500D, \u4F46\u662F\u7CBE\u51C6\u5EA6, \u51FB\u9000\u548C\u4F24\u5BB3\u964D\u4F4E",
"Details": "",
"IsStatic": false,
"__Material": "",
"Prefab": "res://prefab/prop/buff/BuffProp0010.tscn",
"Prefab": "res://prefab/prop/BuffActivity.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0010.png",
"ShowInMapEditor": true
},
{
"Id": "prop0011",
"Type": 9,
"Name": "\u5F39\u5C04\u5B50\u5F39",
"Type": 9,
"Quality": 4,
"Price": 0,
"Intro": "\u5B50\u5F39\u53CD\u5F39\u6B21\u6570\u002B2",
@ -603,8 +603,8 @@
},
{
"Id": "prop0012",
"Type": 9,
"Name": "\u7A7F\u900F\u5B50\u5F39",
"Type": 9,
"Quality": 4,
"Price": 0,
"Intro": "\u5B50\u5F39\u7A7F\u900F\u002B1",
@ -617,8 +617,8 @@
},
{
"Id": "prop0013",
"Type": 9,
"Name": "\u6B66\u5668\u80CC\u5305",
"Type": 9,
"Quality": 2,
"Price": 0,
"Intro": "\u6B66\u5668\u5BB9\u91CF\u002B1",
@ -631,8 +631,8 @@
},
{
"Id": "prop0014",
"Type": 9,
"Name": "\u9053\u5177\u80CC\u5305",
"Type": 9,
"Quality": 2,
"Price": 0,
"Intro": "\u9053\u5177\u5BB9\u91CF\u002B1",
@ -645,8 +645,8 @@
},
{
"Id": "prop5000",
"Type": 9,
"Name": "\u533B\u836F\u7BB1",
"Type": 9,
"Quality": 1,
"Price": 0,
"Intro": "\u4F7F\u7528\u540E\u56DE\u590D\u4E00\u9897\u7EA2\u5FC3",
@ -659,8 +659,8 @@
},
{
"Id": "prop5001",
"Type": 9,
"Name": "\u5F39\u836F\u7BB1",
"Type": 9,
"Quality": 1,
"Price": 0,
"Intro": "\u4F7F\u7528\u540E\u8865\u5145\u5F53\u524D\u6B66\u5668\u5907\u7528\u5F39\u836F",
@ -673,8 +673,8 @@
},
{
"Id": "treasure_box0001",
"Type": 10,
"Name": "\u6728\u8D28\u5B9D\u7BB1",
"Type": 10,
"Quality": 0,
"Price": 0,
"Intro": "\u6728\u8D28\u5B9D\u7BB1",
@ -687,8 +687,8 @@
},
{
"Id": "other_door_e",
"Type": 99,
"Name": "",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u4E1C\u4FA7)",
@ -701,8 +701,8 @@
},
{
"Id": "other_door_w",
"Type": 99,
"Name": "",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u897F\u4FA7)",
@ -715,8 +715,8 @@
},
{
"Id": "other_door_s",
"Type": 99,
"Name": "",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u5357\u4FA7)",
@ -729,8 +729,8 @@
},
{
"Id": "other_door_n",
"Type": 99,
"Name": "",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u5317\u4FA7)",
@ -743,8 +743,8 @@
},
{
"Id": "gold_10",
"Type": 99,
"Name": "\u91D1\u5E01",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "\u83B7\u5F9710\u91D1\u5E01",
@ -757,8 +757,8 @@
},
{
"Id": "gold_5",
"Type": 99,
"Name": "\u94F6\u5E01",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "\u83B7\u5F975\u91D1\u5E01",
@ -771,8 +771,8 @@
},
{
"Id": "gold_1",
"Type": 99,
"Name": "\u94DC\u5E01",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "\u83B7\u5F971\u91D1\u5E01",
@ -785,8 +785,8 @@
},
{
"Id": "item_0001",
"Type": 99,
"Name": "\u7535\u8111\u684C",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -799,8 +799,8 @@
},
{
"Id": "item_0002",
"Type": 99,
"Name": "",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -813,8 +813,8 @@
},
{
"Id": "item_0003",
"Type": 99,
"Name": "",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -827,8 +827,8 @@
},
{
"Id": "item_0004",
"Type": 99,
"Name": "",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -841,8 +841,8 @@
},
{
"Id": "item_0005",
"Type": 99,
"Name": "",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -855,8 +855,8 @@
},
{
"Id": "item_0006",
"Type": 99,
"Name": "\u7535\u89C6\u684C",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -869,8 +869,8 @@
},
{
"Id": "item_0007",
"Type": 99,
"Name": "\u9152\u67DC",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -883,8 +883,8 @@
},
{
"Id": "item_0008",
"Type": 99,
"Name": "\u6C99\u53D1\u65C1\u67DC\u5B50",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -897,8 +897,8 @@
},
{
"Id": "item_0009",
"Type": 99,
"Name": "\u5427\u53F0",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -911,8 +911,8 @@
},
{
"Id": "item_0010",
"Type": 99,
"Name": "\u544A\u793A\u724C",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -925,8 +925,8 @@
},
{
"Id": "item_0011",
"Type": 99,
"Name": "\u7EFF\u6728\u51F3",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -939,8 +939,8 @@
},
{
"Id": "item_0012",
"Type": 99,
"Name": "\u6C99\u53D1\u7AD6",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -953,8 +953,8 @@
},
{
"Id": "item_0013",
"Type": 99,
"Name": "\u6C99\u53D1\u6A2A\u7740",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -967,8 +967,8 @@
},
{
"Id": "item_0014",
"Type": 99,
"Name": "\u61D2\u4EBA\u6C99\u53D1",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -981,8 +981,8 @@
},
{
"Id": "item_0015",
"Type": 99,
"Name": "\u5DE6\u4E0B\u89D2\u684C\u5B50",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -995,8 +995,8 @@
},
{
"Id": "item_0016",
"Type": 99,
"Name": "\u5DE6\u4E0B\u89D2\u77ED\u6C99\u53D1",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1009,8 +1009,8 @@
},
{
"Id": "item_0017",
"Type": 99,
"Name": "\u4E2D\u95F4\u684C\u5B50",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1023,8 +1023,8 @@
},
{
"Id": "item_0018",
"Type": 99,
"Name": "\u5DE6\u4E0B\u89D2\u957F\u6C99\u53D1",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1037,8 +1037,8 @@
},
{
"Id": "item_0019",
"Type": 99,
"Name": "\u53F3\u4E0B\u89D2\u684C\u5B50",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1051,8 +1051,8 @@
},
{
"Id": "item_0020",
"Type": 99,
"Name": "\u8F6C\u6905",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1065,8 +1065,8 @@
},
{
"Id": "item_0021",
"Type": 99,
"Name": "\u53F3\u4E0B\u89D2\u957F\u6C99\u53D1",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1079,8 +1079,8 @@
},
{
"Id": "item_0022",
"Type": 99,
"Name": "\u8863\u67B6",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1093,8 +1093,8 @@
},
{
"Id": "item_0023",
"Type": 99,
"Name": "\u7EFF\u690D",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1107,8 +1107,8 @@
},
{
"Id": "item_0024",
"Type": 99,
"Name": "\u65B0\u624B\u6559\u5B66\u5173\u5361",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1121,8 +1121,8 @@
},
{
"Id": "item_0025",
"Type": 99,
"Name": "\u8302\u76DB\u82B1\u76C6",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1135,8 +1135,8 @@
},
{
"Id": "item_0026",
"Type": 99,
"Name": "\u544A\u793A\u7248",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1149,8 +1149,8 @@
},
{
"Id": "item_0031",
"Type": 99,
"Name": "\u53F0\u706F",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1163,8 +1163,8 @@
},
{
"Id": "item_0033",
"Type": 99,
"Name": "\u5427\u53F0",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1177,8 +1177,8 @@
},
{
"Id": "item_0036",
"Type": 99,
"Name": "\u53F0\u7403\u684C",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1191,8 +1191,8 @@
},
{
"Id": "item_0054",
"Type": 99,
"Name": "\u8D29\u5356\u673A",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1205,8 +1205,8 @@
},
{
"Id": "item_0056",
"Type": 99,
"Name": "\u957F\u51F3\u5B50",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",
@ -1219,8 +1219,8 @@
},
{
"Id": "item_0057",
"Type": 99,
"Name": "\u5361\u5E26\u76D2\u5B50",
"Type": 99,
"Quality": 0,
"Price": 0,
"Intro": "",

View File

@ -0,0 +1,41 @@
[
{
"Id": "0001",
"Remark": "\u978B\u5B50",
"__Activity": "prop0001",
"IsActivity": false,
"Buff": {
"MoveSpeed": [
30
]
}
},
{
"Id": "0010",
"Remark": "\u5206\u88C2\u5B50\u5F39",
"__Activity": "prop0010",
"IsActivity": false,
"Buff": {
"BulletCount": [
2,
1
],
"BulletDeviationAngle": [
-8,
8
],
"Damage": [
2,
-0.35
],
"BulletRepel": [
2,
-0.35
],
"RandomBulletSpeed": [
-0.05,
0.05
]
}
}
]

View File

@ -1 +1 @@
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":false,"WaveList":[[{"Position":{"X":39,"Y":8},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":-16,"Y":-18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":66,"Y":6},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0009","Weight":100,"Attr":{"CurrAmmon":"1","ResidueAmmo":"25"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":66,"Y":47},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0010","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"120"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":47,"Y":-32},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0008","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"120"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":23,"Y":37},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0010","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":2,"Y":18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0005","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":24,"Y":-30},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":40,"Y":-10},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0003","Weight":100,"Attr":{"CurrAmmon":"12","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":2,"Y":-37},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0007","Weight":100,"Attr":{"CurrAmmon":"60","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-2,"Y":47},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0002","Weight":100,"Attr":{"CurrAmmon":"7","ResidueAmmo":"70"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":29,"Y":63},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0013","Weight":100,"Attr":{"CurrAmmon":"50","ResidueAmmo":"250"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-30,"Y":39},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-19,"Y":71},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":48,"Y":29},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0004","Weight":100,"Attr":{"CurrAmmon":"180","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":20,"Y":94},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0014","Weight":100,"Attr":{"CurrAmmon":"5","ResidueAmmo":"60"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-14,"Y":97},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0011","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":9,"Y":-7},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0011","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-41,"Y":61},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0016","Weight":100,"Attr":{"CurrAmmon":"5","ResidueAmmo":"60"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":73,"Y":-19},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0005","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"40"},"Altitude":8,"VerticalSpeed":5.551115E-14}]}]]}]
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":false,"WaveList":[[{"Position":{"X":39,"Y":8},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":-16,"Y":-18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":66,"Y":6},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0009","Weight":100,"Attr":{"CurrAmmon":"1","ResidueAmmo":"25"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":66,"Y":47},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0010","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"120"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":47,"Y":-32},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0008","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"120"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":23,"Y":37},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0010","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":2,"Y":18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0005","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":24,"Y":-30},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":40,"Y":-10},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0003","Weight":100,"Attr":{"CurrAmmon":"12","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":2,"Y":-37},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0007","Weight":100,"Attr":{"CurrAmmon":"60","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-2,"Y":47},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0002","Weight":100,"Attr":{"CurrAmmon":"7","ResidueAmmo":"70"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":29,"Y":63},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0013","Weight":100,"Attr":{"CurrAmmon":"50","ResidueAmmo":"250"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-30,"Y":39},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-19,"Y":71},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":48,"Y":29},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0004","Weight":100,"Attr":{"CurrAmmon":"180","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":20,"Y":94},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0014","Weight":100,"Attr":{"CurrAmmon":"5","ResidueAmmo":"60"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-14,"Y":97},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0011","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":9,"Y":-7},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0011","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-41,"Y":61},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0016","Weight":100,"Attr":{"CurrAmmon":"5","ResidueAmmo":"60"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":73,"Y":-19},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0005","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"40"},"Altitude":8,"VerticalSpeed":5.551115E-14}]},{"Position":{"X":-72,"Y":71},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":5.551115E-14}]}]]}]

View File

@ -43,6 +43,15 @@ public static partial class ExcelConfig
/// </summary>
public static Dictionary<string, AiAttackAttr> AiAttackAttr_Map { get; private set; }
/// <summary>
/// BuffBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<BuffBase> BuffBase_List { get; private set; }
/// <summary>
/// BuffBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, BuffBase> BuffBase_Map { get; private set; }
/// <summary>
/// BulletBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
@ -93,12 +102,14 @@ public static partial class ExcelConfig
_InitWeaponBaseConfig();
_InitActivityMaterialConfig();
_InitAiAttackAttrConfig();
_InitBuffBaseConfig();
_InitBulletBaseConfig();
_InitEnemyBaseConfig();
_InitActivityBaseConfig();
_InitLiquidMaterialConfig();
_InitWeaponBaseRef();
_InitBuffBaseRef();
_InitEnemyBaseRef();
_InitActivityBaseRef();
}
@ -174,6 +185,24 @@ public static partial class ExcelConfig
throw new Exception("初始化表'AiAttackAttr'失败!");
}
}
private static void _InitBuffBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/BuffBase.json");
BuffBase_List = new List<BuffBase>(JsonSerializer.Deserialize<List<Ref_BuffBase>>(text));
BuffBase_Map = new Dictionary<string, BuffBase>();
foreach (var item in BuffBase_List)
{
BuffBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'BuffBase'失败!");
}
}
private static void _InitBulletBaseConfig()
{
try
@ -315,6 +344,25 @@ public static partial class ExcelConfig
}
}
}
private static void _InitBuffBaseRef()
{
foreach (Ref_BuffBase item in BuffBase_List)
{
try
{
if (!string.IsNullOrEmpty(item.__Activity))
{
item.Activity = ActivityBase_Map[item.__Activity];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'BuffBase'引用其他表数据失败, 当前行id: " + item.Id);
}
}
}
private static void _InitEnemyBaseRef()
{
foreach (Ref_EnemyBase item in EnemyBase_List)

View File

@ -14,6 +14,12 @@ public static partial class ExcelConfig
[JsonInclude]
public string Id;
/// <summary>
/// 物体名称
/// </summary>
[JsonInclude]
public string Name;
/// <summary>
/// Test(测试对象): 2 <br/>
/// Role(角色): 3 <br/>
@ -29,12 +35,6 @@ public static partial class ExcelConfig
[JsonInclude]
public ActivityType Type;
/// <summary>
/// 物体名称
/// </summary>
[JsonInclude]
public string Name;
/// <summary>
/// 物体品质, 用于武器和道具 <br/>
/// 通用物品: 1 <br/>
@ -106,8 +106,8 @@ public static partial class ExcelConfig
{
var inst = new ActivityBase();
inst.Id = Id;
inst.Type = Type;
inst.Name = Name;
inst.Type = Type;
inst.Quality = Quality;
inst.Price = Price;
inst.Intro = Intro;

View File

@ -0,0 +1,62 @@
using System.Text.Json.Serialization;
using System.Collections.Generic;
namespace Config;
public static partial class ExcelConfig
{
public class BuffBase
{
/// <summary>
/// Buff Id
/// </summary>
[JsonInclude]
public string Id;
/// <summary>
/// 备注
/// </summary>
[JsonInclude]
public string Remark;
/// <summary>
/// 属性绑定Buff实体的Id这个id时ActivityBase表Id
/// </summary>
public ActivityBase Activity;
/// <summary>
/// 是否是主动道具, 默认false
/// </summary>
[JsonInclude]
public bool IsActivity;
/// <summary>
/// 被动Buff效果 <br/>
/// 也就是当前buff道具所有挂载的被动属性集合, 具体属性名称请参阅buff属性表 <br/>
/// key为buff属性名称 <br/>
/// value为buff初始化参数
/// </summary>
[JsonInclude]
public Dictionary<string, float[]> Buff;
/// <summary>
/// 返回浅拷贝出的新对象
/// </summary>
public BuffBase Clone()
{
var inst = new BuffBase();
inst.Id = Id;
inst.Remark = Remark;
inst.Activity = Activity;
inst.IsActivity = IsActivity;
inst.Buff = Buff;
return inst;
}
}
private class Ref_BuffBase : BuffBase
{
[JsonInclude]
public string __Activity;
}
}

View File

@ -1951,7 +1951,7 @@ public partial class ActivityObject : CharacterBody2D, IDestroy, ICoroutine
}
/// <summary>
/// 设置是否启用碰撞层, 该函数是设置下状态下原碰撞层
/// 设置是否启用碰撞层, 该函数是设置下状态下原碰撞层
/// </summary>
public void SetOriginCollisionLayerValue(uint layer, bool vale)
{

View File

@ -91,6 +91,7 @@ public partial class GameApplication : Node2D, ICoroutine
//初始化配置表
ExcelConfig.Init();
PreinstallMarkManager.Init();
BuffRegister.Init();
//初始化房间配置数据
InitRoomConfig();
//初始化TileSet配置数据
@ -99,6 +100,8 @@ public partial class GameApplication : Node2D, ICoroutine
Weapon.InitWeaponAttribute();
//初始化敌人数据
Enemy.InitEnemyAttribute();
//初始化buff数据
BuffActivity.InitBuffAttribute();
DungeonConfig = new DungeonConfig();
DungeonConfig.GroupName = "Test1";

View File

@ -0,0 +1,221 @@

using System;
using System.Collections.Generic;
using Config;
using Godot;
/// <summary>
/// 通用被动道具实体类
/// </summary>
[Tool]
public partial class BuffActivity : PropActivity
{
//被动属性
private readonly List<BuffFragment> _buffFragment = new List<BuffFragment>();
public override void OnInit()
{
base.OnInit();
var buffAttribute = GetBuffAttribute(ActivityBase.Id);
if (buffAttribute != null)
{
//初始化buff属性
foreach (var keyValuePair in buffAttribute.Buff)
{
var buffInfo = BuffRegister.BuffInfos[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 (!string.IsNullOrEmpty(ActivityBase.Icon))
{
SetDefaultTexture(ResourceManager.LoadTexture2D(ActivityBase.Icon));
}
}
}
public override void OnPickUpItem()
{
foreach (var buffFragment in _buffFragment)
{
buffFragment.OnPickUpItem();
}
}
public override void OnRemoveItem()
{
foreach (var buffFragment in _buffFragment)
{
buffFragment.OnRemoveItem();
}
}
/// <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();
}
}
public override void Interactive(ActivityObject master)
{
if (master is Player role)
{
Pickup();
role.PickUpBuffProp(this);
}
}
public override CheckInteractiveResult CheckInteractive(ActivityObject master)
{
if (master is Player)
{
return new CheckInteractiveResult(this, true, CheckInteractiveResult.InteractiveType.PickUp);
}
return base.CheckInteractive(master);
}
private static bool _init = false;
private static Dictionary<string, ExcelConfig.BuffBase> _buffAttributeMap =
new Dictionary<string, ExcelConfig.BuffBase>();
/// <summary>
/// 初始化 buff 属性数据
/// </summary>
public static void InitBuffAttribute()
{
if (_init)
{
return;
}
_init = true;
foreach (var buffAttr in ExcelConfig.BuffBase_List)
{
if (buffAttr.Activity != null)
{
if (!_buffAttributeMap.TryAdd(buffAttr.Activity.Id, buffAttr))
{
Debug.LogError("发现重复注册的 buff 属性: " + buffAttr.Id);
}
}
}
}
/// <summary>
/// 根据 ActivityBase.Id 获取对应 buff 的属性数据
/// </summary>
public static ExcelConfig.BuffBase GetBuffAttribute(string itemId)
{
if (itemId == null)
{
return null;
}
if (_buffAttributeMap.TryGetValue(itemId, out var attr))
{
return attr;
}
return null;
//throw new Exception($"buff'{itemId}'没有在 BuffBase 表中配置属性数据!");
}
}

View File

@ -4,7 +4,7 @@ using Godot;
/// <summary>
/// 道具基类
/// </summary>
public abstract partial class Prop : ActivityObject
public abstract partial class PropActivity : ActivityObject
{
/// <summary>
/// 道具所属角色

View File

@ -5,7 +5,7 @@ using Godot;
/// 医药箱, 使用后恢复一颗红心
/// </summary>
[Tool]
public partial class ActiveProp5000 : ActiveProp
public partial class ActiveProp5000 : ActivePropActivity
{
public override void OnInit()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 弹药箱, 使用后补全当前武器备用弹药
/// </summary>
[Tool]
public partial class ActiveProp5001 : ActiveProp
public partial class ActiveProp5001 : ActivePropActivity
{
public override void OnInit()
{

View File

@ -4,7 +4,7 @@ using Godot;
/// <summary>
/// 主动使用道具
/// </summary>
public abstract partial class ActiveProp : Prop, IPackageItem<Role>
public abstract partial class ActivePropActivity : PropActivity, IPackageItem<Role>
{
public int PackageIndex { get; set; }

View File

@ -1,24 +0,0 @@

/// <summary>
/// 被动增益道具
/// </summary>
public abstract partial class BuffProp : Prop
{
public override void Interactive(ActivityObject master)
{
if (master is Player role)
{
Pickup();
role.PickUpBuffProp(this);
}
}
public override CheckInteractiveResult CheckInteractive(ActivityObject master)
{
if (master is Player)
{
return new CheckInteractiveResult(this, true, CheckInteractiveResult.InteractiveType.PickUp);
}
return base.CheckInteractive(master);
}
}

View File

@ -5,7 +5,7 @@ using Godot;
/// 移速 buff, 移速 + 3
/// </summary>
[Tool]
public partial class BuffProp0001 : BuffProp
public partial class BuffProp0001 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 血量上限buff, 心之容器 + 1
/// </summary>
[Tool]
public partial class BuffProp0002 : BuffProp
public partial class BuffProp0002 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 护盾上限buff, 护盾 + 1
/// </summary>
[Tool]
public partial class BuffProp0003 : BuffProp
public partial class BuffProp0003 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 护盾恢复时间buff, 恢复时间 - 2.5s
/// </summary>
[Tool]
public partial class BuffProp0004 : BuffProp
public partial class BuffProp0004 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 提升伤害buff, 子弹伤害提升20%
/// </summary>
[Tool]
public partial class BuffProp0005 : BuffProp
public partial class BuffProp0005 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 延长无敌时间buff, 受伤后无敌时间 + 2s
/// </summary>
[Tool]
public partial class BuffProp0006 : BuffProp
public partial class BuffProp0006 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 受伤时有15%概率抵消伤害
/// </summary>
[Tool]
public partial class BuffProp0007 : BuffProp
public partial class BuffProp0007 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 眼镜, 提高武器50%精准度
/// </summary>
[Tool]
public partial class BuffProp0008 : BuffProp
public partial class BuffProp0008 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 高速子弹 子弹速度和射程提升25%
/// </summary>
[Tool]
public partial class BuffProp0009 : BuffProp
public partial class BuffProp0009 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 分裂子弹 子弹数量翻倍, 但是精准度, 击退和伤害降低
/// </summary>
[Tool]
public partial class BuffProp0010 : BuffProp
public partial class BuffProp0010 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 弹射子弹 子弹反弹次数 +2
/// </summary>
[Tool]
public partial class BuffProp0011 : BuffProp
public partial class BuffProp0011 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -5,7 +5,7 @@ using Godot;
/// 穿透子弹 子弹穿透+1
/// </summary>
[Tool]
public partial class BuffProp0012 : BuffProp
public partial class BuffProp0012 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -4,7 +4,7 @@
/// 武器背包 武器容量+1
/// </summary>
[Tool]
public partial class BuffProp0013 : BuffProp
public partial class BuffProp0013 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -4,7 +4,7 @@
/// 道具背包 道具容量+1
/// </summary>
[Tool]
public partial class BuffProp0014 : BuffProp
public partial class BuffProp0014 : BuffActivity
{
public override void OnPickUpItem()
{

View File

@ -54,12 +54,12 @@ public abstract partial class Role : ActivityObject
/// <summary>
/// 携带的被动道具列表
/// </summary>
public List<BuffProp> BuffPropPack { get; } = new List<BuffProp>();
public List<BuffActivity> BuffPropPack { get; } = new List<BuffActivity>();
/// <summary>
/// 携带的主动道具包裹
/// </summary>
public Package<ActiveProp, Role> ActivePropsPack { get; private set; }
public Package<ActivePropActivity, Role> ActivePropsPack { get; private set; }
/// <summary>
/// 互动碰撞区域
@ -431,42 +431,42 @@ public abstract partial class Role : ActivityObject
/// <summary>
/// 当拾起某个主动道具时调用
/// </summary>
protected virtual void OnPickUpActiveProp(ActiveProp activeProp)
protected virtual void OnPickUpActiveProp(ActivePropActivity activePropActivity)
{
}
/// <summary>
/// 当移除某个主动道具时调用
/// </summary>
protected virtual void OnRemoveActiveProp(ActiveProp activeProp)
protected virtual void OnRemoveActiveProp(ActivePropActivity activePropActivity)
{
}
/// <summary>
/// 当切换到某个主动道具时调用
/// </summary>
protected virtual void OnExchangeActiveProp(ActiveProp activeProp)
protected virtual void OnExchangeActiveProp(ActivePropActivity activePropActivity)
{
}
/// <summary>
/// 当拾起某个被动道具时调用
/// </summary>
protected virtual void OnPickUpBuffProp(BuffProp buffProp)
protected virtual void OnPickUpBuffProp(BuffActivity buffActivity)
{
}
/// <summary>
/// 当移除某个被动道具时调用
/// </summary>
protected virtual void OnRemoveBuffProp(BuffProp buffProp)
protected virtual void OnRemoveBuffProp(BuffActivity buffActivity)
{
}
public override void OnInit()
{
RoleState = OnCreateRoleState();
ActivePropsPack = AddComponent<Package<ActiveProp, Role>>();
ActivePropsPack = AddComponent<Package<ActivePropActivity, Role>>();
ActivePropsPack.SetCapacity(RoleState.CanPickUpWeapon ? 1 : 0);
_startScale = Scale;
@ -617,7 +617,7 @@ public abstract partial class Role : ActivityObject
var props = ActivePropsPack.ItemSlot;
if (props.Length > 0)
{
props = (ActiveProp[])props.Clone();
props = (ActivePropActivity[])props.Clone();
foreach (var prop in props)
{
if (prop != null && !prop.IsDestroyed)
@ -673,15 +673,15 @@ public abstract partial class Role : ActivityObject
/// <summary>
/// 拾起主动道具, 返回是否成功拾起, 如果不想立刻切换到该道具, exchange 请传 false
/// </summary>
/// <param name="activeProp">主动道具对象</param>
/// <param name="activePropActivity">主动道具对象</param>
/// <param name="exchange">是否立即切换到该道具, 默认 true </param>
public bool PickUpActiveProp(ActiveProp activeProp, bool exchange = true)
public bool PickUpActiveProp(ActivePropActivity activePropActivity, bool exchange = true)
{
if (ActivePropsPack.PickupItem(activeProp, exchange) != -1)
if (ActivePropsPack.PickupItem(activePropActivity, exchange) != -1)
{
//从可互动队列中移除
InteractiveItemList.Remove(activeProp);
OnPickUpActiveProp(activeProp);
InteractiveItemList.Remove(activePropActivity);
OnPickUpActiveProp(activePropActivity);
return true;
}
@ -716,28 +716,28 @@ public abstract partial class Role : ActivityObject
/// <summary>
/// 拾起被动道具, 返回是否成功拾起
/// </summary>
/// <param name="buffProp">被动道具对象</param>
public bool PickUpBuffProp(BuffProp buffProp)
/// <param name="buffActivity">被动道具对象</param>
public bool PickUpBuffProp(BuffActivity buffActivity)
{
if (BuffPropPack.Contains(buffProp))
if (BuffPropPack.Contains(buffActivity))
{
Debug.LogError("被动道具已经在背包中了!");
return false;
}
BuffPropPack.Add(buffProp);
buffProp.Master = this;
OnPickUpBuffProp(buffProp);
buffProp.OnPickUpItem();
BuffPropPack.Add(buffActivity);
buffActivity.Master = this;
OnPickUpBuffProp(buffActivity);
buffActivity.OnPickUpItem();
return true;
}
/// <summary>
/// 扔掉指定的被动道具
/// </summary>
/// <param name="buffProp"></param>
public void ThrowBuffProp(BuffProp buffProp)
/// <param name="buffActivity"></param>
public void ThrowBuffProp(BuffActivity buffActivity)
{
var index = BuffPropPack.IndexOf(buffProp);
var index = BuffPropPack.IndexOf(buffActivity);
if (index < 0)
{
Debug.LogError("当前道具不在角色背包中!");

View File

@ -354,24 +354,24 @@ public partial class Player : Role
UiManager.Open_Settlement();
}
protected override void OnPickUpActiveProp(ActiveProp activeProp)
protected override void OnPickUpActiveProp(ActivePropActivity activePropActivity)
{
EventManager.EmitEvent(EventEnum.OnPlayerPickUpProp, activeProp);
EventManager.EmitEvent(EventEnum.OnPlayerPickUpProp, activePropActivity);
}
protected override void OnRemoveActiveProp(ActiveProp activeProp)
protected override void OnRemoveActiveProp(ActivePropActivity activePropActivity)
{
EventManager.EmitEvent(EventEnum.OnPlayerRemoveProp, activeProp);
EventManager.EmitEvent(EventEnum.OnPlayerRemoveProp, activePropActivity);
}
protected override void OnPickUpBuffProp(BuffProp buffProp)
protected override void OnPickUpBuffProp(BuffActivity buffActivity)
{
EventManager.EmitEvent(EventEnum.OnPlayerPickUpProp, buffProp);
EventManager.EmitEvent(EventEnum.OnPlayerPickUpProp, buffActivity);
}
protected override void OnRemoveBuffProp(BuffProp buffProp)
protected override void OnRemoveBuffProp(BuffActivity buffActivity)
{
EventManager.EmitEvent(EventEnum.OnPlayerRemoveProp, buffProp);
EventManager.EmitEvent(EventEnum.OnPlayerRemoveProp, buffActivity);
}
/// <summary>

View File

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

View File

@ -1,4 +0,0 @@
public abstract partial class BuffBase : Component<Role>
{
}

View File

@ -0,0 +1,55 @@
using System;
/// <summary>
/// 被动属性逻辑基类
/// </summary>
public abstract partial class BuffFragment : Component<BuffActivity>
{
/// <summary>
/// 所属角色对象
/// </summary>
public Role Role => Master?.Master;
/// <summary>
/// 当道具被拾起时调用 (在 Master 赋值之后调用)
/// </summary>
public abstract void OnPickUpItem();
/// <summary>
/// 当道具被移除时调用 (在 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

@ -0,0 +1,21 @@
[Buff("ActivePropsCapacity", "主动道具背包容量 buff, 参数1为主动道具背包增加的容量")]
public class Buff_ActivePropsCapacity : BuffFragment
{
private int _value;
public override void InitParam(float arg1)
{
_value = (int)arg1;
}
public override void OnPickUpItem()
{
Role.ActivePropsPack.SetCapacity(Role.ActivePropsPack.Capacity + _value);
}
public override void OnRemoveItem()
{
Role.ActivePropsPack.SetCapacity(Role.ActivePropsPack.Capacity - _value);
}
}

View File

@ -0,0 +1,26 @@
[Buff("BulletBounceCount", "子弹弹射数量 buff, 参数1为增加的弹射次数")]
public class Buff_BulletBounceCount : BuffFragment
{
private int _value;
public override void InitParam(float arg1)
{
_value = (int)arg1;
}
public override void OnPickUpItem()
{
Role.RoleState.CalcBulletBounceCountEvent += CalcBulletBounceCountEvent;
}
public override void OnRemoveItem()
{
Role.RoleState.CalcBulletBounceCountEvent -= CalcBulletBounceCountEvent;
}
private void CalcBulletBounceCountEvent(int originBounce, RefValue<int> bounce)
{
bounce.Value += _value;
}
}

View File

@ -0,0 +1,52 @@
using Godot;
[Buff("BulletCount",
"子弹数量 buff, " +
"参数1为子弹数量添加类型, 1: 具体数量, 2:百分比(小数), " +
"参数2为增加子弹的数量")]
public class Buff_BulletCount : BuffFragment
{
private int _type;
private float _value;
public override void InitParam(float arg1, float arg2)
{
_type = (int)arg1;
_value = (int)arg2;
}
public override void OnPickUpItem()
{
if (_type == 1)
{
Role.RoleState.CalcBulletCountEvent += CalcBulletCountEvent1;
}
else
{
Role.RoleState.CalcBulletCountEvent += CalcBulletCountEvent2;
}
}
public override void OnRemoveItem()
{
if (_type == 1)
{
Role.RoleState.CalcBulletCountEvent -= CalcBulletCountEvent1;
}
else
{
Role.RoleState.CalcBulletCountEvent -= CalcBulletCountEvent2;
}
}
private void CalcBulletCountEvent1(int originCount, RefValue<int> refValue)
{
refValue.Value += Mathf.CeilToInt(_value);
}
private void CalcBulletCountEvent2(int originCount, RefValue<int> refValue)
{
refValue.Value += Mathf.CeilToInt(originCount * _value);
}
}

View File

@ -0,0 +1,31 @@
[Buff("BulletDeviationAngle",
"子弹偏移角度 buff, " +
"参数1为增加子弹偏移角度下限, " +
"参数2为增加子弹偏移角度上限, 单位角度制, 会从上限和下限随机抽取值")]
public class Buff_BulletDeviationAngle : BuffFragment
{
private float _min;
private float _max;
public override void InitParam(float arg1, float arg2)
{
_min = arg1;
_max = arg2;
}
public override void OnPickUpItem()
{
Role.RoleState.CalcBulletDeviationAngleEvent += CalcBulletDeviationAngleEvent;
}
public override void OnRemoveItem()
{
Role.RoleState.CalcBulletDeviationAngleEvent -= CalcBulletDeviationAngleEvent;
}
private void CalcBulletDeviationAngleEvent(float originAngle, RefValue<float> refValue)
{
refValue.Value += Utils.Random.RandomRangeFloat(_min, _max);
}
}

View File

@ -0,0 +1,47 @@
[Buff("BulletDistance", "子弹射程 buff, 参数1为射程增加类型: 1:具体射程, 2:百分比射程(小数), 参数2为子弹增加的射程值")]
public class Buff_BulletDistance : BuffFragment
{
private int _type;
private float _value;
public override void InitParam(float arg1, float arg2)
{
_type = (int)arg1;
_value = arg2;
}
public override void OnPickUpItem()
{
if (_type == 1)
{
Role.RoleState.CalcBulletDistanceEvent += CalcBulletDistanceEvent1;
}
else
{
Role.RoleState.CalcBulletDistanceEvent += CalcBulletDistanceEvent2;
}
}
public override void OnRemoveItem()
{
if (_type == 1)
{
Role.RoleState.CalcBulletDistanceEvent -= CalcBulletDistanceEvent1;
}
else
{
Role.RoleState.CalcBulletDistanceEvent -= CalcBulletDistanceEvent2;
}
}
private void CalcBulletDistanceEvent1(float originDistance, RefValue<float> distance)
{
distance.Value += _value;
}
private void CalcBulletDistanceEvent2(float originDistance, RefValue<float> distance)
{
distance.Value += originDistance * _value;
}
}

View File

@ -0,0 +1,26 @@
[Buff("BulletPenetration", "子弹穿透次数 buff, 参数1为增加的穿透次数")]
public class Buff_BulletPenetration : BuffFragment
{
private int _value;
public override void InitParam(float arg1)
{
_value = (int)arg1;
}
public override void OnPickUpItem()
{
Role.RoleState.CalcBulletPenetrationEvent += CalcBulletPenetrationEvent;
}
public override void OnRemoveItem()
{
Role.RoleState.CalcBulletPenetrationEvent -= CalcBulletPenetrationEvent;
}
private void CalcBulletPenetrationEvent(int origin, RefValue<int> penetration)
{
penetration.Value += _value;
}
}

View File

@ -0,0 +1,67 @@
using Godot;
[Buff("BulletRepel",
"子弹击退 buff, " +
"参数1为击退增加类型: 1:具体击退值, " +
"2:百分比击退值(小数), 参数2为子弹增加的击退值")]
public class Buff_BulletRepel : BuffFragment
{
private int _type;
private float _value;
public override void InitParam(float arg1, float arg2)
{
_type = (int)arg1;
_value = arg2;
}
public override void OnPickUpItem()
{
if (_type == 1)
{
Role.RoleState.CalcBulletRepelEvent += CalcBulletRepelEvent1;
}
else
{
Role.RoleState.CalcBulletRepelEvent += CalcBulletRepelEvent2;
}
}
public override void OnRemoveItem()
{
if (_type == 1)
{
Role.RoleState.CalcBulletRepelEvent -= CalcBulletRepelEvent1;
}
else
{
Role.RoleState.CalcBulletRepelEvent -= CalcBulletRepelEvent2;
}
}
private void CalcBulletRepelEvent1(float originRepel, RefValue<float> repel)
{
if (Role.WeaponPack.ActiveItem != null && Role.WeaponPack.ActiveItem.Attribute.IsMelee)
{
return;
}
repel.Value += _value;
}
private void CalcBulletRepelEvent2(float originRepel, RefValue<float> repel)
{
if (Role.WeaponPack.ActiveItem != null && Role.WeaponPack.ActiveItem.Attribute.IsMelee)
{
return;
}
if (_value > 0)
{
repel.Value += originRepel * _value;
}
else
{
repel.Value = Mathf.Max(0, repel.Value - Mathf.FloorToInt(repel.Value * _value));
}
}
}

View File

@ -0,0 +1,50 @@
[Buff("BulletSpeed",
"子弹速度 buff, " +
"参数1为射速增加类型: 1:具体射速, 2:百分比射速(小数), " +
"参数2为子弹增加的射速值")]
public class Buff_BulletSpeed : BuffFragment
{
private int _type;
private float _value;
public override void InitParam(float arg1, float arg2)
{
_type = (int)arg1;
_value = arg2;
}
public override void OnPickUpItem()
{
if (_type == 1)
{
Role.RoleState.CalcBulletSpeedEvent += CalcBulletSpeedEvent1;
}
else
{
Role.RoleState.CalcBulletSpeedEvent += CalcBulletSpeedEvent2;
}
}
public override void OnRemoveItem()
{
if (_type == 1)
{
Role.RoleState.CalcBulletSpeedEvent -= CalcBulletSpeedEvent1;
}
else
{
Role.RoleState.CalcBulletSpeedEvent -= CalcBulletSpeedEvent2;
}
}
private void CalcBulletSpeedEvent1(float originSpeed, RefValue<float> speed)
{
speed.Value += _value;
}
private void CalcBulletSpeedEvent2(float originSpeed, RefValue<float> speed)
{
speed.Value += originSpeed * _value;
}
}

View File

@ -0,0 +1,59 @@
using Godot;
[Buff("Damage",
"提升伤害buff, " +
"参数1为伤害增加类型: 1:具体伤害, 2:百分比伤害(小数), " +
"参数2为增益伤害值")]
public class Buff_Damage : BuffFragment
{
private int _type;
private float _value;
public override void InitParam(float arg1, float arg2)
{
_type = (int)arg1;
_value = arg2;
}
public override void OnPickUpItem()
{
if (_type == 1)
{
Role.RoleState.CalcDamageEvent += CalcDamage1;
}
else
{
Role.RoleState.CalcDamageEvent += CalcDamage2;
}
}
public override void OnRemoveItem()
{
if (_type == 1)
{
Role.RoleState.CalcDamageEvent -= CalcDamage1;
}
else
{
Role.RoleState.CalcDamageEvent -= CalcDamage2;
}
}
private void CalcDamage1(int originDamage, RefValue<int> refValue)
{
refValue.Value += Mathf.CeilToInt(_value);
}
private void CalcDamage2(int originDamage, RefValue<int> refValue)
{
if (_value > 0)
{
refValue.Value += Mathf.CeilToInt(originDamage * _value);
}
else
{
refValue.Value = Mathf.Max(1, refValue.Value - Mathf.FloorToInt(refValue.Value * _value));
}
}
}

View File

@ -0,0 +1,30 @@
using System.Collections.Generic;
[Buff("MaxHp", "血量上限 buff, 参数1为血量上限值")]
public class Buff_MaxHp : BuffFragment
{
private List<ulong> _cacheId = new List<ulong>();
private int _maxHp;
public override void InitParam(float arg1)
{
_maxHp = (int)arg1;
}
public override void OnPickUpItem()
{
Role.MaxHp += _maxHp;
var instanceId = Role.GetInstanceId();
if (!_cacheId.Contains(instanceId))
{
_cacheId.Add(instanceId);
Role.Hp += _maxHp;
}
}
public override void OnRemoveItem()
{
Role.MaxHp -= _maxHp;
}
}

View File

@ -0,0 +1,30 @@
using System.Collections.Generic;
[Buff("MaxShield", "护盾上限buff, 参数1为护盾上限")]
public class Buff_MaxShield : BuffFragment
{
private List<ulong> _cacheId = new List<ulong>();
private int _maxShield;
public override void InitParam(float arg1)
{
_maxShield = (int)arg1;
}
public override void OnPickUpItem()
{
Role.MaxShield += _maxShield;
var instanceId = Role.GetInstanceId();
if (!_cacheId.Contains(instanceId))
{
_cacheId.Add(instanceId);
Role.Shield += _maxShield;
}
}
public override void OnRemoveItem()
{
Role.MaxShield -= _maxShield;
}
}

View File

@ -0,0 +1,25 @@
[Buff("MoveSpeed", "移速 buff, 参数1为移动速度值")]
public class Buff_MoveSpeed : BuffFragment
{
private float _moveSpeed;
public override void InitParam(float arg1)
{
_moveSpeed = arg1;
}
public override void OnPickUpItem()
{
Role.RoleState.MoveSpeed += _moveSpeed;
Role.RoleState.Acceleration += _moveSpeed * 1.4f;
Role.RoleState.Friction += _moveSpeed * 10;
}
public override void OnRemoveItem()
{
Role.RoleState.MoveSpeed -= _moveSpeed;
Role.RoleState.Acceleration -= _moveSpeed * 1.4f;
Role.RoleState.Friction -= _moveSpeed * 10;
}
}

View File

@ -0,0 +1,29 @@
[Buff("OffsetInjury", "受伤时有概率抵消伤害的buff, 参数1为抵消伤害概率百分比(小数)")]
public class Buff_OffsetInjury : BuffFragment
{
private float _value;
public override void InitParam(float arg1)
{
_value = arg1;
}
public override void OnPickUpItem()
{
Role.RoleState.CalcHurtDamageEvent += CalcHurtDamageEvent;
}
public override void OnRemoveItem()
{
Role.RoleState.CalcHurtDamageEvent -= CalcHurtDamageEvent;
}
private void CalcHurtDamageEvent(int originDamage, RefValue<int> refValue)
{
if (refValue.Value > 0 && Utils.Random.RandomBoolean(_value))
{
refValue.Value = 0;
}
}
}

View File

@ -0,0 +1,31 @@
[Buff("RandomBulletSpeed",
"子弹增加随机速度 buff, " +
"参数1为增加子弹速度下限, " +
"参数2为增加子弹速度上限, 会从上限和下限随机抽取值")]
public class Buff_RandomBulletSpeed : BuffFragment
{
private float _min;
private float _max;
public override void InitParam(float arg1, float arg2)
{
_min = arg1;
_max = arg2;
}
public override void OnPickUpItem()
{
Role.RoleState.CalcBulletSpeedEvent += CalcBulletSpeedEvent;
}
public override void OnRemoveItem()
{
Role.RoleState.CalcBulletSpeedEvent -= CalcBulletSpeedEvent;
}
private void CalcBulletSpeedEvent(float originSpeed, RefValue<float> speed)
{
speed.Value += originSpeed * Utils.Random.RandomRangeFloat(_min, _max);
}
}

View File

@ -0,0 +1,33 @@
[Buff("Scattering", "提高武器精准度buff, 参数1为提升的精准度百分比值(小数)")]
public class Buff_Scattering : BuffFragment
{
private float _value;
public override void InitParam(float arg1)
{
_value = arg1;
}
public override void OnPickUpItem()
{
Role.RoleState.CalcStartScatteringEvent += CalcStartScatteringEvent;
Role.RoleState.CalcFinalScatteringEvent += CalcFinalScatteringEvent;
}
public override void OnRemoveItem()
{
Role.RoleState.CalcStartScatteringEvent -= CalcStartScatteringEvent;
Role.RoleState.CalcFinalScatteringEvent -= CalcFinalScatteringEvent;
}
private void CalcStartScatteringEvent(float originValue, RefValue<float> refValue)
{
refValue.Value -= refValue.Value * _value;
}
private void CalcFinalScatteringEvent(float originValue, RefValue<float> refValue)
{
refValue.Value -= refValue.Value * _value;
}
}

View File

@ -0,0 +1,21 @@
[Buff("ShieldRecoveryTime", "单格护盾恢复时间, 参数1单位: 秒")]
public class Buff_ShieldRecoveryTime : BuffFragment
{
private float _time;
public override void InitParam(float arg1)
{
_time = arg1;
}
public override void OnPickUpItem()
{
Role.RoleState.ShieldRecoveryTime -= _time;
}
public override void OnRemoveItem()
{
Role.RoleState.ShieldRecoveryTime += _time;
}
}

View File

@ -0,0 +1,21 @@
[Buff("WeaponCapacity", "武器背包容量 buff, 参数1为武器背包增加的容量")]
public class Buff_WeaponCapacity : BuffFragment
{
private int _value;
public override void InitParam(float arg1)
{
_value = (int)arg1;
}
public override void OnPickUpItem()
{
Role.WeaponPack.SetCapacity(Role.WeaponPack.Capacity + _value);
}
public override void OnRemoveItem()
{
Role.WeaponPack.SetCapacity(Role.WeaponPack.Capacity - _value);
}
}

View File

@ -0,0 +1,21 @@
[Buff("WoundedInvincibleTime", "延长无敌时间buff, 参数1为延长时间, 单位秒")]
public class Buff_WoundedInvincibleTime : BuffFragment
{
private float _time;
public override void InitParam(float arg1)
{
_time = arg1;
}
public override void OnPickUpItem()
{
Role.RoleState.WoundedInvincibleTime += _time;
}
public override void OnRemoveItem()
{
Role.RoleState.WoundedInvincibleTime -= _time;
}
}

View File

@ -0,0 +1,45 @@
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

@ -59,11 +59,11 @@ public enum EventEnum
/// </summary>
OnPlayerRemoveWeapon,
/// <summary>
/// 玩家拾起道具, 参数为<see cref="Prop"/>
/// 玩家拾起道具, 参数为<see cref="PropActivity"/>
/// </summary>
OnPlayerPickUpProp,
/// <summary>
/// 玩家丢弃道具, 参数为<see cref="Prop"/>
/// 玩家丢弃道具, 参数为<see cref="PropActivity"/>
/// </summary>
OnPlayerRemoveProp,

View File

@ -0,0 +1,37 @@
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

@ -289,7 +289,7 @@ public abstract partial class EditorTools : UiBase
}
/// <summary>
/// 类型: <see cref="Godot.Label"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7.Label
/// 类型: <see cref="Godot.Label"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.Label
/// </summary>
public class Label_4 : UiNode<EditorToolsPanel, Godot.Label, Label_4>
{
@ -298,7 +298,7 @@ public abstract partial class EditorTools : UiBase
}
/// <summary>
/// 类型: <see cref="Godot.Button"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7.Button
/// 类型: <see cref="Godot.Button"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.Button
/// </summary>
public class Button_4 : UiNode<EditorToolsPanel, Godot.Button, Button_4>
{
@ -307,9 +307,9 @@ public abstract partial class EditorTools : UiBase
}
/// <summary>
/// 类型: <see cref="Godot.HBoxContainer"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7
/// 类型: <see cref="Godot.HBoxContainer"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6
/// </summary>
public class HBoxContainer7 : UiNode<EditorToolsPanel, Godot.HBoxContainer, HBoxContainer7>
public class HBoxContainer6 : UiNode<EditorToolsPanel, Godot.HBoxContainer, HBoxContainer6>
{
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Label"/>, 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Label
@ -337,12 +337,12 @@ public abstract partial class EditorTools : UiBase
}
private Button_4 _L_Button;
public HBoxContainer7(EditorToolsPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
public override HBoxContainer7 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
public HBoxContainer6(EditorToolsPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
public override HBoxContainer6 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
}
/// <summary>
/// 类型: <see cref="Godot.Label"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8.Label
/// 类型: <see cref="Godot.Label"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7.Label
/// </summary>
public class Label_5 : UiNode<EditorToolsPanel, Godot.Label, Label_5>
{
@ -351,7 +351,7 @@ public abstract partial class EditorTools : UiBase
}
/// <summary>
/// 类型: <see cref="Godot.Button"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8.Button
/// 类型: <see cref="Godot.Button"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7.Button
/// </summary>
public class Button_5 : UiNode<EditorToolsPanel, Godot.Button, Button_5>
{
@ -360,9 +360,9 @@ public abstract partial class EditorTools : UiBase
}
/// <summary>
/// 类型: <see cref="Godot.HBoxContainer"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8
/// 类型: <see cref="Godot.HBoxContainer"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7
/// </summary>
public class HBoxContainer8 : UiNode<EditorToolsPanel, Godot.HBoxContainer, HBoxContainer8>
public class HBoxContainer7 : UiNode<EditorToolsPanel, Godot.HBoxContainer, HBoxContainer7>
{
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Label"/>, 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Label
@ -390,6 +390,59 @@ public abstract partial class EditorTools : UiBase
}
private Button_5 _L_Button;
public HBoxContainer7(EditorToolsPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
public override HBoxContainer7 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
}
/// <summary>
/// 类型: <see cref="Godot.Label"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8.Label
/// </summary>
public class Label_6 : UiNode<EditorToolsPanel, Godot.Label, Label_6>
{
public Label_6(EditorToolsPanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
public override Label_6 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
}
/// <summary>
/// 类型: <see cref="Godot.Button"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8.Button
/// </summary>
public class Button_6 : UiNode<EditorToolsPanel, Godot.Button, Button_6>
{
public Button_6(EditorToolsPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
public override Button_6 Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
}
/// <summary>
/// 类型: <see cref="Godot.HBoxContainer"/>, 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8
/// </summary>
public class HBoxContainer8 : UiNode<EditorToolsPanel, Godot.HBoxContainer, HBoxContainer8>
{
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Label"/>, 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Label
/// </summary>
public Label_6 L_Label
{
get
{
if (_L_Label == null) _L_Label = new Label_6(UiPanel, Instance.GetNode<Godot.Label>("Label"));
return _L_Label;
}
}
private Label_6 _L_Label;
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Button"/>, 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Button
/// </summary>
public Button_6 L_Button
{
get
{
if (_L_Button == null) _L_Button = new Button_6(UiPanel, Instance.GetNode<Godot.Button>("Button"));
return _L_Button;
}
}
private Button_6 _L_Button;
public HBoxContainer8(EditorToolsPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
public override HBoxContainer8 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
}
@ -451,6 +504,19 @@ public abstract partial class EditorTools : UiBase
}
private HBoxContainer5 _L_HBoxContainer5;
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: EditorTools.ScrollContainer.MarginContainer.HBoxContainer6
/// </summary>
public HBoxContainer6 L_HBoxContainer6
{
get
{
if (_L_HBoxContainer6 == null) _L_HBoxContainer6 = new HBoxContainer6(UiPanel, Instance.GetNode<Godot.HBoxContainer>("HBoxContainer6"));
return _L_HBoxContainer6;
}
}
private HBoxContainer6 _L_HBoxContainer6;
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: EditorTools.ScrollContainer.MarginContainer.HBoxContainer7
/// </summary>
@ -569,6 +635,11 @@ public abstract partial class EditorTools : UiBase
/// </summary>
public HBoxContainer5 S_HBoxContainer5 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer5;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6
/// </summary>
public HBoxContainer6 S_HBoxContainer6 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer6;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7
/// </summary>

View File

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using Godot;
using Environment = System.Environment;
@ -57,6 +59,8 @@ public partial class EditorToolsPanel : EditorTools, ISerializationListener
container.L_HBoxContainer3.L_Button.Instance.Pressed += OnCreateUI;
//重新生成UiManagerMethods.cs代码
container.L_HBoxContainer5.L_Button.Instance.Pressed += GenerateUiManagerMethods;
//生成buff属性表
container.L_HBoxContainer6.L_Button.Instance.Pressed += GenerateBuffAttrTable;
//导出excel表
container.L_HBoxContainer7.L_Button.Instance.Pressed += ExportExcel;
//打开excel表文件夹
@ -78,6 +82,7 @@ public partial class EditorToolsPanel : EditorTools, ISerializationListener
container.L_HBoxContainer4.L_Button.Instance.Pressed -= OnGenerateCurrentUiCode;
container.L_HBoxContainer3.L_Button.Instance.Pressed -= OnCreateUI;
container.L_HBoxContainer5.L_Button.Instance.Pressed -= GenerateUiManagerMethods;
container.L_HBoxContainer6.L_Button.Instance.Pressed -= GenerateBuffAttrTable;
container.L_HBoxContainer7.L_Button.Instance.Pressed -= ExportExcel;
container.L_HBoxContainer8.L_Button.Instance.Pressed -= OpenExportExcelFolder;
}
@ -297,6 +302,21 @@ public partial class EditorToolsPanel : EditorTools, ISerializationListener
ShowTips("错误", "生成UiManagerMethods.cs代码执行失败! 前往控制台查看错误日志!");
}
}
/// <summary>
/// 生成Buff属性表
/// </summary>
private void GenerateBuffAttrTable()
{
if (BuffGenerator.Generate())
{
ShowTips("提示", "Buff属性表生成完成!");
}
else
{
ShowTips("错误", "uff属性表生成失败! 前往控制台查看错误日志!");
}
}
/// <summary>
/// 导出excel表

View File

@ -73,7 +73,7 @@ public partial class RoomUIPanel : RoomUI
//玩家拾起道具, 弹出提示
private void OnPlayerPickUpProp(object propObj)
{
var prop = (Prop)propObj;
var prop = (PropActivity)propObj;
var message = $"{prop.ActivityBase.Name}\n{prop.ActivityBase.Intro}";
BottomTipsPanel.ShowTips(prop.GetDefaultTexture(), message);
}