添加游戏异常结束处理

This commit is contained in:
kron
2025-07-16 16:09:10 +08:00
parent c0dd20cb3f
commit dc53653398
3 changed files with 30 additions and 9 deletions

View File

@@ -421,9 +421,16 @@ async function onReceiveMessage(messages = []) {
} }
if (msg.constructor === MESSAGETYPES.MatchOver) { if (msg.constructor === MESSAGETYPES.MatchOver) {
uni.setStorageSync("last-battle", msg.endStatus); uni.setStorageSync("last-battle", msg.endStatus);
uni.redirectTo({ if (msg.endStatus.nosaved) {
url: `/pages/battle-result?battleId=${msg.id}`, uni.showToast({
}); title: "游戏结束",
icon: "none",
});
} else {
uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}`,
});
}
} }
} }
}); });

View File

@@ -148,9 +148,16 @@ async function onReceiveMessage(messages = []) {
} }
if (msg.constructor === MESSAGETYPES.MatchOver) { if (msg.constructor === MESSAGETYPES.MatchOver) {
uni.setStorageSync("last-battle", msg.endStatus); uni.setStorageSync("last-battle", msg.endStatus);
uni.redirectTo({ if (msg.endStatus.nosaved) {
url: `/pages/battle-result?battleId=${msg.id}`, uni.showToast({
}); title: "游戏结束",
icon: "none",
});
} else {
uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}`,
});
}
} }
}); });
} }

View File

@@ -214,9 +214,16 @@ async function onReceiveMessage(messages = []) {
} }
if (msg.constructor === MESSAGETYPES.MatchOver) { if (msg.constructor === MESSAGETYPES.MatchOver) {
uni.setStorageSync("last-battle", msg.endStatus); uni.setStorageSync("last-battle", msg.endStatus);
uni.redirectTo({ if (msg.endStatus.nosaved) {
url: `/pages/battle-result?battleId=${msg.id}`, uni.showToast({
}); title: "游戏结束",
icon: "none",
});
} else {
uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}`,
});
}
} }
}); });
} }