多人在线匹配。
参数名 | 类型/值 | 描述 |
---|---|---|
matchPlayersPara | MGOBE.types.MatchPlayersPara | 多人匹配参数 |
callback | MGOBE.types.ReqCallback<MGOBE.types.MatchPlayersRsp> | 响应回调函数 |
无
const playerInfo = {
name: "Tom",
customPlayerStatus: 1,
customProfile: "https://xxx.com/icon.png",
matchAttributes: [{
name: "skill1",
value: 99,
}]
};
const matchPlayersPara = {
playerInfo,
matchCode: "play-xxx",
};
// 发起匹配
room.matchPlayers(matchPlayersPara, event => {
if (event.code === 0) {
console.log("匹配成功", room.roomInfo);
} else {
console.log("匹配失败", event.code);
}
});
房间匹配。
参数名 | 类型/值 | 描述 |
---|---|---|
matchRoomPara | MGOBE.types.MatchRoomPara | 房间匹配参数 |
callback | MGOBE.types.ReqCallback<MGOBE.types.MatchRoomSimpleRsp> | 响应回调函数 |
无
const playerInfo = {
name: "Tom",
customPlayerStatus: 1,
customProfile: "https://xxx.com/icon.png",
};
const matchRoomPara = {
playerInfo,
maxPlayers: 5,
roomType: "1",
};
room.matchRoom(matchRoomPara, event => {
if (event.code !== 0) {
console.log("匹配失败", event.code);
}
});
取消玩家匹配。
参数名 | 类型/值 | 描述 |
---|---|---|
cancelMatchPara | MGOBE.types.CancelMatchPara | 取消匹配参数 |
callback | MGOBE.types.ReqCallback<MGOBE.types.CancelMatchRsp> | 响应回调函数 |
无
const cancelMatchPara = {
matchType: MGOBE.ENUM.MatchType.PLAYER_COMPLEX,
};
room.cancelPlayerMatch(cancelMatchPara, event => console.log(event));