update: 更新Readme
							parent
							
								
									0ee80dacf7
								
							
						
					
					
						commit
						15bbf28970
					
				
							
								
								
									
										118
									
								
								README.md
								
								
								
								
							
							
						
						
									
										118
									
								
								README.md
								
								
								
								
							|  | @ -1,64 +1,106 @@ | |||
| # GURU Dof kcp Client | ||||
| # GURU Dof Client Library | ||||
| 
 | ||||
| ### VERSION 0.0.1 | ||||
| 
 | ||||
| ## 插件介绍 | ||||
| 
 | ||||
| 基于upm_guru_kcp库,服务与dof项目的客户端类封装. | ||||
| 在更新了prot文件之后,需要重新生成对应的cs文件。请按以下步骤进行操作: | ||||
| > 本插件是基于 `upm_guru_kcp` 库,服务与 `dof` 项目的客户端类封装. | ||||
| > | ||||
| > 当客户端或服务端更新了 `prot` 文件之后,需要重新生成对应的cs文件。 | ||||
| >  | ||||
| > 具体请按以下步骤进行操作: | ||||
| > | ||||
| 
 | ||||
| ## 安装 .NET 6.0 运行时(必须使用6.0版本) | ||||
| </br> | ||||
| 
 | ||||
| ## 环境部署 | ||||
| 
 | ||||
| ### 安装 .NET 6.0 运行时(必须使用6.0版本) | ||||
| * 下载离线安装包 | ||||
|   - Mac: https://dotnet.microsoft.com/zh-cn/download/dotnet/thank-you/sdk-6.0.413-macos-x64-installer | ||||
|   - Windows: https://dotnet.microsoft.com/zh-cn/download/dotnet/thank-you/sdk-6.0.413-windows-x64-installer  | ||||
| 
 | ||||
| * Mac下建议使用 homebrew | ||||
| brew tap isen-ng/dotnet-sdk-versions | ||||
| brew install --cask dotnet-sdk6-0-400 | ||||
|   ```shell | ||||
|   brew tap isen-ng/dotnet-sdk-versions | ||||
|    | ||||
|   brew install --cask dotnet-sdk6-0-400 | ||||
|   ``` | ||||
| 
 | ||||
| ## 安装 protobuf-net.Protogen 命令行程序 | ||||
| dotnet tool install --global protobuf-net.Protogen --version 3.2.12 | ||||
| ### 安装 protobuf-net.Protogen 命令行程序 | ||||
| 
 | ||||
| * 命令行安装 protobuf-net.Protogen 工具 | ||||
|   ```shell   | ||||
|   dotnet tool install --global protobuf-net.Protogen --version 3.2.12 | ||||
|   ``` | ||||
| 
 | ||||
| * Windows | ||||
| protogen 的安装目录为 C:\Users\用户名\.dotnet\tools ,可直接在 cmd 命令行下运行 protogen | ||||
| protogen 的安装目录为 `C:\Users\用户名\.dotnet\tools` ,可直接在 cmd 命令行下运行 protogen | ||||
| 
 | ||||
| * Macos | ||||
| 在 Macos 下 protogen 的安装目录为 /Users/用户名/.dotnet/tools,可能需要手动将 | ||||
| ``` | ||||
| PATH=PATH:/Users/用户名/.dotnet/tools | ||||
| ``` | ||||
| 加入到 ~/.bash_profile中,因为 homebrew 加入的 PATH ~/.dotnet/tools 无效 | ||||
| * Macos  | ||||
| 在 Macos 下 protogen 的安装目录为 `/Users/用户名/.dotnet/tools`,可能需要手动将 | ||||
|   ```shell | ||||
|   PATH=PATH:/Users/用户名/.dotnet/tools | ||||
|   ``` | ||||
|   加入到 `~/.bash_profile` 中,因为 homebrew 加入的 `PATH ~/.dotnet/tools` 无效 | ||||
| 
 | ||||
| ## 生成 cs 文件 | ||||
| </br> | ||||
| 
 | ||||
| ## 文件构建 | ||||
| 
 | ||||
| ### 生成 cs 文件 | ||||
| 
 | ||||
| * Windows | ||||
| ``` | ||||
| cd upm_guru_dof_lib\Runtime\ServerProto | ||||
| protogen messages.proto --csharp_out=..\NetworkGen | ||||
| ``` | ||||
|   ```shell | ||||
|   cd upm_guru_dof_lib\Runtime\ServerProto | ||||
|   protogen messages.proto --csharp_out=..\NetworkGen | ||||
|   ``` | ||||
| 
 | ||||
| * MacOS | ||||
| ``` | ||||
| cd upm_guru_dof_lib/Runtime/ServerProto | ||||
| ~/.dotnet/tools/protogen messages.proto --csharp_out=../NetworkGen | ||||
| ``` | ||||
|   ```shell | ||||
|   cd upm_guru_dof_lib/Runtime/ServerProto | ||||
|   ~/.dotnet/tools/protogen messages.proto --csharp_out=../NetworkGen | ||||
|   ``` | ||||
| </br> | ||||
| 
 | ||||
| ## 安装和接入 | ||||
| ## UPM 安装和接入 | ||||
| 
 | ||||
| ### 插件引入 | ||||
| 
 | ||||
| - 本插件需要使用公司内部的Gitlab加载对应的repo, 详见 [Castbox内部git服务器Gitea使用指南](https://docs.google.com/document/d/1DiGPDD5Teu2QcYaBhqAcsqMbb3DJ5sdnTQMuvVzJSUk/edit#heading=h.w9tkkzwwyjxf) | ||||
| - 根据文档部署好本机配置后, 请在Unity内部配置如下参数 | ||||
|   - 修改位于项目Packages/manifest.json文件,在dependencies中添加 | ||||
|   ``` | ||||
|   { | ||||
|   "dependencies": { | ||||
|     "com.guru.unity.gurudoflib": "git@git.chengdu.pundit.company:castbox/upm_guru_dof_lib.git", | ||||
|     ... | ||||
| * 本插件需要使用公司内部的Gitlab加载对应的repo, 详见 [Castbox内部git服务器Gitea使用指南](https://docs.google.com/document/d/1DiGPDD5Teu2QcYaBhqAcsqMbb3DJ5sdnTQMuvVzJSUk/edit#heading=h.w9tkkzwwyjxf) | ||||
| * 根据文档部署好本机配置后, 请在Unity内部配置如下参数 | ||||
|   - 修改位于项目 `Packages/manifest.json` 文件,在dependencies中添加 | ||||
|     ```json | ||||
|     { | ||||
|       "dependencies": { | ||||
|         "com.guru.unity.gurudoflib": "git@git.chengdu.pundit.company:castbox/upm_guru_dof_lib.git", | ||||
|         ... | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   ```  | ||||
|     ```  | ||||
|   - 修改link.xml文件,添加 | ||||
|   ``` | ||||
|   <assembly fullname="GuruDofLib.Runtime" preserve="all"/> | ||||
|   ``` | ||||
|     ```xml | ||||
|     <assembly fullname="GuruDofLib.Runtime" preserve="all"/> | ||||
|     ``` | ||||
| 
 | ||||
| ## UPM 发布 | ||||
| 
 | ||||
| 在项目研发中, 根据业务需求, 将会需要更改接口的逻辑及结构. 并更新此库. 需要项目组自行维护和发布 dof_lib 的版本. | ||||
| 
 | ||||
| 插件更新流程如下: | ||||
| 
 | ||||
| 1. 研发流中正常修改 `proto` 接口和对应的业务逻辑, 并提交推送至 `main` 分支 | ||||
| 2. 手动修改 `./Makefile` 中的 `Version` 字段并提交. (该字段为插件的版本号, 请遵循三位版本号规范, 如: `1.0.0`)  | ||||
| 3. 在此路径中, 执行命令行, 项目会自动提交并打入Tag标签  | ||||
|    ```shell | ||||
|    make publish | ||||
|    ``` | ||||
| 4. 在游戏主项目中, 修改 `Packages/manifest.json` 文件, 将 `com.guru.unity.gurudoflib` 的版本号改为刚刚发布的版本号, 并等待编译结束. (没有的需要再repo地址后添加 `#x.x.x` 作为版本标记) | ||||
|     ```json | ||||
|     { | ||||
|       "dependencies": { | ||||
|         "com.guru.unity.gurudoflib": "git@git.chengdu.pundit.company:castbox/upm_guru_dof_lib.git#0.0.1", | ||||
|         ... | ||||
|       } | ||||
|     } | ||||
|     ``` | ||||
							
								
								
									
										17
									
								
								helper.py
								
								
								
								
							
							
						
						
									
										17
									
								
								helper.py
								
								
								
								
							|  | @ -2,16 +2,15 @@ | |||
| import argparse | ||||
| import json | ||||
| 
 | ||||
| 
 | ||||
| # Change Version to json file with 'version' key | ||||
| def set_version(path, version): | ||||
|     s = json.loads(open(path).read()) | ||||
|     s["version"] = version | ||||
|     # print('json', s) | ||||
|     json.dump(s, open(path, "w")) | ||||
|     json.dump(s, open(path, "w"), indent=1) | ||||
|     print('Packge version set to', version) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| # Entry | ||||
| if __name__ == '__main__': | ||||
|     # 解析参数 | ||||
|     parser = argparse.ArgumentParser(description='Process some integers.') | ||||
|  | @ -24,13 +23,13 @@ if __name__ == '__main__': | |||
|     path = args.path | ||||
|     if len(path) == 0: | ||||
|         print('no path found') | ||||
|          | ||||
|      | ||||
|     ver = args.ver | ||||
|         exit(1) | ||||
| 
 | ||||
|     ver = args.ver | ||||
|     if len(ver) == 0: | ||||
|         ver = '0.0.1' | ||||
| 
 | ||||
|     if args.action == 'set_ver': | ||||
|         set_version(path, ver)     | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     #------ main end ------ | ||||
		Loading…
	
		Reference in New Issue
	
	 huyufei
						huyufei