diff --git a/DungeonShooting_ExcelTool/serialize/test/ExcelConfig.cs b/DungeonShooting_ExcelTool/serialize/test/ExcelConfig.cs deleted file mode 100644 index bdd2459..0000000 --- a/DungeonShooting_ExcelTool/serialize/test/ExcelConfig.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json; -//using Godot; - -namespace Config; - -public static partial class ExcelConfig -{ - /// - /// ActivityObject.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 - /// - public static List ActivityObject_List { get; private set; } - /// - /// ActivityObject.xlsx表数据集合, 里 Map 形式存储, key 为 Id - /// - public static Dictionary ActivityObject_Map { get; private set; } - - /// - /// Test.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 - /// - public static List Test_List { get; private set; } - /// - /// Test.xlsx表数据集合, 里 Map 形式存储, key 为 Id - /// - public static Dictionary Test_Map { get; private set; } - - /// - /// Weapon.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 - /// - public static List Weapon_List { get; private set; } - /// - /// Weapon.xlsx表数据集合, 里 Map 形式存储, key 为 Id - /// - public static Dictionary Weapon_Map { get; private set; } - - - private static bool _init = false; - /// - /// 初始化所有配置表数据 - /// - public static void Init() - { - if (_init) return; - _init = true; - - _InitActivityObjectConfig(); - _InitTestConfig(); - _InitWeaponConfig(); - - _InitTestRef(); - } - private static void _InitActivityObjectConfig() - { - try - { - var text = _ReadConfigAsText("res://resource/config/ActivityObject.json"); - ActivityObject_List = JsonSerializer.Deserialize>(text); - ActivityObject_Map = new Dictionary(); - foreach (var item in ActivityObject_List) - { - ActivityObject_Map.Add(item.Id, item); - } - } - catch (Exception e) - { - //GD.PrintErr(e.ToString()); - throw new Exception("初始化表'ActivityObject'失败!"); - } - } - private static void _InitTestConfig() - { - try - { - var text = _ReadConfigAsText("res://resource/config/Test.json"); - Test_List = JsonSerializer.Deserialize>(text); - Test_Map = new Dictionary(); - foreach (var item in Test_List) - { - Test_Map.Add(item.Id, item); - } - } - catch (Exception e) - { - //GD.PrintErr(e.ToString()); - throw new Exception("初始化表'Test'失败!"); - } - } - private static void _InitWeaponConfig() - { - try - { - var text = _ReadConfigAsText("res://resource/config/Weapon.json"); - Weapon_List = JsonSerializer.Deserialize>(text); - Weapon_Map = new Dictionary(); - foreach (var item in Weapon_List) - { - Weapon_Map.Add(item.Id, item); - } - } - catch (Exception e) - { - //GD.PrintErr(e.ToString()); - throw new Exception("初始化表'Weapon'失败!"); - } - } - - private static void _InitTestRef() - { - foreach (var item in Test_List) - { - try - { - item.Weapon = Weapon_Map[item._Weapon]; - item.ActivityObject = ActivityObject_Map[item._ActivityObject]; - - item.Weapons = new Weapon[item._Weapons.Length]; - for (var i = 0; i < item._Weapons.Length; i++) - { - item.Weapons[i] = Weapon_Map[item._Weapons[i]]; - } - - item.WeaponMap = new Dictionary(); - foreach (var pair in item._WeaponMap) - { - item.WeaponMap.Add(pair.Key, Weapon_Map[pair.Value]); - } - } - catch (Exception e) - { - //GD.PrintErr(e.ToString()); - throw new Exception("初始化'Test'引用其他表数据失败, 当前行id: " + item.Id); - } - } - } - private static string _ReadConfigAsText(string path) - { - return ""; - } -} \ No newline at end of file diff --git a/DungeonShooting_ExcelTool/serialize/test/ExcelConfig_ActivityObject.cs b/DungeonShooting_ExcelTool/serialize/test/ExcelConfig_ActivityObject.cs deleted file mode 100644 index 12e9730..0000000 --- a/DungeonShooting_ExcelTool/serialize/test/ExcelConfig_ActivityObject.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Text.Json.Serialization; -using System.Collections.Generic; - -namespace Config; - -public static partial class ExcelConfig -{ - public class ActivityObject - { - /// - /// 物体唯一id
- /// 需要添加类型前缀 - ///
- [JsonInclude] - public string Id; - - /// - /// Test(测试对象): 2
- /// Role(角色): 3
- /// Enemy(敌人): 4
- /// Weapon(武器): 5
- /// Bullet(子弹): 6
- /// Shell(弹壳): 7
- /// Effect(特效): 8
- /// Other(其它类型): 9 - ///
- [JsonInclude] - public int Type; - - /// - /// 物体预制场景路径, 场景根节点必须是ActivityObject子类 - /// - [JsonInclude] - public string Prefab; - - /// - /// 物体备注 - /// - [JsonInclude] - public string Remark; - - /// - /// 返回浅拷贝出的新对象 - /// - public ActivityObject Clone() - { - var inst = new ActivityObject(); - inst.Id = Id; - inst.Type = Type; - inst.Prefab = Prefab; - inst.Remark = Remark; - return inst; - } - } -} \ No newline at end of file diff --git a/DungeonShooting_ExcelTool/serialize/test/ExcelConfig_Test.cs b/DungeonShooting_ExcelTool/serialize/test/ExcelConfig_Test.cs deleted file mode 100644 index 52ccb6f..0000000 --- a/DungeonShooting_ExcelTool/serialize/test/ExcelConfig_Test.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Text.Json.Serialization; -using System.Collections.Generic; - -namespace Config; - -public static partial class ExcelConfig -{ - public class Test - { - /// - /// 唯一id - /// - [JsonInclude] - public string Id; - - /// - /// 引用的武器数据 - /// - public Weapon Weapon; - [JsonInclude] - public string _Weapon; - - /// - /// 引用的武器数据(数组) - /// - public Weapon[] Weapons; - [JsonInclude] - public string[] _Weapons; - - /// - /// 引用的武器数据(字典) - /// - public Dictionary WeaponMap; - [JsonInclude] - public Dictionary _WeaponMap; - - /// - /// 引用ActivityObject - /// - public ActivityObject ActivityObject; - [JsonInclude] - public string _ActivityObject; - - /// - /// 返回浅拷贝出的新对象 - /// - public Test Clone() - { - var inst = new Test(); - inst.Id = Id; - inst.Weapon = Weapon; - inst.Weapons = Weapons; - inst.WeaponMap = WeaponMap; - inst.ActivityObject = ActivityObject; - return inst; - } - } -} \ No newline at end of file diff --git a/DungeonShooting_ExcelTool/serialize/test/ExcelConfig_Weapon.cs b/DungeonShooting_ExcelTool/serialize/test/ExcelConfig_Weapon.cs deleted file mode 100644 index a2953d8..0000000 --- a/DungeonShooting_ExcelTool/serialize/test/ExcelConfig_Weapon.cs +++ /dev/null @@ -1,377 +0,0 @@ -using System.Text.Json.Serialization; -using System.Collections.Generic; - -namespace Config; - -public static partial class ExcelConfig -{ - public class Weapon - { - /// - /// 武器属性id - /// - [JsonInclude] - public string Id; - - /// - /// 属性绑定武器的Id,如果是Ai使用的数据, 则填空字符串串 - /// - [JsonInclude] - public string WeaponId; - - /// - /// 武器显示的名称 - /// - [JsonInclude] - public string Name; - - /// - /// 武器的图标 - /// - [JsonInclude] - public string Icon; - - /// - /// 重量 - /// - [JsonInclude] - public float Weight; - - /// - /// 武器类型:
- /// 1.副武器
- /// 2.主武器
- /// 3.重型武器 - ///
- [JsonInclude] - public byte WeightType; - - /// - /// 是否连续发射, 如果为false, 则每次发射都需要扣动扳机 - /// - [JsonInclude] - public bool ContinuousShoot; - - /// - /// 弹夹容量 - /// - [JsonInclude] - public int AmmoCapacity; - - /// - /// 弹药容量上限 - /// - [JsonInclude] - public int MaxAmmoCapacity; - - /// - /// 默认起始备用弹药数量 - /// - [JsonInclude] - public int StandbyAmmoCapacity; - - /// - /// 装弹时间 (单位: 秒) - /// - [JsonInclude] - public float ReloadTime; - - /// - /// 每粒子弹是否是单独装填, 如果是, 那么每上一发子弹的时间就是 ReloadTime, 可以做霰弹武器装填效果 - /// - [JsonInclude] - public bool AloneReload; - - /// - /// 单独装填时每次装填子弹数量, 必须要将 'AloneReload' 属性设置为 true - /// - [JsonInclude] - public int AloneReloadCount; - - /// - /// 单独装填的子弹时可以立即射击, 必须要将 'AloneReload' 属性设置为 true - /// - [JsonInclude] - public bool AloneReloadCanShoot; - - /// - /// 是否为松发开火, 也就是松开扳机才开火, 若要启用该属性, 必须将 'ContinuousShoot' 设置为 false - /// - [JsonInclude] - public bool LooseShoot; - - /// - /// 最少需要蓄力多久才能开火, 必须将 'LooseShoot' 设置为 true - /// - [JsonInclude] - public float MinChargeTime; - - /// - /// 连续发射最小次数, 仅当 ContinuousShoot 为 false 时生效 - /// - [JsonInclude] - public int MinContinuousCount; - - /// - /// 连续发射最大次数, 仅当 ContinuousShoot 为 false 时生效 - /// - [JsonInclude] - public int MaxContinuousCount; - - /// - /// 按下一次扳机后需要多长时间才能再次感应按下 - /// - [JsonInclude] - public float TriggerInterval; - - /// - /// 初始射速, 初始每分钟能开火次数 - /// - [JsonInclude] - public float StartFiringSpeed; - - /// - /// 最终射速, 最终每分钟能开火次数, 仅当 ContinuousShoot 为 true 时生效 - /// - [JsonInclude] - public float FinalFiringSpeed; - - /// - /// 按下扳机并开火后射速增加速率 - /// - [JsonInclude] - public float FiringSpeedAddSpeed; - - /// - /// 松开扳机后射速消散速率 - /// - [JsonInclude] - public float FiringSpeedBackSpeed; - - /// - /// 单次开火发射子弹最小数量 - /// - [JsonInclude] - public int MinFireBulletCount; - - /// - /// 单次开火发射子弹最大数量 - /// - [JsonInclude] - public int MaxFireBulletCount; - - /// - /// 开火前延时 - /// - [JsonInclude] - public float DelayedTime; - - /// - /// 初始散射半径 - /// - [JsonInclude] - public float StartScatteringRange; - - /// - /// 最终散射半径 - /// - [JsonInclude] - public float FinalScatteringRange; - - /// - /// 每次发射后散射增加值 - /// - [JsonInclude] - public float ScatteringRangeAddValue; - - /// - /// 松开扳机后散射销退速率 - /// - [JsonInclude] - public float ScatteringRangeBackSpeed; - - /// - /// 松开扳机多久后开始销退散射值 (单位: 秒) - /// - [JsonInclude] - public float ScatteringRangeBackTime; - - /// - /// 子弹飞行最小距离 - /// - [JsonInclude] - public float MinDistance; - - /// - /// 子弹飞行最大距离 - /// - [JsonInclude] - public float MaxDistance; - - /// - /// 最小后坐力 (仅用于开火后武器身抖动) - /// - [JsonInclude] - public float MinBacklash; - - /// - /// 最大后坐力 (仅用于开火后武器身抖动) - /// - [JsonInclude] - public float MaxBacklash; - - /// - /// 后坐力偏移回归回归速度 - /// - [JsonInclude] - public float BacklashRegressionSpeed; - - /// - /// 开火后武器口上抬角度 - /// - [JsonInclude] - public float UpliftAngle; - - /// - /// 武器默认上抬角度 - /// - [JsonInclude] - public float DefaultAngle; - - /// - /// 开火后武器口角度恢复速度倍数 - /// - [JsonInclude] - public float UpliftAngleRestore; - - /// - /// 默认射出的子弹id - /// - [JsonInclude] - public string BulletId; - - /// - /// 投抛状态下物体碰撞器大小 - /// - [JsonInclude] - public SerializeVector2 ThrowCollisionSize; - - /// - /// 射击音效 - /// - [JsonInclude] - public string ShootSound; - - /// - /// 换弹音效 - /// - [JsonInclude] - public string ReloadSound; - - /// - /// 换弹音效延时时间 - /// - [JsonInclude] - public float ReloadSoundDelayTime; - - /// - /// 上膛音效 - /// - [JsonInclude] - public string EquipSound; - - /// - /// 上膛音效延时时间 - /// - [JsonInclude] - public float EquipSoundDelayTime; - - /// - /// Ai属性
- /// Ai 使用该武器时的武器数据, 设置该字段, 可让同一把武器在敌人和玩家手上有不同属性
- /// 如果不填则Ai和玩家使用同一种属性 - ///
- [JsonInclude] - public string AiUseAttributeId; - - /// - /// Ai属性
- /// 目标锁定时间, 也就是瞄准目标多久才会开火, (单位: 秒) - ///
- [JsonInclude] - public float AiTargetLockingTime; - - /// - /// Ai属性
- /// Ai使用该武器发射的子弹速度缩放比 - ///
- [JsonInclude] - public float AiBulletSpeedScale; - - /// - /// Ai属性
- /// Ai使用该武器消耗弹药的概率, (0 - 1) - ///
- [JsonInclude] - public float AiAmmoConsumptionProbability; - - /// - /// 返回浅拷贝出的新对象 - /// - public Weapon Clone() - { - var inst = new Weapon(); - inst.Id = Id; - inst.WeaponId = WeaponId; - inst.Name = Name; - inst.Icon = Icon; - inst.Weight = Weight; - inst.WeightType = WeightType; - inst.ContinuousShoot = ContinuousShoot; - inst.AmmoCapacity = AmmoCapacity; - inst.MaxAmmoCapacity = MaxAmmoCapacity; - inst.StandbyAmmoCapacity = StandbyAmmoCapacity; - inst.ReloadTime = ReloadTime; - inst.AloneReload = AloneReload; - inst.AloneReloadCount = AloneReloadCount; - inst.AloneReloadCanShoot = AloneReloadCanShoot; - inst.LooseShoot = LooseShoot; - inst.MinChargeTime = MinChargeTime; - inst.MinContinuousCount = MinContinuousCount; - inst.MaxContinuousCount = MaxContinuousCount; - inst.TriggerInterval = TriggerInterval; - inst.StartFiringSpeed = StartFiringSpeed; - inst.FinalFiringSpeed = FinalFiringSpeed; - inst.FiringSpeedAddSpeed = FiringSpeedAddSpeed; - inst.FiringSpeedBackSpeed = FiringSpeedBackSpeed; - inst.MinFireBulletCount = MinFireBulletCount; - inst.MaxFireBulletCount = MaxFireBulletCount; - inst.DelayedTime = DelayedTime; - inst.StartScatteringRange = StartScatteringRange; - inst.FinalScatteringRange = FinalScatteringRange; - inst.ScatteringRangeAddValue = ScatteringRangeAddValue; - inst.ScatteringRangeBackSpeed = ScatteringRangeBackSpeed; - inst.ScatteringRangeBackTime = ScatteringRangeBackTime; - inst.MinDistance = MinDistance; - inst.MaxDistance = MaxDistance; - inst.MinBacklash = MinBacklash; - inst.MaxBacklash = MaxBacklash; - inst.BacklashRegressionSpeed = BacklashRegressionSpeed; - inst.UpliftAngle = UpliftAngle; - inst.DefaultAngle = DefaultAngle; - inst.UpliftAngleRestore = UpliftAngleRestore; - inst.BulletId = BulletId; - inst.ThrowCollisionSize = ThrowCollisionSize; - inst.ShootSound = ShootSound; - inst.ReloadSound = ReloadSound; - inst.ReloadSoundDelayTime = ReloadSoundDelayTime; - inst.EquipSound = EquipSound; - inst.EquipSoundDelayTime = EquipSoundDelayTime; - inst.AiUseAttributeId = AiUseAttributeId; - inst.AiTargetLockingTime = AiTargetLockingTime; - inst.AiBulletSpeedScale = AiBulletSpeedScale; - inst.AiAmmoConsumptionProbability = AiAmmoConsumptionProbability; - return inst; - } - } -} \ No newline at end of file