匹配
匹配.png
//请求匹配
message CM_Match {
int type; //匹配房间类型
String name; //玩家名称
long targetPlayerId; //加入他人比赛,目标玩家id
}
//匹配成功
message L2RM_MatchSucc {
int roomId;
int roomType;
boolean createRoomIfNotExist; //场景中的第一个玩家为true
RoomPlayerEnt ent; //房间服需要的玩家信息
}
//业务服收到此消息创建房间
message R2LM_AddRoom {
int id;
int sign; //房间签名
int type;
Date createTime;
}
//业务服收到此消息,在房间销毁前(R2LM_RemoveRoom),玩家都可以断线重连房间服
message R2LM_AddPlayer {
long playerId;
int roomId;
int roomSign;
int roomType;
int token; //登录令牌,断线重连时下发给客户端
}
//客户端收到此消息后连接房间服
message SM_RoomServerPermission {
String host;
int port;
String token; //本次登录的令牌
}
业务服房间管理
业务服维护了房间服的Room。房间服创建Room,业务服创建对应Room,房间服销毁Room,业务服销毁对应Room。其变化通过处理房间服的R2LM_AddRoom