diff --git a/DungeonShooting_Godot/prefab/ui/EditorTools.tscn b/DungeonShooting_Godot/prefab/ui/EditorTools.tscn index 9817a68..b8857a4 100644 --- a/DungeonShooting_Godot/prefab/ui/EditorTools.tscn +++ b/DungeonShooting_Godot/prefab/ui/EditorTools.tscn @@ -88,6 +88,18 @@ 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 diff --git a/DungeonShooting_Godot/src/config/ExcelConfig.cs b/DungeonShooting_Godot/src/config/ExcelConfig.cs index 8bb7fd3..0f3fe56 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig.cs @@ -8,22 +8,13 @@ public static partial class ExcelConfig { /// - /// Sound.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 + /// ActivityBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 /// - public static List Sound_List { get; private set; } + public static List ActivityBase_List { get; private set; } /// - /// Sound.xlsx表数据集合, 里 Map 形式存储, key 为 Id + /// ActivityBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id /// - public static Dictionary Sound_Map { get; private set; } - - /// - /// WeaponBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 - /// - public static List WeaponBase_List { get; private set; } - /// - /// WeaponBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id - /// - public static Dictionary WeaponBase_Map { get; private set; } + public static Dictionary ActivityBase_Map { get; private set; } /// /// ActivityMaterial.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 @@ -62,15 +53,6 @@ public static Dictionary EnemyBase_Map { get; private set; } /// - /// ActivityBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 - /// - public static List ActivityBase_List { get; private set; } - /// - /// ActivityBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id - /// - public static Dictionary ActivityBase_Map { get; private set; } - - /// /// LiquidMaterial.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 /// public static List LiquidMaterial_List { get; private set; } @@ -79,6 +61,24 @@ /// public static Dictionary LiquidMaterial_Map { get; private set; } + /// + /// Sound.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 + /// + public static List Sound_List { get; private set; } + /// + /// Sound.xlsx表数据集合, 里 Map 形式存储, key 为 Id + /// + public static Dictionary Sound_Map { get; private set; } + + /// + /// WeaponBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 + /// + public static List WeaponBase_List { get; private set; } + /// + /// WeaponBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id + /// + public static Dictionary WeaponBase_Map { get; private set; } + private static bool _init = false; /// @@ -89,53 +89,35 @@ if (_init) return; _init = true; - _InitSoundConfig(); - _InitWeaponBaseConfig(); + _InitActivityBaseConfig(); _InitActivityMaterialConfig(); _InitAiAttackAttrConfig(); _InitBulletBaseConfig(); _InitEnemyBaseConfig(); - _InitActivityBaseConfig(); _InitLiquidMaterialConfig(); + _InitSoundConfig(); + _InitWeaponBaseConfig(); - _InitWeaponBaseRef(); - _InitEnemyBaseRef(); _InitActivityBaseRef(); + _InitEnemyBaseRef(); + _InitWeaponBaseRef(); } - private static void _InitSoundConfig() + private static void _InitActivityBaseConfig() { try { - var text = _ReadConfigAsText("res://resource/config/Sound.json"); - Sound_List = JsonSerializer.Deserialize>(text); - Sound_Map = new Dictionary(); - foreach (var item in Sound_List) + var text = _ReadConfigAsText("res://resource/config/ActivityBase.json"); + ActivityBase_List = new List(JsonSerializer.Deserialize>(text)); + ActivityBase_Map = new Dictionary(); + foreach (var item in ActivityBase_List) { - Sound_Map.Add(item.Id, item); + ActivityBase_Map.Add(item.Id, item); } } catch (Exception e) { GD.PrintErr(e.ToString()); - throw new Exception("初始化表'Sound'失败!"); - } - } - private static void _InitWeaponBaseConfig() - { - try - { - var text = _ReadConfigAsText("res://resource/config/WeaponBase.json"); - WeaponBase_List = new List(JsonSerializer.Deserialize>(text)); - WeaponBase_Map = new Dictionary(); - foreach (var item in WeaponBase_List) - { - WeaponBase_Map.Add(item.Id, item); - } - } - catch (Exception e) - { - GD.PrintErr(e.ToString()); - throw new Exception("初始化表'WeaponBase'失败!"); + throw new Exception("初始化表'ActivityBase'失败!"); } } private static void _InitActivityMaterialConfig() @@ -210,24 +192,6 @@ throw new Exception("初始化表'EnemyBase'失败!"); } } - private static void _InitActivityBaseConfig() - { - try - { - var text = _ReadConfigAsText("res://resource/config/ActivityBase.json"); - ActivityBase_List = new List(JsonSerializer.Deserialize>(text)); - ActivityBase_Map = new Dictionary(); - foreach (var item in ActivityBase_List) - { - ActivityBase_Map.Add(item.Id, item); - } - } - catch (Exception e) - { - GD.PrintErr(e.ToString()); - throw new Exception("初始化表'ActivityBase'失败!"); - } - } private static void _InitLiquidMaterialConfig() { try @@ -246,7 +210,81 @@ throw new Exception("初始化表'LiquidMaterial'失败!"); } } + private static void _InitSoundConfig() + { + try + { + var text = _ReadConfigAsText("res://resource/config/Sound.json"); + Sound_List = JsonSerializer.Deserialize>(text); + Sound_Map = new Dictionary(); + foreach (var item in Sound_List) + { + Sound_Map.Add(item.Id, item); + } + } + catch (Exception e) + { + GD.PrintErr(e.ToString()); + throw new Exception("初始化表'Sound'失败!"); + } + } + private static void _InitWeaponBaseConfig() + { + try + { + var text = _ReadConfigAsText("res://resource/config/WeaponBase.json"); + WeaponBase_List = new List(JsonSerializer.Deserialize>(text)); + WeaponBase_Map = new Dictionary(); + foreach (var item in WeaponBase_List) + { + WeaponBase_Map.Add(item.Id, item); + } + } + catch (Exception e) + { + GD.PrintErr(e.ToString()); + throw new Exception("初始化表'WeaponBase'失败!"); + } + } + private static void _InitActivityBaseRef() + { + foreach (Ref_ActivityBase item in ActivityBase_List) + { + try + { + if (!string.IsNullOrEmpty(item.__Material)) + { + item.Material = ActivityMaterial_Map[item.__Material]; + } + + } + catch (Exception e) + { + GD.PrintErr(e.ToString()); + throw new Exception("初始化'ActivityBase'引用其他表数据失败, 当前行id: " + item.Id); + } + } + } + private static void _InitEnemyBaseRef() + { + foreach (Ref_EnemyBase item in EnemyBase_List) + { + try + { + if (!string.IsNullOrEmpty(item.__Activity)) + { + item.Activity = ActivityBase_Map[item.__Activity]; + } + + } + catch (Exception e) + { + GD.PrintErr(e.ToString()); + throw new Exception("初始化'EnemyBase'引用其他表数据失败, 当前行id: " + item.Id); + } + } + } private static void _InitWeaponBaseRef() { foreach (Ref_WeaponBase item in WeaponBase_List) @@ -315,44 +353,6 @@ } } } - private static void _InitEnemyBaseRef() - { - foreach (Ref_EnemyBase item in EnemyBase_List) - { - try - { - if (!string.IsNullOrEmpty(item.__Activity)) - { - item.Activity = ActivityBase_Map[item.__Activity]; - } - - } - catch (Exception e) - { - GD.PrintErr(e.ToString()); - throw new Exception("初始化'EnemyBase'引用其他表数据失败, 当前行id: " + item.Id); - } - } - } - private static void _InitActivityBaseRef() - { - foreach (Ref_ActivityBase item in ActivityBase_List) - { - try - { - if (!string.IsNullOrEmpty(item.__Material)) - { - item.Material = ActivityMaterial_Map[item.__Material]; - } - - } - catch (Exception e) - { - GD.PrintErr(e.ToString()); - throw new Exception("初始化'ActivityBase'引用其他表数据失败, 当前行id: " + item.Id); - } - } - } private static string _ReadConfigAsText(string path) { var file = FileAccess.Open(path, FileAccess.ModeFlags.Read); diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_ActivePropsCapacity.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_ActivePropsCapacity.cs new file mode 100644 index 0000000..7163a9d --- /dev/null +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_ActivePropsCapacity.cs @@ -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); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletBounceCount.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletBounceCount.cs new file mode 100644 index 0000000..1f57944 --- /dev/null +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletBounceCount.cs @@ -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 bounce) + { + bounce.Value += _value; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletCount.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletCount.cs new file mode 100644 index 0000000..73ba367 --- /dev/null +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletCount.cs @@ -0,0 +1,26 @@ + +[Buff("BulletCount", "子弹数量 buff, 参数‘1’为增加子弹的数量")] +public class Buff_BulletCount : BuffFragment +{ + private int _value; + + public override void InitParam(float arg1) + { + _value = (int)arg1; + } + + public override void OnPickUpItem() + { + Role.RoleState.CalcBulletCountEvent += CalcBulletCountEvent; + } + + public override void OnRemoveItem() + { + Role.RoleState.CalcBulletCountEvent -= CalcBulletCountEvent; + } + + private void CalcBulletCountEvent(int originCount, RefValue refValue) + { + refValue.Value += _value; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletDeviationAngle.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletDeviationAngle.cs new file mode 100644 index 0000000..cf53c3c --- /dev/null +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletDeviationAngle.cs @@ -0,0 +1,28 @@ + +[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 refValue) + { + refValue.Value += Utils.Random.RandomRangeFloat(_min, _max); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletDistance.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletDistance.cs index 0739ebc..1fce770 100644 --- a/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletDistance.cs +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletDistance.cs @@ -1,7 +1,4 @@ -/// -/// 子弹射程 buff -/// [Buff("BulletDistance", "子弹射程 buff, 参数‘1’为射程增加类型: 1:具体射程, 2:百分比射程(小数), 参数‘2’为子弹增加的射程值")] public class Buff_BulletDistance : BuffFragment { diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletPenetration.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletPenetration.cs new file mode 100644 index 0000000..89040fa --- /dev/null +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletPenetration.cs @@ -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 penetration) + { + penetration.Value += _value; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletRepel.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletRepel.cs new file mode 100644 index 0000000..138b46a --- /dev/null +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletRepel.cs @@ -0,0 +1,54 @@ + +[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 repel) + { + if (Role.WeaponPack.ActiveItem != null && Role.WeaponPack.ActiveItem.Attribute.IsMelee) + { + return; + } + repel.Value += _value; + } + + private void CalcBulletRepelEvent2(float originRepel, RefValue repel) + { + if (Role.WeaponPack.ActiveItem != null && Role.WeaponPack.ActiveItem.Attribute.IsMelee) + { + return; + } + repel.Value += originRepel * _value; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletSpeed.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletSpeed.cs index a9adb10..d2f4c43 100644 --- a/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletSpeed.cs +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_BulletSpeed.cs @@ -1,7 +1,4 @@ -/// -/// 子弹速度 buff -/// [Buff("BulletSpeed", "子弹速度 buff, 参数‘1’为射速增加类型: 1:具体射速, 2:百分比射速(小数), 参数‘2’为子弹增加的射速值")] public class Buff_BulletSpeed : BuffFragment { diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_Damage.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_Damage.cs index 65933f7..b27008b 100644 --- a/DungeonShooting_Godot/src/game/buff/fragment/Buff_Damage.cs +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_Damage.cs @@ -1,9 +1,6 @@ using Godot; -/// -/// 提升伤害buff -/// [Buff("Damage", "提升伤害buff, 参数‘1’为伤害增加类型: 1:具体伤害, 2:百分比伤害(小数), 参数‘2’为增益伤害值")] public class Buff_Damage : BuffFragment { diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_MaxHp.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_MaxHp.cs index 0b7a645..bb6fea6 100644 --- a/DungeonShooting_Godot/src/game/buff/fragment/Buff_MaxHp.cs +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_MaxHp.cs @@ -1,9 +1,6 @@ using System.Collections.Generic; -/// -/// 血量上限 buff -/// [Buff("MaxHp", "血量上限 buff, 参数‘1’为血量上限值")] public class Buff_MaxHp : BuffFragment { diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_MaxShield.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_MaxShield.cs index e93f301..c63c816 100644 --- a/DungeonShooting_Godot/src/game/buff/fragment/Buff_MaxShield.cs +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_MaxShield.cs @@ -1,9 +1,6 @@ using System.Collections.Generic; -/// -/// 护盾上限buff -/// [Buff("MaxShield", "护盾上限buff, 参数‘1’为护盾上限")] public class Buff_MaxShield : BuffFragment { diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_MoveSpeed.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_MoveSpeed.cs index 96419d1..04c5cd8 100644 --- a/DungeonShooting_Godot/src/game/buff/fragment/Buff_MoveSpeed.cs +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_MoveSpeed.cs @@ -1,7 +1,4 @@ -/// -/// 移速 buff -/// [Buff("MoveSpeed", "移速 buff, 参数‘1’为移动速度值")] public class Buff_MoveSpeed : BuffFragment { diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_OffsetInjury.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_OffsetInjury.cs index 40679bc..c617952 100644 --- a/DungeonShooting_Godot/src/game/buff/fragment/Buff_OffsetInjury.cs +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_OffsetInjury.cs @@ -1,7 +1,4 @@ -/// -/// 受伤时有概率抵消伤害的buff -/// [Buff("OffsetInjury", "受伤时有概率抵消伤害的buff, 参数‘1’为抵消伤害概率百分比(小数)")] public class Buff_OffsetInjury : BuffFragment { diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_Scattering.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_Scattering.cs index 387309a..bf0eaa0 100644 --- a/DungeonShooting_Godot/src/game/buff/fragment/Buff_Scattering.cs +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_Scattering.cs @@ -1,7 +1,4 @@ -/// -/// 提高武器精准度buff -/// [Buff("Scattering", "提高武器精准度buff, 参数‘1’为提升的精准度百分比值(小数)")] public class Buff_Scattering : BuffFragment { diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_ShieldRecoveryTime.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_ShieldRecoveryTime.cs index 078e887..18d2b69 100644 --- a/DungeonShooting_Godot/src/game/buff/fragment/Buff_ShieldRecoveryTime.cs +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_ShieldRecoveryTime.cs @@ -1,7 +1,4 @@ -/// -/// 护盾恢复时间buff -/// [Buff("ShieldRecoveryTime", "单格护盾恢复时间, 参数‘1’单位: 秒")] public class Buff_ShieldRecoveryTime : BuffFragment { diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_WeaponCapacity.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_WeaponCapacity.cs new file mode 100644 index 0000000..fd7ef35 --- /dev/null +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_WeaponCapacity.cs @@ -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); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_WoundedInvincibleTime.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_WoundedInvincibleTime.cs index b79cf70..f7184ab 100644 --- a/DungeonShooting_Godot/src/game/buff/fragment/Buff_WoundedInvincibleTime.cs +++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_WoundedInvincibleTime.cs @@ -1,7 +1,4 @@ -/// -/// 延长无敌时间buff -/// [Buff("WoundedInvincibleTime", "延长无敌时间buff, 参数‘1’为延长时间, 单位秒")] public class Buff_WoundedInvincibleTime : BuffFragment { diff --git a/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs b/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs index ea4d712..ac640c4 100644 --- a/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs +++ b/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs @@ -289,7 +289,7 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7.Label + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.Label /// public class Label_4 : UiNode { @@ -298,7 +298,7 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7.Button + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.Button /// public class Button_4 : UiNode { @@ -307,9 +307,9 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7 + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6 /// - public class HBoxContainer7 : UiNode + public class HBoxContainer6 : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Label @@ -337,12 +337,12 @@ } 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()); } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8.Label + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7.Label /// public class Label_5 : UiNode { @@ -351,7 +351,7 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8.Button + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7.Button /// public class Button_5 : UiNode { @@ -360,9 +360,9 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8 + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7 /// - public class HBoxContainer8 : UiNode + public class HBoxContainer7 : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Label @@ -390,6 +390,59 @@ } 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()); + } + + /// + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8.Label + /// + public class Label_6 : UiNode + { + public Label_6(EditorToolsPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override Label_6 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8.Button + /// + public class Button_6 : UiNode + { + public Button_6(EditorToolsPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override Button_6 Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer8 + /// + public class HBoxContainer8 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Label + /// + public Label_6 L_Label + { + get + { + if (_L_Label == null) _L_Label = new Label_6(UiPanel, Instance.GetNode("Label")); + return _L_Label; + } + } + private Label_6 _L_Label; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Button + /// + public Button_6 L_Button + { + get + { + if (_L_Button == null) _L_Button = new Button_6(UiPanel, Instance.GetNode("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()); } @@ -452,6 +505,19 @@ private HBoxContainer5 _L_HBoxContainer5; /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.HBoxContainer6 + /// + public HBoxContainer6 L_HBoxContainer6 + { + get + { + if (_L_HBoxContainer6 == null) _L_HBoxContainer6 = new HBoxContainer6(UiPanel, Instance.GetNode("HBoxContainer6")); + return _L_HBoxContainer6; + } + } + private HBoxContainer6 _L_HBoxContainer6; + + /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.HBoxContainer7 /// public HBoxContainer7 L_HBoxContainer7 @@ -570,6 +636,11 @@ public HBoxContainer5 S_HBoxContainer5 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer5; /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6 + /// + public HBoxContainer6 S_HBoxContainer6 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer6; + + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7 /// public HBoxContainer7 S_HBoxContainer7 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer7; diff --git a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs index c63e847..6b7482c 100644 --- a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs @@ -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 @@ 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 @@ 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,30 @@ ShowTips("错误", "生成UiManagerMethods.cs代码执行失败! 前往控制台查看错误日志!"); } } + + /// + /// 生成Buff属性表 + /// + private void GenerateBuffAttrTable() + { + var str = ""; + var types = GetType().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) + { + //var baeMethod = typeof(BuffFragment).GetMethod(nameof(BuffFragment.InitParam), BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly, new Type[] { typeof(float) }); + //var methodInfo = type.GetMethod(nameof(BuffFragment.InitParam), BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly, new Type[] { typeof(float) }); + //str += $"{attribute.BuffName}: {methodInfo != baeMethod}, {baeMethod != null}\n"; + str += $"{attribute.BuffName}: {attribute.Description}\n"; + } + } + GD.Print("-------------------------------------------"); + GD.Print(str); + } /// /// 导出excel表