diff --git a/.gitignore b/.gitignore index 7227cb36..5923e103 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ /DungeonShooting_Godot/DungeonShooting.sln.DotSettings.user /DungeonShooting_Godot/.VSCodeCounter **/*.txt +/DungeonShooting_Godot/buffTable \ No newline at end of file diff --git a/DungeonShooting_Godot/addons/dungeonShooting_plugin/generator/BuffGenerator.cs b/DungeonShooting_Godot/addons/dungeonShooting_plugin/generator/BuffGenerator.cs index 92ce289b..af7db642 100644 --- a/DungeonShooting_Godot/addons/dungeonShooting_plugin/generator/BuffGenerator.cs +++ b/DungeonShooting_Godot/addons/dungeonShooting_plugin/generator/BuffGenerator.cs @@ -15,8 +15,74 @@ public static class BuffGenerator { public static bool Generate() { + PropFragmentRegister.Init(); + var outStr = "# 道具逻辑属性表\n\n"; + + outStr += GetSplit("Buff 属性片段"); + outStr += GetTableTitle(); + foreach (var fragment in PropFragmentRegister.BuffFragmentInfos) + { + outStr += GetTableLine(fragment.Value); + } + outStr += "\n\n"; + + outStr += GetSplit("主动道具使用条件片段"); + outStr += GetTableTitle(); + foreach (var fragment in PropFragmentRegister.ConditionFragmentInfos) + { + outStr += GetTableLine(fragment.Value); + } + outStr += "\n\n"; + + outStr += GetSplit("主动道具使用效果片段"); + outStr += GetTableTitle(); + foreach (var fragment in PropFragmentRegister.EffectFragmentInfos) + { + outStr += GetTableLine(fragment.Value); + } + outStr += "\n\n"; + + outStr += GetSplit("主动道具充能条件片段"); + outStr += GetTableTitle(); + foreach (var fragment in PropFragmentRegister.ChargeFragmentInfos) + { + outStr += GetTableLine(fragment.Value); + } + outStr += "\n\n"; + + if (!Directory.Exists("buffTable")) + { + Directory.CreateDirectory("buffTable"); + } + File.WriteAllText("buffTable/BuffTable.md", outStr); return true; } - + + private static string GetSplit(string title) + { + return $"---\n### {title}\n"; + } + + private static string GetTableTitle() + { + return $"| 属性名称 | 描述 | 参数 |\n" + + $"|-|-|-|\n"; + } + + private static string GetTableLine(PropFragmentInfo fragmentInfo) + { + var arg = ""; + for (var i = 0; i < fragmentInfo.ArgInfos.Count; i++) + { + var argInfo = fragmentInfo.ArgInfos[i]; + if (i > 0) + { + arg += "
"; + } + arg += $"参数{argInfo.ArgIndex}: {argInfo.Description}"; + } + + return $"| {fragmentInfo.Name} | {fragmentInfo.Description} | {arg} |\n"; + } } #endif diff --git a/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletCount.cs b/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletCount.cs index 15944b10..8d58e33b 100644 --- a/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletCount.cs +++ b/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletCount.cs @@ -4,7 +4,7 @@ using Godot; [BuffFragment( "BulletCount", - "子弹数量 buff, ", + "子弹数量 buff", Arg1 = "(int)子弹数量添加类型, 1: 具体数量, 2:百分比", Arg2 = "(float)增加子弹的数量" )] diff --git a/DungeonShooting_Godot/src/game/data/PropFragmentInfo.cs b/DungeonShooting_Godot/src/game/data/PropFragmentInfo.cs index 578ad43f..8c1fd1be 100644 --- a/DungeonShooting_Godot/src/game/data/PropFragmentInfo.cs +++ b/DungeonShooting_Godot/src/game/data/PropFragmentInfo.cs @@ -1,11 +1,31 @@ using System; +using System.Collections.Generic; /// /// 道具逻辑片段数据 /// public class PropFragmentInfo { + public class PropFragmentArgInfo + { + /// + /// 参数索引 + /// + public int ArgIndex; + + /// + /// 参数描述 + /// + public string Description; + + public PropFragmentArgInfo(int argIndex, string description) + { + ArgIndex = argIndex; + Description = description; + } + } + /// /// buff 名称 /// @@ -21,10 +41,48 @@ public class PropFragmentInfo /// public Type Type; - public PropFragmentInfo(string name, string description, Type type) + /// + /// buff 参数信息 + /// + public List ArgInfos = new List(); + + public PropFragmentInfo(FragmentAttribute attribute, Type type) { - Name = name; - Description = description; + Name = attribute.Name; + Description = attribute.Description; Type = type; + + if (attribute.Arg1 != null) + { + ArgInfos.Add(new PropFragmentArgInfo(1, attribute.Arg1)); + } + if (attribute.Arg2 != null) + { + ArgInfos.Add(new PropFragmentArgInfo(2, attribute.Arg2)); + } + if (attribute.Arg3 != null) + { + ArgInfos.Add(new PropFragmentArgInfo(3, attribute.Arg3)); + } + if (attribute.Arg4 != null) + { + ArgInfos.Add(new PropFragmentArgInfo(4, attribute.Arg4)); + } + if (attribute.Arg5 != null) + { + ArgInfos.Add(new PropFragmentArgInfo(5, attribute.Arg5)); + } + if (attribute.Arg6 != null) + { + ArgInfos.Add(new PropFragmentArgInfo(6, attribute.Arg6)); + } + if (attribute.Arg7 != null) + { + ArgInfos.Add(new PropFragmentArgInfo(7, attribute.Arg7)); + } + if (attribute.Arg8 != null) + { + ArgInfos.Add(new PropFragmentArgInfo(8, attribute.Arg8)); + } } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/manager/PropFragmentRegister.cs b/DungeonShooting_Godot/src/game/manager/PropFragmentRegister.cs index 8dc20b3f..01c18bd8 100644 --- a/DungeonShooting_Godot/src/game/manager/PropFragmentRegister.cs +++ b/DungeonShooting_Godot/src/game/manager/PropFragmentRegister.cs @@ -53,7 +53,7 @@ public class PropFragmentRegister continue; } - var buffInfo = new PropFragmentInfo(attribute.Name, attribute.Description, type); + var buffInfo = new PropFragmentInfo(attribute, type); BuffFragmentInfos.Add(attribute.Name, buffInfo); } } @@ -71,7 +71,7 @@ public class PropFragmentRegister continue; } - var conditionInfo = new PropFragmentInfo(attribute.Name, attribute.Description, type); + var conditionInfo = new PropFragmentInfo(attribute, type); ConditionFragmentInfos.Add(attribute.Name, conditionInfo); } } @@ -89,7 +89,7 @@ public class PropFragmentRegister continue; } - var effectInfo = new PropFragmentInfo(attribute.Name, attribute.Description, type); + var effectInfo = new PropFragmentInfo(attribute, type); EffectFragmentInfos.Add(attribute.Name, effectInfo); } } @@ -107,7 +107,7 @@ public class PropFragmentRegister continue; } - var chargeInfo = new PropFragmentInfo(attribute.Name, attribute.Description, type); + var chargeInfo = new PropFragmentInfo(attribute, type); ChargeFragmentInfos.Add(attribute.Name, chargeInfo); } }