diff --git a/DungeonShooting_Godot/excel/BuffBase.xlsx b/DungeonShooting_Godot/excel/BuffBase.xlsx deleted file mode 100644 index 8ee5487..0000000 --- a/DungeonShooting_Godot/excel/BuffBase.xlsx +++ /dev/null Binary files differ diff --git a/DungeonShooting_Godot/excel/PropBase.xlsx b/DungeonShooting_Godot/excel/PropBase.xlsx new file mode 100644 index 0000000..8ee5487 --- /dev/null +++ b/DungeonShooting_Godot/excel/PropBase.xlsx Binary files differ diff --git a/DungeonShooting_Godot/resource/config/BuffBase.json b/DungeonShooting_Godot/resource/config/BuffBase.json deleted file mode 100644 index 5300f1f..0000000 --- a/DungeonShooting_Godot/resource/config/BuffBase.json +++ /dev/null @@ -1,179 +0,0 @@ -[ - { - "Id": "0001", - "Remark": "\u978B\u5B50", - "__Activity": "prop0001", - "IsActivity": false, - "Buff": { - "MoveSpeed": [ - 30 - ] - } - }, - { - "Id": "0002", - "Remark": "\u5FC3\u4E4B\u5BB9\u5668", - "__Activity": "prop0002", - "IsActivity": false, - "Buff": { - "MaxHp": [ - 2 - ] - } - }, - { - "Id": "0003", - "Remark": "\u62A4\u76FE", - "__Activity": "prop0003", - "IsActivity": false, - "Buff": { - "MaxShield": [ - 1 - ] - } - }, - { - "Id": "0004", - "Remark": "\u62A4\u76FE\u8BA1\u65F6\u5668", - "__Activity": "prop0004", - "IsActivity": false, - "Buff": { - "ShieldRecoveryTime": [ - 2.5 - ] - } - }, - { - "Id": "0005", - "Remark": "\u6740\u4F24\u5F39", - "__Activity": "prop0005", - "IsActivity": false, - "Buff": { - "Damage": [ - 2, - 0.2 - ] - } - }, - { - "Id": "0006", - "Remark": "\u7EA2\u5B9D\u77F3\u6212\u6307", - "__Activity": "prop0006", - "IsActivity": false, - "Buff": { - "WoundedInvincibleTime": [ - 2 - ] - } - }, - { - "Id": "0007", - "Remark": "\u5907\u7528\u62A4\u76FE", - "__Activity": "prop0007", - "IsActivity": false, - "Buff": { - "OffsetInjury": [ - 0.15 - ] - } - }, - { - "Id": "0008", - "Remark": "\u773C\u955C", - "__Activity": "prop0008", - "IsActivity": false, - "Buff": { - "Scattering": [ - 0.5 - ] - } - }, - { - "Id": "0009", - "Remark": "\u9AD8\u901F\u5B50\u5F39", - "__Activity": "prop0009", - "IsActivity": false, - "Buff": { - "BulletSpeed": [ - 2, - 0.25 - ], - "BulletDistance": [ - 2, - 0.25 - ] - } - }, - { - "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 - ] - } - }, - { - "Id": "0011", - "Remark": "\u5F39\u5C04\u5B50\u5F39", - "__Activity": "prop0011", - "IsActivity": false, - "Buff": { - "BulletBounceCount": [ - 2 - ] - } - }, - { - "Id": "0012", - "Remark": "\u7A7F\u900F\u5B50\u5F39", - "__Activity": "prop0012", - "IsActivity": false, - "Buff": { - "BulletPenetration": [ - 1 - ] - } - }, - { - "Id": "0013", - "Remark": "\u6B66\u5668\u80CC\u5305", - "__Activity": "prop0013", - "IsActivity": false, - "Buff": { - "WeaponCapacity": [ - 1 - ] - } - }, - { - "Id": "0014", - "Remark": "\u9053\u5177\u80CC\u5305", - "__Activity": "prop0014", - "IsActivity": false, - "Buff": { - "ActivePropsCapacity": [ - 1 - ] - } - } -] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/config/PropBase.json b/DungeonShooting_Godot/resource/config/PropBase.json new file mode 100644 index 0000000..5300f1f --- /dev/null +++ b/DungeonShooting_Godot/resource/config/PropBase.json @@ -0,0 +1,179 @@ +[ + { + "Id": "0001", + "Remark": "\u978B\u5B50", + "__Activity": "prop0001", + "IsActivity": false, + "Buff": { + "MoveSpeed": [ + 30 + ] + } + }, + { + "Id": "0002", + "Remark": "\u5FC3\u4E4B\u5BB9\u5668", + "__Activity": "prop0002", + "IsActivity": false, + "Buff": { + "MaxHp": [ + 2 + ] + } + }, + { + "Id": "0003", + "Remark": "\u62A4\u76FE", + "__Activity": "prop0003", + "IsActivity": false, + "Buff": { + "MaxShield": [ + 1 + ] + } + }, + { + "Id": "0004", + "Remark": "\u62A4\u76FE\u8BA1\u65F6\u5668", + "__Activity": "prop0004", + "IsActivity": false, + "Buff": { + "ShieldRecoveryTime": [ + 2.5 + ] + } + }, + { + "Id": "0005", + "Remark": "\u6740\u4F24\u5F39", + "__Activity": "prop0005", + "IsActivity": false, + "Buff": { + "Damage": [ + 2, + 0.2 + ] + } + }, + { + "Id": "0006", + "Remark": "\u7EA2\u5B9D\u77F3\u6212\u6307", + "__Activity": "prop0006", + "IsActivity": false, + "Buff": { + "WoundedInvincibleTime": [ + 2 + ] + } + }, + { + "Id": "0007", + "Remark": "\u5907\u7528\u62A4\u76FE", + "__Activity": "prop0007", + "IsActivity": false, + "Buff": { + "OffsetInjury": [ + 0.15 + ] + } + }, + { + "Id": "0008", + "Remark": "\u773C\u955C", + "__Activity": "prop0008", + "IsActivity": false, + "Buff": { + "Scattering": [ + 0.5 + ] + } + }, + { + "Id": "0009", + "Remark": "\u9AD8\u901F\u5B50\u5F39", + "__Activity": "prop0009", + "IsActivity": false, + "Buff": { + "BulletSpeed": [ + 2, + 0.25 + ], + "BulletDistance": [ + 2, + 0.25 + ] + } + }, + { + "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 + ] + } + }, + { + "Id": "0011", + "Remark": "\u5F39\u5C04\u5B50\u5F39", + "__Activity": "prop0011", + "IsActivity": false, + "Buff": { + "BulletBounceCount": [ + 2 + ] + } + }, + { + "Id": "0012", + "Remark": "\u7A7F\u900F\u5B50\u5F39", + "__Activity": "prop0012", + "IsActivity": false, + "Buff": { + "BulletPenetration": [ + 1 + ] + } + }, + { + "Id": "0013", + "Remark": "\u6B66\u5668\u80CC\u5305", + "__Activity": "prop0013", + "IsActivity": false, + "Buff": { + "WeaponCapacity": [ + 1 + ] + } + }, + { + "Id": "0014", + "Remark": "\u9053\u5177\u80CC\u5305", + "__Activity": "prop0014", + "IsActivity": false, + "Buff": { + "ActivePropsCapacity": [ + 1 + ] + } + } +] \ No newline at end of file diff --git a/DungeonShooting_Godot/src/config/ExcelConfig.cs b/DungeonShooting_Godot/src/config/ExcelConfig.cs index 8670373..2713184 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 表相同 @@ -44,15 +35,6 @@ public static Dictionary AiAttackAttr_Map { get; private set; } /// - /// BuffBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 - /// - public static List BuffBase_List { get; private set; } - /// - /// BuffBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id - /// - public static Dictionary BuffBase_Map { get; private set; } - - /// /// BulletBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 /// public static List BulletBase_List { get; private set; } @@ -71,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; } @@ -88,6 +61,33 @@ /// public static Dictionary LiquidMaterial_Map { get; private set; } + /// + /// PropBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 + /// + public static List PropBase_List { get; private set; } + /// + /// PropBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id + /// + public static Dictionary PropBase_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; /// @@ -98,55 +98,37 @@ if (_init) return; _init = true; - _InitSoundConfig(); - _InitWeaponBaseConfig(); + _InitActivityBaseConfig(); _InitActivityMaterialConfig(); _InitAiAttackAttrConfig(); - _InitBuffBaseConfig(); _InitBulletBaseConfig(); _InitEnemyBaseConfig(); - _InitActivityBaseConfig(); _InitLiquidMaterialConfig(); + _InitPropBaseConfig(); + _InitSoundConfig(); + _InitWeaponBaseConfig(); - _InitWeaponBaseRef(); - _InitBuffBaseRef(); - _InitEnemyBaseRef(); _InitActivityBaseRef(); + _InitEnemyBaseRef(); + _InitPropBaseRef(); + _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() @@ -185,24 +167,6 @@ throw new Exception("初始化表'AiAttackAttr'失败!"); } } - private static void _InitBuffBaseConfig() - { - try - { - var text = _ReadConfigAsText("res://resource/config/BuffBase.json"); - BuffBase_List = new List(JsonSerializer.Deserialize>(text)); - BuffBase_Map = new Dictionary(); - 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 @@ -239,24 +203,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 @@ -275,7 +221,118 @@ throw new Exception("初始化表'LiquidMaterial'失败!"); } } + private static void _InitPropBaseConfig() + { + try + { + var text = _ReadConfigAsText("res://resource/config/PropBase.json"); + PropBase_List = new List(JsonSerializer.Deserialize>(text)); + PropBase_Map = new Dictionary(); + foreach (var item in PropBase_List) + { + PropBase_Map.Add(item.Id, item); + } + } + catch (Exception e) + { + GD.PrintErr(e.ToString()); + throw new Exception("初始化表'PropBase'失败!"); + } + } + 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 _InitPropBaseRef() + { + foreach (Ref_PropBase item in PropBase_List) + { + try + { + if (!string.IsNullOrEmpty(item.__Activity)) + { + item.Activity = ActivityBase_Map[item.__Activity]; + } + + } + catch (Exception e) + { + GD.PrintErr(e.ToString()); + throw new Exception("初始化'PropBase'引用其他表数据失败, 当前行id: " + item.Id); + } + } + } private static void _InitWeaponBaseRef() { foreach (Ref_WeaponBase item in WeaponBase_List) @@ -344,63 +401,6 @@ } } } - 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) - { - 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/config/ExcelConfig_BuffBase.cs b/DungeonShooting_Godot/src/config/ExcelConfig_BuffBase.cs deleted file mode 100644 index 844d210..0000000 --- a/DungeonShooting_Godot/src/config/ExcelConfig_BuffBase.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Text.Json.Serialization; -using System.Collections.Generic; - -namespace Config; - -public static partial class ExcelConfig -{ - public class BuffBase - { - /// - /// Buff Id - /// - [JsonInclude] - public string Id; - - /// - /// 备注 - /// - [JsonInclude] - public string Remark; - - /// - /// 属性绑定Buff实体的Id,这个id时ActivityBase表Id - /// - public ActivityBase Activity; - - /// - /// 是否是主动道具, 默认false - /// - [JsonInclude] - public bool IsActivity; - - /// - /// 被动Buff效果
- /// 也就是当前buff道具所有挂载的被动属性集合, 具体属性名称请参阅buff属性表
- /// key为buff属性名称
- /// value为buff初始化参数 - ///
- [JsonInclude] - public Dictionary Buff; - - /// - /// 返回浅拷贝出的新对象 - /// - 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; - - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_PropBase.cs b/DungeonShooting_Godot/src/config/ExcelConfig_PropBase.cs new file mode 100644 index 0000000..df48930 --- /dev/null +++ b/DungeonShooting_Godot/src/config/ExcelConfig_PropBase.cs @@ -0,0 +1,62 @@ +using System.Text.Json.Serialization; +using System.Collections.Generic; + +namespace Config; + +public static partial class ExcelConfig +{ + public class PropBase + { + /// + /// Buff Id + /// + [JsonInclude] + public string Id; + + /// + /// 备注 + /// + [JsonInclude] + public string Remark; + + /// + /// 属性绑定Buff实体的Id,这个id时ActivityBase表Id + /// + public ActivityBase Activity; + + /// + /// 是否是主动道具, 默认false + /// + [JsonInclude] + public bool IsActivity; + + /// + /// 被动Buff效果
+ /// 也就是当前buff道具所有挂载的被动属性集合, 具体属性名称请参阅buff属性表
+ /// key为buff属性名称
+ /// value为buff初始化参数 + ///
+ [JsonInclude] + public Dictionary Buff; + + /// + /// 返回浅拷贝出的新对象 + /// + public PropBase Clone() + { + var inst = new PropBase(); + inst.Id = Id; + inst.Remark = Remark; + inst.Activity = Activity; + inst.IsActivity = IsActivity; + inst.Buff = Buff; + return inst; + } + } + private class Ref_PropBase : PropBase + { + [JsonInclude] + public string __Activity; + + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/prop/BuffActivity.cs b/DungeonShooting_Godot/src/game/activity/prop/BuffActivity.cs index 4fbe2e7..f1bf70b 100644 --- a/DungeonShooting_Godot/src/game/activity/prop/BuffActivity.cs +++ b/DungeonShooting_Godot/src/game/activity/prop/BuffActivity.cs @@ -175,8 +175,8 @@ private static bool _init = false; - private static Dictionary _buffAttributeMap = - new Dictionary(); + private static Dictionary _buffAttributeMap = + new Dictionary(); /// /// 初始化 buff 属性数据 @@ -189,7 +189,7 @@ } _init = true; - foreach (var buffAttr in ExcelConfig.BuffBase_List) + foreach (var buffAttr in ExcelConfig.PropBase_List) { if (buffAttr.Activity != null) { @@ -204,7 +204,7 @@ /// /// 根据 ActivityBase.Id 获取对应 buff 的属性数据 /// - public static ExcelConfig.BuffBase GetBuffAttribute(string itemId) + public static ExcelConfig.PropBase GetBuffAttribute(string itemId) { if (itemId == null) { @@ -215,7 +215,6 @@ return attr; } - return null; - //throw new Exception($"buff'{itemId}'没有在 BuffBase 表中配置属性数据!"); + throw new Exception($"buff'{itemId}'没有在 BuffBase 表中配置属性数据!"); } } \ No newline at end of file