diff --git a/DungeonShooting_Godot/excel/ActivePropBase.xlsx b/DungeonShooting_Godot/excel/ActivePropBase.xlsx index 65bdb9c..328dfa1 100644 --- a/DungeonShooting_Godot/excel/ActivePropBase.xlsx +++ b/DungeonShooting_Godot/excel/ActivePropBase.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/BuffPropBase.xlsx b/DungeonShooting_Godot/excel/BuffPropBase.xlsx index 708a012..42fa73c 100644 --- a/DungeonShooting_Godot/excel/BuffPropBase.xlsx +++ b/DungeonShooting_Godot/excel/BuffPropBase.xlsx Binary files differ diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_ActivePropBase.cs b/DungeonShooting_Godot/src/config/ExcelConfig_ActivePropBase.cs index f4f6479..f2a7f17 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig_ActivePropBase.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig_ActivePropBase.cs @@ -31,7 +31,7 @@ /// value为buff初始化参数 /// [JsonInclude] - public Dictionary Buff; + public Dictionary Buff; /// /// 道具使用条件
@@ -39,7 +39,7 @@ /// 性名称请参阅condition属性表 ///
[JsonInclude] - public Dictionary Condition; + public Dictionary Condition; /// /// 道具使用效果
@@ -47,7 +47,7 @@ /// 性名称请参阅effect属性表 ///
[JsonInclude] - public Dictionary Effect; + public Dictionary Effect; /// /// 道具充能效果
@@ -56,7 +56,7 @@ /// 注意: 仅当'IsConsumables'为false是生效 ///
[JsonInclude] - public Dictionary Charge; + public Dictionary Charge; /// /// 使用道具的效果持续时间
diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_BuffPropBase.cs b/DungeonShooting_Godot/src/config/ExcelConfig_BuffPropBase.cs index 24f0e66..45c042d 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig_BuffPropBase.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig_BuffPropBase.cs @@ -31,7 +31,7 @@ /// value为buff初始化参数 ///
[JsonInclude] - public Dictionary Buff; + public Dictionary Buff; /// /// 返回浅拷贝出的新对象 diff --git a/DungeonShooting_Godot/src/game/activity/prop/ActiveProp.cs b/DungeonShooting_Godot/src/game/activity/prop/ActiveProp.cs index 6a9cafb..f349336 100644 --- a/DungeonShooting_Godot/src/game/activity/prop/ActiveProp.cs +++ b/DungeonShooting_Godot/src/game/activity/prop/ActiveProp.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; +using System.Text.Json; using Config; using Godot; @@ -121,43 +122,9 @@ { var buffInfo = PropFragmentRegister.BuffFragmentInfos[keyValuePair.Key]; var item = keyValuePair.Value; - switch (item.Length) - { - case 0: - { - var buff = (BuffFragment)AddComponent(buffInfo.Type); - _buffFragment.Add(buff); - } - break; - case 1: - { - var buff = (BuffFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0]); - _buffFragment.Add(buff); - } - break; - case 2: - { - var buff = (BuffFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1]); - _buffFragment.Add(buff); - } - break; - case 3: - { - var buff = (BuffFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1], item[2]); - _buffFragment.Add(buff); - } - break; - case 4: - { - var buff = (BuffFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1], item[2], item[3]); - _buffFragment.Add(buff); - } - break; - } + var buff = (BuffFragment)AddComponent(buffInfo.Type); + buff.InitParam(item); + _buffFragment.Add(buff); } } @@ -168,43 +135,9 @@ { var buffInfo = PropFragmentRegister.ConditionFragmentInfos[keyValuePair.Key]; var item = keyValuePair.Value; - switch (item.Length) - { - case 0: - { - var buff = (ConditionFragment)AddComponent(buffInfo.Type); - _conditionFragment.Add(buff); - } - break; - case 1: - { - var buff = (ConditionFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0]); - _conditionFragment.Add(buff); - } - break; - case 2: - { - var buff = (ConditionFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1]); - _conditionFragment.Add(buff); - } - break; - case 3: - { - var buff = (ConditionFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1], item[2]); - _conditionFragment.Add(buff); - } - break; - case 4: - { - var buff = (ConditionFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1], item[2], item[3]); - _conditionFragment.Add(buff); - } - break; - } + var buff = (ConditionFragment)AddComponent(buffInfo.Type); + buff.InitParam(item); + _conditionFragment.Add(buff); } } @@ -215,43 +148,9 @@ { var buffInfo = PropFragmentRegister.EffectFragmentInfos[keyValuePair.Key]; var item = keyValuePair.Value; - switch (item.Length) - { - case 0: - { - var buff = (EffectFragment)AddComponent(buffInfo.Type); - _effectFragment.Add(buff); - } - break; - case 1: - { - var buff = (EffectFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0]); - _effectFragment.Add(buff); - } - break; - case 2: - { - var buff = (EffectFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1]); - _effectFragment.Add(buff); - } - break; - case 3: - { - var buff = (EffectFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1], item[2]); - _effectFragment.Add(buff); - } - break; - case 4: - { - var buff = (EffectFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1], item[2], item[3]); - _effectFragment.Add(buff); - } - break; - } + var buff = (EffectFragment)AddComponent(buffInfo.Type); + buff.InitParam(item); + _effectFragment.Add(buff); } } @@ -262,43 +161,9 @@ { var buffInfo = PropFragmentRegister.ChargeFragmentInfos[keyValuePair.Key]; var item = keyValuePair.Value; - switch (item.Length) - { - case 0: - { - var buff = (ChargeFragment)AddComponent(buffInfo.Type); - _chargeFragment.Add(buff); - } - break; - case 1: - { - var buff = (ChargeFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0]); - _chargeFragment.Add(buff); - } - break; - case 2: - { - var buff = (ChargeFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1]); - _chargeFragment.Add(buff); - } - break; - case 3: - { - var buff = (ChargeFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1], item[2]); - _chargeFragment.Add(buff); - } - break; - case 4: - { - var buff = (ChargeFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1], item[2], item[3]); - _chargeFragment.Add(buff); - } - break; - } + var buff = (ChargeFragment)AddComponent(buffInfo.Type); + buff.InitParam(item); + _chargeFragment.Add(buff); } } @@ -626,70 +491,14 @@ Master.ThrowActiveProp(PackageIndex); } - /// /// 添加被动属性 /// - public void AddBuffFragment() where T : BuffFragment, new() + public void AddBuffFragment(JsonElement[] arg) where T : BuffFragment, new() { var fragment = AddComponent(); _buffFragment.Add(fragment); - if (Master != null) - { - fragment.OnPickUpItem(); - } - } - - /// - /// 添加被动属性 - /// - public void AddBuffFragment(float arg1) where T : BuffFragment, new() - { - var fragment = AddComponent(); - _buffFragment.Add(fragment); - fragment.InitParam(arg1); - if (Master != null) - { - fragment.OnPickUpItem(); - } - } - - /// - /// 添加被动属性 - /// - public void AddBuffFragment(float arg1, float arg2) where T : BuffFragment, new() - { - var fragment = AddComponent(); - _buffFragment.Add(fragment); - fragment.InitParam(arg1, arg2); - if (Master != null) - { - fragment.OnPickUpItem(); - } - } - - /// - /// 添加被动属性 - /// - public void AddBuffFragment(float arg1, float arg2, float arg3) where T : BuffFragment, new() - { - var fragment = AddComponent(); - _buffFragment.Add(fragment); - fragment.InitParam(arg1, arg2, arg3); - if (Master != null) - { - fragment.OnPickUpItem(); - } - } - - /// - /// 添加被动属性 - /// - public void AddBuffFragment(float arg1, float arg2, float arg3, float arg4) where T : BuffFragment, new() - { - var fragment = AddComponent(); - _buffFragment.Add(fragment); - fragment.InitParam(arg1, arg2, arg3, arg4); + fragment.InitParam(arg); if (Master != null) { fragment.OnPickUpItem(); diff --git a/DungeonShooting_Godot/src/game/activity/prop/BuffProp.cs b/DungeonShooting_Godot/src/game/activity/prop/BuffProp.cs index c3139db..bbbbafe 100644 --- a/DungeonShooting_Godot/src/game/activity/prop/BuffProp.cs +++ b/DungeonShooting_Godot/src/game/activity/prop/BuffProp.cs @@ -1,6 +1,7 @@  using System; using System.Collections.Generic; +using System.Text.Json; using Config; using Godot; @@ -30,43 +31,9 @@ { var buffInfo = PropFragmentRegister.BuffFragmentInfos[keyValuePair.Key]; var item = keyValuePair.Value; - switch (item.Length) - { - case 0: - { - var buff = (BuffFragment)AddComponent(buffInfo.Type); - _buffFragment.Add(buff); - } - break; - case 1: - { - var buff = (BuffFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0]); - _buffFragment.Add(buff); - } - break; - case 2: - { - var buff = (BuffFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1]); - _buffFragment.Add(buff); - } - break; - case 3: - { - var buff = (BuffFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1], item[2]); - _buffFragment.Add(buff); - } - break; - case 4: - { - var buff = (BuffFragment)AddComponent(buffInfo.Type); - buff.InitParam(item[0], item[1], item[2], item[3]); - _buffFragment.Add(buff); - } - break; - } + var buff = (BuffFragment)AddComponent(buffInfo.Type); + buff.InitParam(item); + _buffFragment.Add(buff); } } @@ -92,70 +59,15 @@ buffFragment.OnRemoveItem(); } } - - /// - /// 添加被动属性 - /// - public void AddBuffFragment() where T : BuffFragment, new() - { - var fragment = AddComponent(); - _buffFragment.Add(fragment); - if (Master != null) - { - fragment.OnPickUpItem(); - } - } /// /// 添加被动属性 /// - public void AddBuffFragment(float arg1) where T : BuffFragment, new() + public void AddBuffFragment(JsonElement[] arg) where T : BuffFragment, new() { var fragment = AddComponent(); _buffFragment.Add(fragment); - fragment.InitParam(arg1); - if (Master != null) - { - fragment.OnPickUpItem(); - } - } - - /// - /// 添加被动属性 - /// - public void AddBuffFragment(float arg1, float arg2) where T : BuffFragment, new() - { - var fragment = AddComponent(); - _buffFragment.Add(fragment); - fragment.InitParam(arg1, arg2); - if (Master != null) - { - fragment.OnPickUpItem(); - } - } - - /// - /// 添加被动属性 - /// - public void AddBuffFragment(float arg1, float arg2, float arg3) where T : BuffFragment, new() - { - var fragment = AddComponent(); - _buffFragment.Add(fragment); - fragment.InitParam(arg1, arg2, arg3); - if (Master != null) - { - fragment.OnPickUpItem(); - } - } - - /// - /// 添加被动属性 - /// - public void AddBuffFragment(float arg1, float arg2, float arg3, float arg4) where T : BuffFragment, new() - { - var fragment = AddComponent(); - _buffFragment.Add(fragment); - fragment.InitParam(arg1, arg2, arg3, arg4); + fragment.InitParam(arg); if (Master != null) { fragment.OnPickUpItem(); diff --git a/DungeonShooting_Godot/src/game/buff/PropFragment.cs b/DungeonShooting_Godot/src/game/buff/PropFragment.cs index 927ee2e..b1d6bd2 100644 --- a/DungeonShooting_Godot/src/game/buff/PropFragment.cs +++ b/DungeonShooting_Godot/src/game/buff/PropFragment.cs @@ -1,4 +1,6 @@ +using System.Text.Json; + /// /// 道具逻辑片段组件 /// @@ -10,6 +12,11 @@ public Role Role => Master?.Master; /// + /// 初始化被动属性参数 + /// + public abstract void InitParam(JsonElement[] args); + + /// /// 当道具被拾起时调用 (在 Role 赋值之后调用) /// public abstract void OnPickUpItem(); @@ -26,36 +33,4 @@ { return Master != null; } - - /// - /// 初始化被动属性参数 - /// - public virtual void InitParam(float arg1) - { - Debug.LogError($"'{GetType().FullName}'为实现1参数初始化函数!"); - } - - /// - /// 初始化被动属性参数 - /// - public virtual void InitParam(float arg1, float arg2) - { - Debug.LogError($"'{GetType().FullName}'为实现2参数初始化函数!"); - } - - /// - /// 初始化被动属性参数 - /// - public virtual void InitParam(float arg1, float arg2, float arg3) - { - Debug.LogError($"'{GetType().FullName}'为实现4参数初始化函数!"); - } - - /// - /// 初始化被动属性参数 - /// - public virtual void InitParam(float arg1, float arg2, float arg3, float arg4) - { - Debug.LogError($"'{GetType().FullName}'为实现4参数初始化函数!"); - } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/buff/Buff_ActivePropsCapacity.cs b/DungeonShooting_Godot/src/game/buff/buff/Buff_ActivePropsCapacity.cs index 6804fb9..75ea305 100644 --- a/DungeonShooting_Godot/src/game/buff/buff/Buff_ActivePropsCapacity.cs +++ b/DungeonShooting_Godot/src/game/buff/buff/Buff_ActivePropsCapacity.cs @@ -1,12 +1,14 @@ +using System.Text.Json; + [BuffFragment("ActivePropsCapacity", "主动道具背包容量 buff, 参数‘1’为主动道具背包增加的容量")] public class Buff_ActivePropsCapacity : BuffFragment { private int _value; - public override void InitParam(float arg1) + public override void InitParam(JsonElement[] arg) { - _value = (int)arg1; + _value = arg[0].GetInt32(); } public override void OnPickUpItem() diff --git a/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletBounceCount.cs b/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletBounceCount.cs index b68ac1a..950b5df 100644 --- a/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletBounceCount.cs +++ b/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletBounceCount.cs @@ -1,12 +1,14 @@ +using System.Text.Json; + [BuffFragment("BulletBounceCount", "子弹弹射数量 buff, 参数‘1’为增加的弹射次数")] public class Buff_BulletBounceCount : BuffFragment { private int _value; - public override void InitParam(float arg1) + public override void InitParam(JsonElement[] arg) { - _value = (int)arg1; + _value = arg[0].GetInt32(); } public override void OnPickUpItem() diff --git a/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletCount.cs b/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletCount.cs index 8f1bf17..686db6d 100644 --- a/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletCount.cs +++ b/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletCount.cs @@ -1,4 +1,5 @@ +using System.Text.Json; using Godot; [BuffFragment("BulletCount", @@ -10,10 +11,10 @@ private int _type; private float _value; - public override void InitParam(float arg1, float arg2) + public override void InitParam(JsonElement[] arg) { - _type = (int)arg1; - _value = (int)arg2; + _type = arg[0].GetInt32(); + _value = arg[1].GetSingle(); } public override void OnPickUpItem() diff --git a/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletDamage.cs b/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletDamage.cs index 93f13f6..20af6be 100644 --- a/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletDamage.cs +++ b/DungeonShooting_Godot/src/game/buff/buff/Buff_BulletDamage.cs @@ -1,4 +1,5 @@ +using System.Text.Json; using Godot; [BuffFragment("BulletDamage", @@ -10,10 +11,10 @@ private int _type; private float _value; - public override void InitParam(float arg1, float arg2) + public override void InitParam(JsonElement[] arg) { - _type = (int)arg1; - _value = arg2; + _type = arg[0].GetInt32(); + _value = arg[1].GetSingle(); } public override void OnPickUpItem() diff --git a/DungeonShooting_Godot/src/game/buff/charge/Cha_Hurt.cs b/DungeonShooting_Godot/src/game/buff/charge/Cha_Hurt.cs index 36c7885..0171883 100644 --- a/DungeonShooting_Godot/src/game/buff/charge/Cha_Hurt.cs +++ b/DungeonShooting_Godot/src/game/buff/charge/Cha_Hurt.cs @@ -1,13 +1,15 @@ +using System.Text.Json; + [ChargeFragment("Hurt", "造成伤害充能, 参数1为充满能量需要造成的伤害值")] public class Cha_Hurt : ChargeFragment { private int _value = 100; - public override void InitParam(float arg1) + public override void InitParam(JsonElement[] arg) { - _value = (int)arg1; + _value = arg[0].GetInt32(); } public override void OnUse() diff --git a/DungeonShooting_Godot/src/game/buff/condition/Cond_AmmoFull.cs b/DungeonShooting_Godot/src/game/buff/condition/Cond_AmmoFull.cs index 189f9e3..fea7207 100644 --- a/DungeonShooting_Godot/src/game/buff/condition/Cond_AmmoFull.cs +++ b/DungeonShooting_Godot/src/game/buff/condition/Cond_AmmoFull.cs @@ -1,4 +1,6 @@ +using System.Text.Json; + [ConditionFragment("AmmoFull", "判断当前武器弹药状态, " + "参数1可选值: 0:判断非满弹药, 1:判断满弹药")] @@ -6,9 +8,9 @@ { private int _type; - public override void InitParam(float arg1) + public override void InitParam(JsonElement[] arg) { - _type = (int)arg1; + _type = arg[0].GetInt32(); } public override bool OnCheckUse() diff --git a/DungeonShooting_Godot/src/game/buff/condition/Cond_HpFull.cs b/DungeonShooting_Godot/src/game/buff/condition/Cond_HpFull.cs index a6ff375..e386c6e 100644 --- a/DungeonShooting_Godot/src/game/buff/condition/Cond_HpFull.cs +++ b/DungeonShooting_Godot/src/game/buff/condition/Cond_HpFull.cs @@ -1,4 +1,6 @@ +using System.Text.Json; + [ConditionFragment("HpFull", "判断满血状态, " + "参数1可选值: 0:判断非满血, 1:判断满血")] @@ -6,9 +8,9 @@ { private int _type; - public override void InitParam(float arg1) + public override void InitParam(JsonElement[] arg) { - _type = (int)arg1; + _type = arg[0].GetInt32(); } public override bool OnCheckUse() diff --git a/DungeonShooting_Godot/src/game/buff/effect/Eff_AreaTrigger.cs b/DungeonShooting_Godot/src/game/buff/effect/Eff_AreaTrigger.cs index 69c0e16..b27a136 100644 --- a/DungeonShooting_Godot/src/game/buff/effect/Eff_AreaTrigger.cs +++ b/DungeonShooting_Godot/src/game/buff/effect/Eff_AreaTrigger.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; +using System.Text.Json; using Godot; [EffectFragment("AreaTrigger", @@ -13,9 +14,9 @@ private int _radius = 250; - public override void InitParam(float arg1) + public override void InitParam(JsonElement[] arg) { - _radius = (int)arg1; + _radius = arg[0].GetInt32(); } public override void Ready() diff --git a/DungeonShooting_Godot/src/game/buff/effect/Eff_Hp.cs b/DungeonShooting_Godot/src/game/buff/effect/Eff_Hp.cs index 1dc96e6..d1adddf 100644 --- a/DungeonShooting_Godot/src/game/buff/effect/Eff_Hp.cs +++ b/DungeonShooting_Godot/src/game/buff/effect/Eff_Hp.cs @@ -1,12 +1,14 @@ +using System.Text.Json; + [EffectFragment("Hp", "修改血量, 参数1为血量变化的具体值")] public class Eff_Hp : EffectFragment { private int _value; - public override void InitParam(float arg1) + public override void InitParam(JsonElement[] arg) { - _value = (int) arg1; + _value = arg[0].GetInt32(); } public override void OnUse() diff --git a/DungeonShooting_Godot/src/game/buff/effect/Eff_PiggyBank.cs b/DungeonShooting_Godot/src/game/buff/effect/Eff_PiggyBank.cs index 1e80544..cf5c240 100644 --- a/DungeonShooting_Godot/src/game/buff/effect/Eff_PiggyBank.cs +++ b/DungeonShooting_Godot/src/game/buff/effect/Eff_PiggyBank.cs @@ -1,4 +1,5 @@ +using System.Text.Json; using Godot; [EffectFragment("PiggyBank", "存钱罐, 使用后返还存入的金币, 参数1为返还金币的倍率(小数)")] @@ -8,9 +9,9 @@ //当前存入的金币数量 private float _currValue; - public override void InitParam(float arg1) + public override void InitParam(JsonElement[] arg) { - _value = arg1; + _value = arg[0].GetSingle(); } public override bool OnCheckUse() diff --git a/DungeonShooting_Godot/src/game/buff/effect/Eff_TotalAmmo.cs b/DungeonShooting_Godot/src/game/buff/effect/Eff_TotalAmmo.cs index 6984e62..bbd99b8 100644 --- a/DungeonShooting_Godot/src/game/buff/effect/Eff_TotalAmmo.cs +++ b/DungeonShooting_Godot/src/game/buff/effect/Eff_TotalAmmo.cs @@ -1,4 +1,6 @@ +using System.Text.Json; + [EffectFragment("TotalAmmo", "修改武器总弹药量, " + "参数1(选填)为弹药变化的具体值, 如果不传则表示补满弹药")] @@ -7,10 +9,10 @@ private bool _initParam = false; private int _value; - public override void InitParam(float arg1) + public override void InitParam(JsonElement[] args) { _initParam = true; - _value = (int) arg1; + _value = args[0].GetInt32(); } public override void OnUse()