Skip to content

Latest commit

 

History

History
73 lines (45 loc) · 3.18 KB

File metadata and controls

73 lines (45 loc) · 3.18 KB

GameFrameX Logo

GameFrameX.Tools

Version License Documentation

独立游戏前后端一体化解决方案 · 独立游戏开发者的圆梦大使

📖 文档💬 QQ群: 467608841


🌐 语言: English | 简体中文 | 繁體中文 | 日本語 | 한국어


ProtoExport 工具

这是一个用于将Proto协议文件转换为 Server/Unity/TypeScript/Godot 代码的工具。

参数解析

以下是此工具命令行参数的详细说明:

--mode 此参数用于指定运行模式。有效值包括 Server, Unity, TypeScript, 或 Godot 中的任何一个。

--inputpath 此参数用于指定.proto协议文件的路径。程序将扫描该路径下所有以.proto结尾的文件。

--outputpath 此参数用于指定输出文件的保存路径。

--namespaceName 此参数用于指定命名空间。在TypeScript模式中此参数无效。在Godot模式中,生成的代码始终使用 GameFrameX.Network.Runtime 命名空间。如果不想设定命名空间,此参数可以传空值。

命令行示例

下面的命令示例展示了如何将Proto协议文件转换为Server代码:

--mode server --inputpath ./../../../../../Protobuf --outputpath ./../../../../../Server/GameFrameX.Proto/Proto --namespaceName GameFrameX.Proto.Proto

在上述命令示例中:

  • --mode server 表示设置运行模式为 Server。
  • --inputpath ./../../../../../Protobuf 表示.proto协议文件的路径为 ./../../../../../Protobuf
  • --outputpath ./../../../../../Server/GameFrameX.Proto/Proto 表示输出文件的保存路径为 ./../../../../../Server/GameFrameX.Proto/Proto
  • --namespaceName GameFrameX.Proto.Proto 表示命名空间设定为 GameFrameX.Proto.Proto

更改命令行参数,可以根据实际需求转换合适的代码。

Godot 模式示例

下面的命令示例展示了如何将Proto协议文件转换为Godot C#代码:

--mode godot --inputpath ./../../../../../Protobuf --outputpath ./../../../../../Godot/Proto --namespaceName Hotfix.Proto

在上述命令示例中:

  • --mode godot 表示设置运行模式为 Godot。
  • --inputpath ./../../../../../Protobuf 表示.proto协议文件的路径为 ./../../../../../Protobuf
  • --outputpath ./../../../../../Godot/Proto 表示输出文件的保存路径为 ./../../../../../Godot/Proto
  • --namespaceName Hotfix.Proto 表示命名空间设定为 Hotfix.Proto。服务端专属的proto文件(以 -s_s 结尾)会被自动跳过。