Skip to content

导表工具

Fantasy 使用的网络协议和配置文件,若要在框架中实现,必须通过专用的导表工具进行导出后方可使用。这一过程确保了协议和配置文件与框架的兼容性,并避免了潜在的错误或冲突,提升了整体的运行效率和稳定性。

导表工具目录结构

.
├─ Book
├─ Tools/                                                                                
  ├─ Exporter/                  # 导出工具
    ├─ ExporterSettings.json   # 导出配置文件
    ├─ Run.bat                 # Windows下使用的启动文件
    └─ Run.sh                  # Mac和Linux下使用的启动文件
  └─ Src                        # 导表工具的源代码                                                                
└─ README.md

获取导表工具

通过Nuget方式

  • 通过Nuget包管理器,搜索Fantasy-Net.Exporter,进行安装。
  • 通过执行dotnet add package Fantasy-Net.Exporter命令,进行安装。

安装完成后会在根目录下生成一个Toole文件夹,在文件夹下Exporter里就是导表工具的可执行程序。

通过仓库方式

通过1.1.获得Fantasy里提供的仓库地址,用git方式Clone下来,按照导表工具目录结构找到。

导出配置文件

在配置文件中,如果某个参数未指定或不存在,可以将其留空或使用默认值。

示例

{
    "Export": {
        "NetworkProtocolDirectory": {
            "Value": "../../Examples/Config/NetworkProtocol/",
            "Comment": "网络协议文件所在的文件夹位置"
        },
        "NetworkProtocolServerDirectory": {
            "Value": "../../Examples/Server/Entity/Generate/NetworkProtocol/",
            "Comment": "网络协议生成到服务端的文件夹位置"
        },
        "NetworkProtocolClientDirectory": {
            "Value": "../../Examples/Client/Unity/Assets/Scripts/Hotfix/Generate/NetworkProtocol/",
            "Comment": "网络协议生生成到客户端的文件夹位置"
        },
        "ExcelProgramPath": {
            "Value": "../../Examples/Config/Excel/",
            "Comment": "Excel文件夹的根目录"
        },
        "ExcelVersionFile": {
            "Value": "../../Examples/Config/Excel/Version.txt",
            "Comment": "Excel的Version文件位置、这个文件用于记录每次导出对比是否需要再次导出的文件"
        },
        "ExcelServerFileDirectory": {
            "Value": "../../Examples/Server/Entity/Generate/ConfigTable/Entity/",
            "Comment": "Excel生成的代码文件、在服务端文件夹位置"
        },
        "ExcelClientFileDirectory": {
            "Value": "../../Examples/Client/Unity/Assets/Scripts/Hotfix/Generate/ConfigTable/Entity/",
            "Comment": "Excel生成的代码文件、在客户端文件夹位置"
        },
        "ExcelServerBinaryDirectory": {
            "Value": "../../Examples/Config/Binary/",
            "Comment": "Excel生成服务器二进制数据文件夹位置"
        },
        "ExcelClientBinaryDirectory": {
            "Value": "../../Examples/Client/Unity/Assets/Bundles/Config/",
            "Comment": "Excel生成在客户端的二进制数据文件夹位置"
        },
        "ExcelServerJsonDirectory": {
            "Value": "../../Examples/Config/Json/Server/",
            "Comment": "Excel生成在服务端的Json数据文件夹位置"
        },
        "ExcelClientJsonDirectory": {
            "Value": "../../Examples/Config/Json/Client/",
            "Comment": "Excel生成在客户端的Json数据文件夹位置"
        },
        "ServerCustomExportDirectory": {
            "Value": "../../Examples/Server/Entity/Generate/CustomExport/",
            "Comment": "Excel在服务端生成自定义代码的文件夹位置"
        },
        "ClientCustomExportDirectory": {
            "Value": "../../Examples/Client/Unity/Assets/Scripts/Hotfix/Generate/CustomExport",
            "Comment": "Excel在客户端端生成自定义代码的文件夹位置"
        }
    }
}