You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
3.3 KiB
138 lines
3.3 KiB
syntax = "proto3"; |
|
|
|
package pb; |
|
|
|
|
|
option go_package = "../../pb"; |
|
|
|
// 游戏通用协议 |
|
enum GameProtocol{ |
|
Invalid = 0; |
|
EnterGameReq = 1; // 进入游戏请求 |
|
EnterGameResp = 2; // 进入游戏请求 |
|
TableInfoReq = 3; // 请求获取游戏数据 GameCommonReq |
|
TableInfoResp = 4; // 每个游戏不一样 |
|
|
|
GameStartResp = 6; // 游戏阶段转换协议/开始下注 |
|
|
|
GameSettleResp = 8; // 游戏阶段转换协议/停止下注 |
|
LeaveReq = 9; // 退出房间请求 GameCommonReq |
|
LeaveResp = 10; // 退出房间返回 GameCommonResp |
|
BetReq = 11; // 请求下注 |
|
BetResp = 12; // 请求下注返回 |
|
|
|
BetBroadcast = 14; // 其他人下注广播 |
|
HistoryReq = 15; // 请求历史记录 GameCommonReq |
|
HistoryResp = 16; // 历史记录返回 |
|
BetListReq = 17; // 请求玩家下注列表 GameCommonReq |
|
BetListResp = 18; // 玩家下注列表返回 GameMsgBetListResp |
|
} |
|
|
|
// 定义游戏阶段 |
|
enum GameStatus { |
|
GameStatusInvalid = 0; // 无效 |
|
GameStatusNormal = 1; // 空闲 |
|
GameStatusPlaying = 2; // 游戏中 |
|
GameStatusSettle = 3; // 结算中 |
|
GameStatusSpecial = 4; // 子游戏特殊阶段 |
|
} |
|
|
|
// 定义玩家状态 |
|
enum PlayerStatus { |
|
PlayerStatusInvalid = 0; // 无效 |
|
PlayerStatusNormal = 1; // 空闲 |
|
PlayerStatusPlaying = 2; // 游戏中 |
|
PlayerStatusSettle = 3; // 已结算 |
|
PlayerStatusLeave = 4; // 已退出 |
|
} |
|
|
|
|
|
message GameUser{ |
|
int64 UID = 1; |
|
string Nick = 2; |
|
string Avatar = 3; |
|
int64 CurrencyType = 4; |
|
int64 Balance = 5; |
|
int64 Bet = 6; |
|
PlayerStatus Status = 7; |
|
} |
|
|
|
// 通用客户端请求 |
|
message GameCommonReq{ |
|
} |
|
|
|
// 通用客户端返回 |
|
message GameCommonResp{ |
|
int64 Result = 1; // 0:正常 |
|
} |
|
|
|
// 通用客户端请求 |
|
message GameMsgEnterGameReq{ |
|
int64 SubID = 1; // 房间子id |
|
int64 CurrencyType = 2; |
|
} |
|
|
|
// 通用客户端请求 |
|
message GameCommonTableInfo{ |
|
GameUser User = 1; |
|
repeated int64 History = 2; |
|
repeated BetPlayers List = 3; |
|
GameStatus Status = 4; |
|
int64 TimeLeft = 5; |
|
repeated int64 BetLimit = 6; |
|
} |
|
|
|
message GameMsgBetListResp{ |
|
repeated BetPlayers List = 1; |
|
} |
|
|
|
message BetPlayers{ |
|
int64 UID = 1; // 玩家uid |
|
string Avatar = 2; // 头像 |
|
string Nick = 3; // 昵称 |
|
int64 CurrencyType = 4; |
|
int64 BetAmount = 5; // 下注金额 |
|
} |
|
|
|
message ArrayInt64{ |
|
repeated int64 Element = 1; |
|
} |
|
|
|
// 通用离开返回 |
|
message GameLeaveResp{ |
|
int64 Result = 1; // 0:正常 |
|
int64 Reason = 2; // 0: 主动离开 1:强制离开 |
|
} |
|
|
|
// 下注请求 |
|
message GameMsgBetReq{ |
|
int64 Area = 1; |
|
int64 Amount = 2; // 下注金额 |
|
} |
|
|
|
// 下注返回 |
|
message GameMsgBetResp{ |
|
int64 Code = 1; // 错误码 |
|
int64 CurrencyType = 2; |
|
int64 Amount = 3; // 下注金额 |
|
int64 Balance = 4; // 下注后余额 |
|
int64 Area = 5; |
|
} |
|
|
|
// 其他人下注广播 |
|
message GameMsgBetBroadcastResp{ |
|
int64 UID = 1; // 下注人uid |
|
int64 CurrencyType = 2; |
|
int64 Amount = 3; // 下注金额 |
|
int64 Area = 4; |
|
} |
|
|
|
// 游戏开始 |
|
message GameMsgGameStartResp{ |
|
int64 TimeLeft = 1; // 剩余时间 |
|
} |
|
|
|
// 历史记录返回 |
|
message GameMsgHistoryResp{ |
|
repeated int64 Results = 1; // 历史记录 |
|
}
|
|
|