添加X环显示,比赛过程完善

This commit is contained in:
kron
2026-02-09 17:27:44 +08:00
parent b355f4e009
commit a3fea0bb1f
18 changed files with 82 additions and 104 deletions

View File

@@ -108,12 +108,27 @@ async function onReceiveMessage(msg) {
recoverData(msg, { arrowOnly: true });
} else if (msg.type === MESSAGETYPESV2.NewRound) {
showRoundTip.value = true;
isFinalShoot.value = msg.current.goldRound;
const latestRound = msg.rounds[currentRound.value - 1];
if (latestRound) {
currentBluePoint.value = latestRound.scores[1].score;
currentRedPoint.value = latestRound.scores[2].score;
if (isFinalShoot.value) {
currentBluePoint.value = msg.teams[1].score;
currentRedPoint.value = msg.teams[2].score;
} else {
currentBluePoint.value = latestRound.scores[1].score;
currentRedPoint.value = latestRound.scores[2].score;
}
}
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
if (msg.status === 4) {
showRoundTip.value = true;
currentBluePoint.value = 0;
currentRedPoint.value = 0;
setTimeout(() => {
uni.navigateBack();
}, 2000);
return;
}
uni.redirectTo({
url: "/pages/battle-result?battleId=" + msg.matchId,
});
@@ -122,12 +137,12 @@ async function onReceiveMessage(msg) {
onLoad(async (options) => {
if (options.battleId) battleId.value = options.battleId;
uni.enableAlertBeforeUnload({
message: "离开比赛可能导致比赛失败,是否继续?",
success: (res) => {
console.log("已启用离开提示");
},
});
// uni.enableAlertBeforeUnload({
// message: "离开比赛可能导致比赛失败,是否继续?",
// success: (res) => {
// console.log("已启用离开提示");
// },
// });
});
onMounted(async () => {
uni.setKeepScreenOn({