mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Start TEngine3.0
Start TEngine3.0
This commit is contained in:
5
Luban/Proto/Log/ProtobufResolver.log
Normal file
5
Luban/Proto/Log/ProtobufResolver.log
Normal file
@@ -0,0 +1,5 @@
|
||||
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
|
BIN
Luban/Proto/ProtobufResolver.exe
Normal file
BIN
Luban/Proto/ProtobufResolver.exe
Normal file
Binary file not shown.
18
Luban/Proto/gen_pb_code.bat
Normal file
18
Luban/Proto/gen_pb_code.bat
Normal file
@@ -0,0 +1,18 @@
|
||||
@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
|
||||
|
191
Luban/Proto/pb_message/DPLogin.proto
Normal file
191
Luban/Proto/pb_message/DPLogin.proto
Normal file
@@ -0,0 +1,191 @@
|
||||
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
|
||||
{
|
||||
}
|
41
Luban/Proto/pb_message/ExternalMessage.proto
Normal file
41
Luban/Proto/pb_message/ExternalMessage.proto
Normal file
@@ -0,0 +1,41 @@
|
||||
syntax = "proto3";
|
||||
package pb.message;
|
||||
// 对外服数据协议
|
||||
message ExternalMessage {
|
||||
// 请求命令类型: 0 心跳,1 业务
|
||||
int32 cmdCode = 1;
|
||||
// 协议开关,用于一些协议级别的开关控制,比如 安全加密校验等。 : 0 不校验
|
||||
int32 protocolSwitch = 2;
|
||||
// 业务路由(高16为主, 低16为子)
|
||||
int32 cmdMerge = 3;
|
||||
// 响应码: 0:成功, 其他为有错误
|
||||
sint32 responseStatus = 4;
|
||||
// 验证信息: 当 responseStatus == -1001 时, 会有值
|
||||
string validMsg = 5;
|
||||
// 业务请求数据
|
||||
bytes data = 6;
|
||||
}
|
||||
|
||||
// int 包装类
|
||||
message IntPb {
|
||||
// int 值
|
||||
sint32 intValue = 1;
|
||||
}
|
||||
|
||||
// int list 包装类
|
||||
message IntListPb {
|
||||
// intList
|
||||
repeated sint32 intValues = 1;
|
||||
}
|
||||
|
||||
// long 包装类
|
||||
message LongPb {
|
||||
// long 值
|
||||
sint64 longValue = 1;
|
||||
}
|
||||
|
||||
// long list 包装类
|
||||
message LongListPb {
|
||||
// longList
|
||||
repeated sint64 longValues = 1;
|
||||
}
|
45
Luban/Proto/pb_message/GameBase.proto
Normal file
45
Luban/Proto/pb_message/GameBase.proto
Normal file
@@ -0,0 +1,45 @@
|
||||
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
|
||||
}
|
35
Luban/Proto/pb_message/ProtoBase.proto
Normal file
35
Luban/Proto/pb_message/ProtoBase.proto
Normal file
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user