diff --git a/DungeonShooting_ExcelTool/ExcelGenerator.cs b/DungeonShooting_ExcelTool/ExcelGenerator.cs
index 2e241f9..89a4165 100644
--- a/DungeonShooting_ExcelTool/ExcelGenerator.cs
+++ b/DungeonShooting_ExcelTool/ExcelGenerator.cs
@@ -190,6 +190,14 @@
outStr += $"public static partial class ExcelConfig\n{{\n";
outStr += $" public class {fileName}\n";
outStr += $" {{\n";
+
+ var cloneFuncStr = $" /// \n";
+ cloneFuncStr += $" /// 返回浅拷贝出的新对象\n";
+ cloneFuncStr += $" /// \n";
+ cloneFuncStr += $" public {fileName} Clone()\n";
+ cloneFuncStr += $" {{\n";
+ cloneFuncStr += $" var inst = new {fileName}();\n";
+
var sourceFile = excelPath;
//行数
@@ -224,6 +232,10 @@
}
field = field.FirstToUpper();
excelData.ColumnNames.Add(field);
+ if (field == "Clone")
+ {
+ throw new Exception($"表'{fileName}'中不允许有'Clone'字段!");
+ }
var descriptionCell = descriptions.GetCell(cell.ColumnIndex);
//描述
@@ -263,9 +275,14 @@
outStr += $" /// {description}\n";
outStr += $" /// \n";
outStr += $" [JsonInclude]\n";
- outStr += $" public {mappingData.TypeStr} {field} {{ get; private set; }}\n\n";
+ outStr += $" public {mappingData.TypeStr} {field};\n\n";
+
+ cloneFuncStr += $" inst.{field} = {field};\n";
}
+ cloneFuncStr += " return inst;\n";
+ cloneFuncStr += " }\n";
+ outStr += cloneFuncStr;
outStr += " }\n";
outStr += "}";
diff --git a/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.dll b/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.dll
index cf56fac..76d2690 100644
--- a/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.dll
+++ b/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.dll
Binary files differ
diff --git a/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.exe b/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.exe
index c623fc8..bb1931a 100644
--- a/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.exe
+++ b/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.exe
Binary files differ
diff --git a/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.pdb b/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.pdb
index 1168e49..109bb56 100644
--- a/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.pdb
+++ b/DungeonShooting_Godot/excel/DungeonShooting_ExcelTool.pdb
Binary files differ
diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx
index 96d2e05..132add2 100644
--- a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx
+++ b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx
Binary files differ
diff --git a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx
index 1e1dde8..27697d8 100644
--- a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx
+++ b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx
Binary files differ
diff --git a/DungeonShooting_Godot/resource/sprite/gun/weapon0001/weapon0001.png.import b/DungeonShooting_Godot/resource/sprite/gun/weapon0001/weapon0001.png.import
index 39572c3..b4c2034 100644
--- a/DungeonShooting_Godot/resource/sprite/gun/weapon0001/weapon0001.png.import
+++ b/DungeonShooting_Godot/resource/sprite/gun/weapon0001/weapon0001.png.import
@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://civvcowt2wklr"
-path="res://.godot/imported/Weapon0001.png-305a0d14fe3c147edd264f33dc26bc8a.ctex"
+path="res://.godot/imported/weapon0001.png-6f3807222cc10bbb7eddc649cd3775c0.ctex"
metadata={
"vram_texture": false
}
[deps]
-source_file="res://resource/sprite/gun/weapon0001/Weapon0001.png"
-dest_files=["res://.godot/imported/Weapon0001.png-305a0d14fe3c147edd264f33dc26bc8a.ctex"]
+source_file="res://resource/sprite/gun/weapon0001/weapon0001.png"
+dest_files=["res://.godot/imported/weapon0001.png-6f3807222cc10bbb7eddc649cd3775c0.ctex"]
[params]
diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import
index c36be94..b20c9a6 100644
--- a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import
+++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import
@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://chd2vtesap5cf"
-path="res://.godot/imported/Enemy0001.png-148a38dfa95953b26d890356e8875de4.ctex"
+path="res://.godot/imported/enemy0001.png-1247a3ddf8a1a163d812cad12c4340fd.ctex"
metadata={
"vram_texture": false
}
[deps]
-source_file="res://resource/sprite/role/enemy0001/Enemy0001.png"
-dest_files=["res://.godot/imported/Enemy0001.png-148a38dfa95953b26d890356e8875de4.ctex"]
+source_file="res://resource/sprite/role/enemy0001/enemy0001.png"
+dest_files=["res://.godot/imported/enemy0001.png-1247a3ddf8a1a163d812cad12c4340fd.ctex"]
[params]
diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import
index d563acf..56388a2 100644
--- a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import
+++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import
@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://d2f55lu60x64i"
-path="res://.godot/imported/Enemy0001_Debris.png-ac416dc79cd3c1217b27e1ef1fbe0d0b.ctex"
+path="res://.godot/imported/enemy0001_Debris.png-297a2fb6680cb862a9a085cf58f8268c.ctex"
metadata={
"vram_texture": false
}
[deps]
-source_file="res://resource/sprite/role/enemy0001/Enemy0001_Debris.png"
-dest_files=["res://.godot/imported/Enemy0001_Debris.png-ac416dc79cd3c1217b27e1ef1fbe0d0b.ctex"]
+source_file="res://resource/sprite/role/enemy0001/enemy0001_Debris.png"
+dest_files=["res://.godot/imported/enemy0001_Debris.png-297a2fb6680cb862a9a085cf58f8268c.ctex"]
[params]
diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_ActivityObject.cs b/DungeonShooting_Godot/src/config/ExcelConfig_ActivityObject.cs
index eb255ef..cc1ef0b 100644
--- a/DungeonShooting_Godot/src/config/ExcelConfig_ActivityObject.cs
+++ b/DungeonShooting_Godot/src/config/ExcelConfig_ActivityObject.cs
@@ -12,7 +12,7 @@
/// 需要添加类型前缀
///
[JsonInclude]
- public string Id { get; private set; }
+ public string Id;
///
/// Test(测试对象): 2
@@ -25,13 +25,24 @@
/// Other(其它类型): 9
///
[JsonInclude]
- public int Type { get; private set; }
+ public int Type;
///
/// 物体预制场景路径, 场景根节点必须是ActivityObject子类
///
[JsonInclude]
- public string Prefab { get; private set; }
+ public string Prefab;
+ ///
+ /// 返回浅拷贝出的新对象
+ ///
+ public ActivityObject Clone()
+ {
+ var inst = new ActivityObject();
+ inst.Id = Id;
+ inst.Type = Type;
+ inst.Prefab = Prefab;
+ return inst;
+ }
}
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs b/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs
index 6be100a..b80626a 100644
--- a/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs
+++ b/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs
@@ -12,31 +12,31 @@
/// 不需要添加类型前缀
///
[JsonInclude]
- public string Id { get; private set; }
+ public string Id;
///
/// 武器 Prefab, 必须继承场景 "res://prefab/weapon/Weapon.tscn"
///
[JsonInclude]
- public string Prefab { get; private set; }
+ public string Prefab;
///
/// 重量
///
[JsonInclude]
- public float Weight { get; private set; }
+ public float Weight;
///
/// 武器显示的名称
///
[JsonInclude]
- public string Name { get; private set; }
+ public string Name;
///
/// 武器的图标
///
[JsonInclude]
- public string Icon { get; private set; }
+ public string Icon;
///
/// 武器类型:
@@ -45,217 +45,266 @@
/// 3.重型武器
///
[JsonInclude]
- public byte WeightType { get; private set; }
+ public byte WeightType;
///
/// 是否连续发射, 如果为false, 则每次发射都需要扣动扳机
///
[JsonInclude]
- public bool ContinuousShoot { get; private set; }
+ public bool ContinuousShoot;
///
/// 弹夹容量
///
[JsonInclude]
- public int AmmoCapacity { get; private set; }
+ public int AmmoCapacity;
///
/// 弹药容量上限
///
[JsonInclude]
- public int MaxAmmoCapacity { get; private set; }
+ public int MaxAmmoCapacity;
///
/// 起始备用弹药数量
///
[JsonInclude]
- public int StandbyAmmoCapacity { get; private set; }
+ public int StandbyAmmoCapacity;
///
/// 装弹时间, 单位: 秒
///
[JsonInclude]
- public float ReloadTime { get; private set; }
+ public float ReloadTime;
///
/// 每粒子弹是否是单独装填, 如果是, 那么每上一发子弹的时间就是 ReloadTime, 可以做霰弹武器装填效果
///
[JsonInclude]
- public bool AloneReload { get; private set; }
+ public bool AloneReload;
///
/// 单独装填时每次装填子弹数量, 必须要将 'AloneReload' 属性设置为 true
///
[JsonInclude]
- public int AloneReloadCount { get; private set; }
+ public int AloneReloadCount;
///
/// 单独装填的子弹时可以立即射击, 必须要将 'AloneReload' 属性设置为 true
///
[JsonInclude]
- public bool AloneReloadCanShoot { get; private set; }
+ public bool AloneReloadCanShoot;
///
/// 是否为松发开火, 也就是松开扳机才开火, 若要启用该属性, 必须将 'ContinuousShoot' 设置为 false
///
[JsonInclude]
- public bool LooseShoot { get; private set; }
+ public bool LooseShoot;
///
/// 最少需要蓄力多久才能开火, 必须将 'LooseShoot' 设置为 true
///
[JsonInclude]
- public float MinChargeTime { get; private set; }
+ public float MinChargeTime;
///
/// 连续发射最小次数, 仅当 ContinuousShoot 为 false 时生效
///
[JsonInclude]
- public int MinContinuousCount { get; private set; }
+ public int MinContinuousCount;
///
/// 连续发射最大次数, 仅当 ContinuousShoot 为 false 时生效
///
[JsonInclude]
- public int MaxContinuousCount { get; private set; }
+ public int MaxContinuousCount;
///
/// 按下一次扳机后需要多长时间才能再次感应按下
///
[JsonInclude]
- public float TriggerInterval { get; private set; }
+ public float TriggerInterval;
///
/// 初始射速, 初始每分钟能开火次数
///
[JsonInclude]
- public float StartFiringSpeed { get; private set; }
+ public float StartFiringSpeed;
///
/// 最终射速, 最终每分钟能开火次数, 仅当 ContinuousShoot 为 true 时生效
///
[JsonInclude]
- public float FinalFiringSpeed { get; private set; }
+ public float FinalFiringSpeed;
///
/// 按下扳机并开火后射速增加速率
///
[JsonInclude]
- public float FiringSpeedAddSpeed { get; private set; }
+ public float FiringSpeedAddSpeed;
///
/// 松开扳机后射速消散速率
///
[JsonInclude]
- public float FiringSpeedBackSpeed { get; private set; }
+ public float FiringSpeedBackSpeed;
///
/// 单次开火发射子弹最小数量
///
[JsonInclude]
- public int MinFireBulletCount { get; private set; }
+ public int MinFireBulletCount;
///
/// 单次开火发射子弹最大数量
///
[JsonInclude]
- public int MaxFireBulletCount { get; private set; }
+ public int MaxFireBulletCount;
///
/// 开火前延时
///
[JsonInclude]
- public float DelayedTime { get; private set; }
+ public float DelayedTime;
///
/// 初始散射半径
///
[JsonInclude]
- public float StartScatteringRange { get; private set; }
+ public float StartScatteringRange;
///
/// 最终散射半径
///
[JsonInclude]
- public float FinalScatteringRange { get; private set; }
+ public float FinalScatteringRange;
///
/// 每次发射后散射增加值
///
[JsonInclude]
- public float ScatteringRangeAddValue { get; private set; }
+ public float ScatteringRangeAddValue;
///
/// 松开扳机后散射销退速率
///
[JsonInclude]
- public float ScatteringRangeBackSpeed { get; private set; }
+ public float ScatteringRangeBackSpeed;
///
/// 松开扳机多久后开始销退散射值 (单位: 秒)
///
[JsonInclude]
- public float ScatteringRangeBackTime { get; private set; }
+ public float ScatteringRangeBackTime;
///
/// 子弹飞行最大距离
///
[JsonInclude]
- public float MaxDistance { get; private set; }
+ public float MaxDistance;
///
/// 子弹飞行最小距离
///
[JsonInclude]
- public float MinDistance { get; private set; }
+ public float MinDistance;
///
/// 最大后坐力 (仅用于开火后武器身抖动)
///
[JsonInclude]
- public float MaxBacklash { get; private set; }
+ public float MaxBacklash;
///
/// 最小后坐力 (仅用于开火后武器身抖动)
///
[JsonInclude]
- public float MinBacklash { get; private set; }
+ public float MinBacklash;
///
/// 后坐力偏移回归回归速度
///
[JsonInclude]
- public float BacklashRegressionSpeed { get; private set; }
+ public float BacklashRegressionSpeed;
///
/// 开火后武器口上抬角度
///
[JsonInclude]
- public float UpliftAngle { get; private set; }
+ public float UpliftAngle;
///
/// 武器默认上抬角度
///
[JsonInclude]
- public float DefaultAngle { get; private set; }
+ public float DefaultAngle;
///
/// 开火后武器口角度恢复速度倍数
///
[JsonInclude]
- public float UpliftAngleRestore { get; private set; }
+ public float UpliftAngleRestore;
///
/// 默认射出的子弹id
///
[JsonInclude]
- public string BulletId { get; private set; }
+ public string BulletId;
///
/// 投抛状态下物体碰撞器大小
///
[JsonInclude]
- public SerializeVector2 ThrowCollisionSize { get; private set; }
+ public SerializeVector2 ThrowCollisionSize;
+ ///
+ /// 返回浅拷贝出的新对象
+ ///
+ public Weapon Clone()
+ {
+ var inst = new Weapon();
+ inst.Id = Id;
+ inst.Prefab = Prefab;
+ inst.Weight = Weight;
+ inst.Name = Name;
+ inst.Icon = Icon;
+ 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.MaxDistance = MaxDistance;
+ inst.MinDistance = MinDistance;
+ inst.MaxBacklash = MaxBacklash;
+ inst.MinBacklash = MinBacklash;
+ inst.BacklashRegressionSpeed = BacklashRegressionSpeed;
+ inst.UpliftAngle = UpliftAngle;
+ inst.DefaultAngle = DefaultAngle;
+ inst.UpliftAngleRestore = UpliftAngleRestore;
+ inst.BulletId = BulletId;
+ inst.ThrowCollisionSize = ThrowCollisionSize;
+ return inst;
+ }
}
}
\ No newline at end of file