155 lines
2.7 KiB
Protocol Buffer
155 lines
2.7 KiB
Protocol Buffer
syntax = "proto3";
|
||
|
||
option go_package = "idl";
|
||
|
||
message WsData {
|
||
uint32 msg_type = 1; // 消息类型
|
||
bytes data = 2; // 数据
|
||
}
|
||
|
||
message MsgType {
|
||
enum Enum{
|
||
None = 0;
|
||
RegisterReq = 1; //注册请求
|
||
RegisterResp = 2; //注册响应
|
||
EnterReq = 3; //进入请求
|
||
EnterResp = 4; //进入响应
|
||
EnterPush = 5; //他人进入推送
|
||
LeaveReq = 6; //离开请求
|
||
LeavePush = 7; //他人离开
|
||
Heartbeat = 8; //心跳
|
||
Move = 9; //移动
|
||
ResetPush = 10; //重置推送
|
||
ClosePush = 11; //关闭推送
|
||
UserInfoPush = 12; //用户信息推送
|
||
StartGamePush = 13; //游戏开始推送
|
||
EndGameReq = 14; //游戏结束请求
|
||
EndGamePush = 15; //游戏结束推送
|
||
TakeItemReq = 16; //获取道具请求
|
||
TakeItemPush = 17; //获取道具推送
|
||
GameItemReq = 18; //场景道具请求
|
||
GameItemResp = 19; //场景道具响应
|
||
}
|
||
}
|
||
|
||
message UserInfo {
|
||
string sn = 1;
|
||
string name = 2;
|
||
uint32 gender = 3;
|
||
uint32 status = 4;
|
||
Position position = 5;
|
||
uint64 game_id = 6;
|
||
Progress progress = 7;
|
||
uint32 helmet = 8;
|
||
}
|
||
|
||
message Point {
|
||
int32 x = 1;
|
||
int32 y = 2;
|
||
int32 z = 3;
|
||
}
|
||
|
||
message Position {
|
||
Point pos = 1; // 位置
|
||
Point dir = 2; // 朝向
|
||
int32 state = 3; // 移动状态 1:起步 2:移动中 3:移动结束
|
||
}
|
||
|
||
message Progress {
|
||
uint32 scene = 1;
|
||
float timeline = 2;
|
||
float video = 3;
|
||
}
|
||
|
||
message RegisterReq {
|
||
string sn = 1;
|
||
}
|
||
|
||
message RegisterResp {
|
||
string sn = 1;
|
||
}
|
||
|
||
message EnterReq {
|
||
string sn = 1;
|
||
}
|
||
|
||
message EnterResp {
|
||
repeated UserInfo users = 1;
|
||
}
|
||
|
||
message EnterPush {
|
||
UserInfo info = 1;
|
||
}
|
||
|
||
message Move {
|
||
string sn = 1;
|
||
Position position = 2;
|
||
}
|
||
|
||
message LeaveReq {
|
||
string sn = 1;
|
||
}
|
||
|
||
message LeavePush {
|
||
string sn = 1;
|
||
}
|
||
|
||
message StartGamePush {
|
||
string sn = 1;
|
||
uint64 game_id = 2;
|
||
}
|
||
|
||
message EndGameReq {
|
||
string sn = 1;
|
||
}
|
||
|
||
message EndGamePush {
|
||
string sn = 1;
|
||
}
|
||
|
||
message ResetPush {
|
||
}
|
||
|
||
message ClosePush {
|
||
}
|
||
|
||
message DeviceInfo {
|
||
string sn = 1;
|
||
uint32 battery = 2;
|
||
uint32 volume = 3;
|
||
}
|
||
|
||
message Heartbeat {
|
||
UserInfo info = 1;
|
||
DeviceInfo device = 2;
|
||
}
|
||
|
||
message UserInfoPush {
|
||
UserInfo info = 1;
|
||
}
|
||
|
||
message TakeItemReq {
|
||
string sn = 1;
|
||
uint32 item_id = 2;
|
||
uint32 operate = 3;
|
||
}
|
||
|
||
message TakeItemPush {
|
||
string sn = 1;
|
||
uint32 item_id = 2;
|
||
uint32 operate = 3;
|
||
}
|
||
|
||
message ItemInfo {
|
||
uint32 item_id = 1;
|
||
uint32 operate = 2;
|
||
}
|
||
|
||
message GameItemReq {
|
||
string sn = 1;
|
||
uint64 game_id = 2;
|
||
}
|
||
|
||
message GameItemResp {
|
||
repeated ItemInfo items = 1;
|
||
} |