更新导表工具

This commit is contained in:
小李xl 2024-06-03 23:27:22 +08:00
parent 4e3a3331e9
commit 8bf895ba0f
5 changed files with 24 additions and 17 deletions

View File

@ -12,3 +12,4 @@
/excelTool/.vscode
/excelTool/publish
/excelTool/Folder.DotSettings.user
/DungeonShooting.csproj.old*

View File

@ -1,4 +1,4 @@
<Project Sdk="Godot.NET.Sdk/4.2.1">
<Project Sdk="Godot.NET.Sdk/4.2.2">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>

View File

@ -87,28 +87,31 @@ public static class ExcelGenerator
if (directoryInfo.Exists)
{
var fileInfos = directoryInfo.GetFiles();
//记录文件
var tempFileInfos = new List<FileInfo>();
foreach (var fileInfo in fileInfos)
{
//记录文件
if (fileInfo.Extension == ".xlsx")
{
var fileName = Path.GetFileNameWithoutExtension(fileInfo.Name).FirstToUpper();
//判断是否是以字母开头
if (!Regex.IsMatch(fileName, "^[a-zA-Z]"))
{
Console.WriteLine($"未被导出的表: {fileName}, excel表文件名称必须以字母开头!");
continue;
}
tempFileInfos.Add(fileInfo);
_excelNames.Add(fileName);
}
}
//读取配置文件
foreach (var fileInfo in fileInfos)
foreach (var tempFileInfo in tempFileInfos)
{
if (fileInfo.Extension == ".xlsx")
{
if (fileInfo.Name == "ExcelConfig.xlsx")
{
throw new Exception("excel表文件名称不允许叫'ExcelConfig.xlsx'!");
}
Console.WriteLine("excel表: " + fileInfo.FullName);
excelDataList.Add(ReadExcel(fileInfo.FullName));
}
Console.WriteLine("excel表: " + tempFileInfo.FullName);
excelDataList.Add(ReadExcel(tempFileInfo.FullName));
}
}
@ -320,7 +323,7 @@ public static class ExcelGenerator
outStr += $"using System.Collections.Generic;\n\n";
outStr += $"namespace Config;\n\n";
outStr += $"public static partial class ExcelConfig\n{{\n";
outStr += $" public class {fileName}\n";
outStr += $" public partial class {fileName}\n";
outStr += $" {{\n";
//继承的带有引用其他表的类代码
var outRefStr = "";

View File

@ -1,5 +1,4 @@

/// <summary>
/// <summary>
/// 物体类型
/// </summary>
public enum ActivityType
@ -53,6 +52,10 @@ public enum ActivityType
/// </summary>
Npc,
/// <summary>
/// Boss
/// </summary>
Boss,
/// <summary>
/// 其它类型
/// </summary>
Other = 99,

View File

@ -1 +1 @@
8
11