bug修复
This commit is contained in:
@@ -121,11 +121,19 @@ async function onReceiveMessage(messages = []) {
|
||||
if (msg.roomNumber === roomNumber.value) {
|
||||
if (msg.constructor === MESSAGETYPES.UserEnterRoom) {
|
||||
if (room.value.battleType === 1) {
|
||||
opponent.value = {
|
||||
id: msg.userId,
|
||||
name: msg.name,
|
||||
avatar: msg.avatar,
|
||||
};
|
||||
if (msg.userId === room.value.creator) {
|
||||
owner.value = {
|
||||
id: msg.userId,
|
||||
name: msg.name,
|
||||
avatar: msg.avatar,
|
||||
};
|
||||
} else {
|
||||
opponent.value = {
|
||||
id: msg.userId,
|
||||
name: msg.name,
|
||||
avatar: msg.avatar,
|
||||
};
|
||||
}
|
||||
}
|
||||
if (room.value.battleType === 2) {
|
||||
players.value.push({
|
||||
@@ -137,9 +145,15 @@ async function onReceiveMessage(messages = []) {
|
||||
}
|
||||
if (!start.value && msg.constructor === MESSAGETYPES.UserExitRoom) {
|
||||
if (room.value.battleType === 1) {
|
||||
opponent.value = {
|
||||
id: "",
|
||||
};
|
||||
if (msg.userId === room.value.creator) {
|
||||
owner.value = {
|
||||
id: "",
|
||||
};
|
||||
} else {
|
||||
opponent.value = {
|
||||
id: "",
|
||||
};
|
||||
}
|
||||
}
|
||||
if (room.value.battleType === 2) {
|
||||
players.value = players.value.filter((p) => p.id !== msg.userId);
|
||||
|
||||
Reference in New Issue
Block a user