diff --git a/Luban/Proto/Gen/ProtoBase.cs b/Luban/Proto/Gen/ProtoBase.cs new file mode 100644 index 00000000..8efbfa21 --- /dev/null +++ b/Luban/Proto/Gen/ProtoBase.cs @@ -0,0 +1,59 @@ +using System; +using ProtoBuf; +using TEngine; +using System.Collections.Generic; +namespace GameProto +{ + // 这个文件只放协议,和协议头 + // 消息协议 + [Serializable,global::ProtoBuf.ProtoContract(Name = @"CSPkg")] + public partial class CSPkg + { + [global::ProtoBuf.ProtoMember(1)] + public CSPkgHead Head { get; set; } + + [global::ProtoBuf.ProtoMember(2)] + public CSPkgBody Body { get; set; } + + } + + // 消息协议头 + [Serializable,global::ProtoBuf.ProtoContract(Name = @"CSPkgHead")] + public partial class CSPkgHead + { + [global::ProtoBuf.ProtoMember(1)] + public uint MsgId { get; set; } + + [global::ProtoBuf.ProtoMember(2)] + public uint MsgLength { get; set; } + + [global::ProtoBuf.ProtoMember(3)] + public uint MsgVersion { get; set; } + + [global::ProtoBuf.ProtoMember(4)] + public uint Echo { get; set; } + + [global::ProtoBuf.ProtoMember(5)] + public uint SvrTime { get; set; } + + } + + // 消息协议体 + [Serializable,global::ProtoBuf.ProtoContract(Name = @"CSPkgBody")] + public partial class CSPkgBody + { + } + + // 协议ID + [global::ProtoBuf.ProtoContract()] + public enum CSMsgID + { + CS_START = 0, + + CS_HeartBeat = 10001, + + CS_END = 10000, + + } + +} diff --git a/Luban/Proto/Log/ProtobufResolver.log b/Luban/Proto/Log/ProtobufResolver.log deleted file mode 100644 index 00a4418e..00000000 --- a/Luban/Proto/Log/ProtobufResolver.log +++ /dev/null @@ -1,5 +0,0 @@ -Info_2023/1/13 11:33:15: By AlanDu Time:2023/1/13 11:33:15 -Info_2023/1/13 11:33:15: Version 0.1 -Info_2023/1/13 11:33:15: Function Protobuf Resolver -Info_2023/1/13 11:33:15: protoDirPath:G:\WorkSpace\DinGameFrame\Luban\Proto\pb_message -Info_2023/1/13 11:33:15: ProtoOutputPath:../../Assets\GameMain\HotFix\Scripts\Proto\Definition\Constant diff --git a/Luban/Proto/ProtobufResolver.exe b/Luban/Proto/ProtobufResolver.exe deleted file mode 100644 index 0d97384d..00000000 Binary files a/Luban/Proto/ProtobufResolver.exe and /dev/null differ diff --git a/Luban/Proto/gen_pb_code.bat b/Luban/Proto/gen_pb_code.bat index 2c65d8ba..faa0cd9b 100644 --- a/Luban/Proto/gen_pb_code.bat +++ b/Luban/Proto/gen_pb_code.bat @@ -1,18 +1,21 @@ -@echo off & setlocal enabledelayedexpansion -cd %~dp0 -echo =================start gen proto code================= -set pb_path=pb_message -set out_path=..\..\Assets\GameMain\HotFix\Scripts\Proto -del /f /s /q %out_path%\*.* -for /f "delims=" %%i in ('dir /b %pb_path%') do ( -echo ------------%%i start gen -protoc -I=pb_message --csharp_out=../../Assets/GameMain/HotFix/Scripts/Proto pb_message\%%i -echo ------------%%i gen success -) -echo =================end gen proto code================= -set cur_path=%~dp0 -set outEventPath=../../Assets\GameMain\HotFix\Scripts\Proto\Definition\Constant -call ProtobufResolver.exe %cur_path%pb_message %outEventPath% -echo =================end gen proto event================= -pause +@REM @echo off & setlocal enabledelayedexpansion +@REM cd %~dp0 +@REM echo =================start gen proto code================= +@REM set pb_path=pb_message +@REM set out_path=..\..\Assets\GameMain\HotFix\Scripts\Proto +@REM del /f /s /q %out_path%\*.* +@REM for /f "delims=" %%i in ('dir /b %pb_path%') do ( +@REM echo ------------%%i start gen +@REM protoc -I=pb_message --csharp_out=../../Assets/GameMain/HotFix/Scripts/Proto pb_message\%%i +@REM echo ------------%%i gen success +@REM ) +@REM echo =================end gen proto code================= +@REM set cur_path=%~dp0 +@REM set outEventPath=../../Assets\GameMain\HotFix\Scripts\Proto\Definition\Constant +@REM call ProtobufResolver.exe %cur_path%pb_message %outEventPath% +@REM echo =================end gen proto event================= +@REM pause +protoc -I=pb_schemas --csharp_out=Gen pb_schemas\ProtoBase.proto + +pause \ No newline at end of file diff --git a/Luban/Proto/pb_message/DPLogin.proto b/Luban/Proto/pb_message/DPLogin.proto deleted file mode 100644 index c6186b02..00000000 --- a/Luban/Proto/pb_message/DPLogin.proto +++ /dev/null @@ -1,191 +0,0 @@ -syntax = "proto3"; - -import "GameBase.proto"; - -option java_package ="com.game.juhe.server.protobuf.proto"; - -package DPLogin; - -// 客户端向服务端发送登录协议,发送账号和密码 -// PTC_C2G_LOGININFO -message DPUserLoginInfoReq -{ - string szAccount = 1; // 账号 - string szPassword = 2; // 密码 - string szMacAdress = 3; // mac地址 - int32 nClientVersion = 4; // 客户端版本号 - string szUserName = 5; // 用户名字 - string extensionJson = 6; // 透传字段 -} - -// 登陆角色服返回验证结果 -enum AccountLoginVerifyResult -{ - ACC_VERIFY_RET_SUCCESS = 0; // 允许进入角色服务器 - ACC_VERIFY_RET_FAILED = 1; // 未知错误 - ACC_VERIFY_RET_ACCOUNT_OR_PASSWORD_ERROR = 2; // 账号或者密码错误 - ACC_VERIFY_RET_MAINTENANCE = 3; // 服务器维护中 - ACC_VERIFY_RET_IS_FULL = 4; // 服务器人数已满 - ACC_VERIFY_RET_TIMEOUT = 5; // 验证超时 - ACC_VERIFY_RET_PAYSYSHTTPERROR = 6; // http验证系统异常请联系客服 - ACC_VERIFY_RET_FULLACCOUNT_INLIST = 7; // 因为人数过多在排队队列 - ACC_VERIFY_RET_FULLACCOUNT_OUTLIST = 8; // 因为人数过多连排队队列都排不上 - ACC_VERIFY_RET_FULLVERIFYACOUNT = 9; // 验证账号人数过多请耐心等待 - ACC_VERIFY_RET_CLIENTVERSIONERROR = 10; // 客户端版本不对 -} - -// 玩家登陆,身份验证的结果 -// PTC_G2C_ACC_VERIFY_RESULT -message DPAccountVerifyResultResp -{ - string szAccount = 1; // 账号 - AccountLoginVerifyResult nResult = 2; // 结果 - string szLoginGuid = 3; // 登陆guid - string szServerIP = 4; // 服务器ip - int32 nPort = 5; // 端口 - int32 nServerID = 6; // 服务器ID - int32 nWaitNum = 7; // 排队人数 - int32 nMaxWaitNum = 8; // 最大排队人数 - string szGatewayName = 9; // 服务器名 -} - - -// 客户端发起登陆协议 -// PTC_C2S_LOGICLOGIN -message DPGSLogicLoginReq -{ - string szLoginGuid = 1; // 登陆guid - string szAccount = 2; // 账号 - int32 nServerId = 3; // serverID - string szMacAdress = 4; // mac地址 -} - -// 登陆逻辑服失败 -enum BEGSLogicLoginRet -{ - GS_LOGIN_RET_FAILED = 0; // 未知错误 - GS_LOGIN_RET_SUCCESS = 1; // 成功 - GS_LOGIN_RET_FAILED_NEED_AUTH = 2; // 需要重新账号密码验证 - GS_LOGIN_RET_FAILED_DIRECTLOGIN = 3; // 断线重连失败 - GS_LOGIN_RET_FAILED_ACCOUNTLOGINPROXY = 4; // 登录代理服务器失败 - GS_LOGIN_RET_FAILED_GSDIRECTLOGIN = 5; // 登录gs失败 - GS_LOGIN_RET_FAILED_ACCOUNTLOGINBEGIN = 6; // account登录失败 - GS_LOGIN_RET_FAILED_ASKGCROLEINFO = 7; // 登陆失败 - GS_LOGIN_RET_FAILED_ROLELIST = 8; // 获取角色列表 - GS_LOGIN_RET_FAILED_ASKGSPERMISSION = 9; // 询问gs登录失败 - GS_LOGIN_RET_FAILED_ASKGSPERMISSIONRET = 10; // 询问gs登录失败 - GS_LOGIN_RET_FAILED_SELECTROLEFAILED = 11; // 选择角色登录失败 -} - -// 客户端登陆逻辑服失败返回错误码 -// PTC_S2C_LOGICLOIN_RET -message DPGSLogicLoginRetResp -{ - string szAccount = 1; // 账号 - BEGSLogicLoginRet eRet = 2; // 返回登陆结果 -} - -// 角色列表中的角色信息 -message DPGSRoleItemInfo -{ - GameBase.DPRoleBaseInfo stBaseInfo = 1; - int64 nCreateTime = 2; // 创建角色时间 - int32 nPlatformId = 3; // 平台类型 - int32 nCreateServerId = 4; // 创建角色的服务器ID -} - -// 网关服务端把角色列表发回到客户端,里面有账号,角色数和角色列表 -// PTC_G2C_ROLELIST_RESPONE -message DPRoleListResponeResp -{ - string szAccount = 1; // 账号 - int32 nRoleCount = 2; // 角色数 - repeated DPGSRoleItemInfo arrayRoleList = 3; // 角色列表 -} - -// 玩家确定选取角色登录游戏 -// PTC_C2G_GAMELOGIN_REQUEST -message DPGameLoginRequestReq -{ - string szAccount = 1; // 账号 - uint64 nRoleGuid = 2; // 玩家唯一标识id guid - string szRoleName = 3; // 玩家名 -} - -// 创建角色发送创建的角色名到网关服务器 -// PTC_C2G_CREATE_ROLE -message DPCreateRoleReq -{ - string szAccount = 1; // 账号 - string szRoleName = 2; // 角色名 - int32 nProfessionId = 3; // 角色ID - int32 nPortrait = 4; // 头像 - int32 nClothId = 5; // 选择的时装 - int32 nPlatformId = 6; // 平台ID -} - -// 创建角色失败原因 -enum RoleCreateFailedResult -{ - ROLECREATE_FAIL_REASON_NONE = 0; // 角色创建成功 - ROLECREATE_FAIL_REASON_UNKNOWN = 1; // 未知错误 - ROLECREATE_FAIL_REASON_NAME_FILTER = 2; // 角色名非法 - ROLECREATE_FAIL_REASON_NAME_EXIST = 3; // 角色名已存在 - ROLECREATE_FAIL_REASON_OVER_MAX_ROLE_PER_GATEWAY = 4; // 创建角色超过本服上限 - ROLECREATE_FAIL_REASON_OVER_MAX_ROLE_PER_ZONE = 5; // 创建角色超过整个大区上限 - ROLECREATE_FAIL_MAX_NAME_LEN = 6; // 角色名长度超过上限 - ROLECREATE_FAIL_MIN_NAME_LEN = 7; // 角色名长度低于下限 -} - -// 创建角色返回结果给客户端 -// PTC_G2C_CREATEROLE_RESULT -message DPCreateRoleResultResp -{ - string szAccount = 1; // 账号 - string szRoleName = 2; // 角色名 - uint64 nRoleGuid = 3; // 玩家唯一标识id guid - bool bSuccessed = 4; // 是否成功 - RoleCreateFailedResult nFailedReason = 5; // 如果失败,返回原因 -} - -// 踢掉玩家的原因 -enum KickOutClientResult -{ - KICKOUT_REASON_NULL = 0; //默认踢掉角色 - KICKOUT_REASON_SAMEACCOUNTLOGIN = 1; //账号重复登录 - KICKOUT_REASON_KICKHANGUP = 2; //踢掉挂机的玩家 - KICKOUT_REASON_LOGINFAILED = 3; //客户端登录失败 - KICKOUT_REASON_CLIENTDISCONNECT = 4; //客户端断开连接 - KICKOUT_REASON_CLIENTREQUESTEXIT = 5; //客户端请求退出 - KICKOUT_REASON_SERVERKICK = 6; //服务器因错误挫人 - KICKOUT_REASON_UNLEGALCLIENT = 7; //非法的客户端 - KICKOUT_REASON_BACKENDKICK = 8; //后台踢人 - KICKOUT_REASON_ONLINEGMKICK = 9; //GM在线踢人 - KICKOUT_REASON_GSCRASH = 10; //GS宕机踢人 - KICKOUT_REASON_GCCRASH = 11; //GC宕机踢人 - KICKOUT_REASON_SCENECHANGE = 12; //场景切换失败 - KICKOUT_REASON_BANPLAYER = 13; //封号 - KICKOUT_REASON_SWITCHSERVER = 14; //切换gs的踢人 - KICKOUT_REASON_EXITROLE = 15; //切换角色 - KICKOUT_REASON_DIRECTLOGIN = 16; //断线重连失败 - KICKOUT_REASON_BISHOPKICKOUT = 17; //bishop踢人 -} - -// 踢掉客户端 -// PTC_G2C_KICKOUTCLIENT -message DPKickOutClientResp -{ - KickOutClientResult eKickOut = 1; // 踢掉原因 -} - -// 退出账号,到账号登录界面 -// PTC_C2S_EXITACCOUNT -message DPGSExitAccountReq -{ -} - -// 退出角色,到选择角色界面 -// PTC_C2S_EXITROLE -message DPGSExitRoleReq -{ -} diff --git a/Luban/Proto/pb_message/GameBase.proto b/Luban/Proto/pb_message/GameBase.proto deleted file mode 100644 index 0ea992c4..00000000 --- a/Luban/Proto/pb_message/GameBase.proto +++ /dev/null @@ -1,45 +0,0 @@ -syntax = "proto3"; - -option java_package ="com.game.juhe.server.protobuf.proto"; - -package GameBase; -// 游戏全局基础数据,和协议无关,就放结构 - -enum PacketType -{ - Undefined = 0; - ClientToServer = 1; - ServerToClient = 2; -} - -message PacketHeader -{ - PacketType packetType = 1; - int64 id = 2; - int64 packetLength = 3; - bool isValid = 4; -} - -// PTC_C2S_HeartBeat -message CSHeartBeat -{ - int64 dwTime = 1; -} - -// PTC_S2C_HeartBeat -message SCHeartBeat -{ - int64 dwTime = 1; -} - -// 玩家角色基础数据数据 -message DPRoleBaseInfo -{ - uint64 ullRoleGuid = 1; // guid - string szRoleName = 2; // 角色名 - int32 nLevel = 3; // 角色等级 - int32 nProfessionId = 4; // 角色ID - int32 nPortraitId = 5; // 头像 - int32 nFightPower = 6; // 战斗力 - int32 nClothId = 7; // 时装ID -} \ No newline at end of file diff --git a/Luban/Proto/pb_message/ProtoBase.proto b/Luban/Proto/pb_message/ProtoBase.proto deleted file mode 100644 index 57862d54..00000000 --- a/Luban/Proto/pb_message/ProtoBase.proto +++ /dev/null @@ -1,35 +0,0 @@ -syntax = "proto3"; - -option java_package ="com.game.juhe.server.protobuf.proto"; - -package ProtoBase; -// 这个文件只放协议,和协议头 - -// 协议头 -message BGProtocolHeader -{ - int32 uProtocolId = 1; // 协议号 - int32 uKeyLen = 2; // 验证码长度 - bytes szSessionKey = 3; //[MAX_SESSIONKEY_LEN=64] -} - -// 协议ID -enum ProtocolID -{ - PTC_START = 0; - - PTC_C2S_HeartBeat = 10001; // 客户端向网关服务器的协议id - PTC_S2C_HeartBeat = 10002; // 网关服务器向客户端的协议id - PTC_C2G_LOGININFO = 10003; - PTC_G2C_ACC_VERIFY_RESULT = 1004; - PTC_C2S_LOGICLOGIN = 10005; - PTC_S2C_LOGICLOIN_RET = 10006; - PTC_G2C_ROLELIST_RESPONE = 10007; - PTC_C2G_GAMELOGIN_REQUEST = 10008; - PTC_C2G_CREATE_ROLE = 1009; - PTC_G2C_CREATEROLE_RESULT = 10010; - PTC_G2C_KICKOUTCLIENT = 10011; - PTC_C2S_EXITACCOUNT = 10012; - PTC_C2S_EXITROLE = 10013; - PTC_END = 10000; -} diff --git a/Luban/Proto/pb_message/ExternalMessage.proto b/Luban/Proto/pb_schemas/ExternalMessage.proto similarity index 97% rename from Luban/Proto/pb_message/ExternalMessage.proto rename to Luban/Proto/pb_schemas/ExternalMessage.proto index adc90070..350bc930 100644 --- a/Luban/Proto/pb_message/ExternalMessage.proto +++ b/Luban/Proto/pb_schemas/ExternalMessage.proto @@ -1,5 +1,7 @@ syntax = "proto3"; -package pb.message; + +package GameProto; + // 对外服数据协议 message ExternalMessage { // 请求命令类型: 0 心跳,1 业务 diff --git a/Luban/Proto/pb_schemas/GameProto.proto b/Luban/Proto/pb_schemas/GameProto.proto new file mode 100644 index 00000000..6f476e76 --- /dev/null +++ b/Luban/Proto/pb_schemas/GameProto.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; + +package GameProto; +// 游戏全局基础数据,和协议无关,就放结构 + +// 导入定义 +import "ProtoBase"; + diff --git a/Luban/Proto/pb_schemas/ProtoBase.proto b/Luban/Proto/pb_schemas/ProtoBase.proto new file mode 100644 index 00000000..55a40694 --- /dev/null +++ b/Luban/Proto/pb_schemas/ProtoBase.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package GameProto; +// 这个文件只放协议,和协议头 + +// 消息协议 +message CSPkg +{ + CSPkgHead Head = 1; //消息协议头 + CSPkgBody Body = 2; //消息协议体 +} + +// 消息协议头 +message CSPkgHead +{ + uint32 MsgId = 1; //协议号 + uint32 MsgLength = 2; //协议长度 + uint32 MsgVersion = 3; //协议版本 + uint32 Echo = 4; //回带字段 + uint32 SvrTime = 5; //服务器时间 +} + +// 消息协议体 +message CSPkgBody +{ + +} + + +// 协议ID +enum CSMsgID +{ + CS_START = 0; + CS_HeartBeat = 10001; + CS_END = 10000; +}