细节调整

This commit is contained in:
kron
2025-07-23 16:01:16 +08:00
parent cfb1b8cd7f
commit 46ec2ade9a
7 changed files with 75 additions and 47 deletions

View File

@@ -107,15 +107,21 @@ function recoverData(battleInfo) {
totalRounds.value = battleInfo.maxRound;
roundResults.value = battleInfo.roundResults;
battleInfo.roundResults.forEach((round) => {
if (round.blueTotal && round.redTotal) {
if (round.blueTotal === round.redTotal) {
bluePoints.value += 1;
redPoints.value += 1;
} else if (round.blueTotal > round.redTotal) {
bluePoints.value += 2;
} else {
redPoints.value += 2;
}
const blueTotal = round.blueArrows.reduce(
(last, next) => last + next.ring,
0
);
const redTotal = round.redArrows.reduce(
(last, next) => last + next.ring,
0
);
if (blueTotal === redTotal) {
bluePoints.value += 1;
redPoints.value += 1;
} else if (blueTotal > redTotal) {
bluePoints.value += 2;
} else {
redPoints.value += 2;
}
});
setTimeout(() => {
@@ -428,7 +434,6 @@ async function onReceiveMessage(messages = []) {
currentRedPoint.value = result.redScore;
bluePoints.value += result.blueScore;
redPoints.value += result.redScore;
// roundResults.value = result.roundResults;
currentRound.value = result.currentRound + 1;
uni.$emit("update-ramain", 0);
if (result.currentRound < 5) {
@@ -464,15 +469,19 @@ async function onReceiveMessage(messages = []) {
uni.setStorageSync("last-battle", msg.endStatus);
if (msg.endStatus.noSaved) {
uni.showToast({
title: "游戏结束",
title: "本场比赛无人射箭,已取消",
icon: "none",
});
uni.navigateBack();
setTimeout(() => {
uni.navigateBack();
}, 1500);
} else {
isEnded.value = true;
uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}`,
});
setTimeout(() => {
uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}`,
});
}, 1500);
}
}
if (msg.constructor === MESSAGETYPES.BackToGame) {
@@ -636,8 +645,8 @@ onHide(() => {
<BowTarget
:mode="battleType === 1 ? 'team' : 'solo'"
:power="start ? power : 0"
:currentRound="currentRound"
:totalRound="totalRounds"
:currentRound="scores.length"
:totalRound="battleType === 1 ? 3 : totalRounds"
:scores="scores"
:blueScores="blueScores"
:stop="!startCount"

View File

@@ -165,15 +165,19 @@ async function onReceiveMessage(messages = []) {
uni.setStorageSync("last-battle", msg.endStatus);
if (msg.endStatus.noSaved) {
uni.showToast({
title: "游戏结束",
title: "本场比赛无人射箭,已取消",
icon: "none",
});
uni.navigateBack();
setTimeout(() => {
uni.navigateBack();
}, 1500);
} else {
isEnded.value = true;
uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}`,
});
setTimeout(() => {
uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}`,
});
}, 1500);
}
}
if (msg.constructor === MESSAGETYPES.BackToGame) {

View File

@@ -66,15 +66,21 @@ function recoverData(battleInfo) {
totalRounds.value = battleInfo.maxRound;
roundResults.value = battleInfo.roundResults;
battleInfo.roundResults.forEach((round) => {
if (round.blueTotal && round.redTotal) {
if (round.blueTotal === round.redTotal) {
bluePoints.value += 1;
redPoints.value += 1;
} else if (round.blueTotal > round.redTotal) {
bluePoints.value += 2;
} else {
redPoints.value += 2;
}
const blueTotal = round.blueArrows.reduce(
(last, next) => last + next.ring,
0
);
const redTotal = round.redArrows.reduce(
(last, next) => last + next.ring,
0
);
if (blueTotal === redTotal) {
bluePoints.value += 1;
redPoints.value += 1;
} else if (blueTotal > redTotal) {
bluePoints.value += 2;
} else {
redPoints.value += 2;
}
});
setTimeout(() => {
@@ -217,7 +223,6 @@ async function onReceiveMessage(messages = []) {
currentRedPoint.value = result.redScore;
bluePoints.value += result.blueScore;
redPoints.value += result.redScore;
// roundResults.value = result.roundResults;
currentRound.value = result.currentRound + 1;
if (result.currentRound < 5) {
roundResults.value.push({
@@ -238,15 +243,19 @@ async function onReceiveMessage(messages = []) {
uni.setStorageSync("last-battle", msg.endStatus);
if (msg.endStatus.noSaved) {
uni.showToast({
title: "游戏结束",
title: "本场比赛无人射箭,已取消",
icon: "none",
});
uni.navigateBack();
setTimeout(() => {
uni.navigateBack();
}, 1500);
} else {
isEnded.value = true;
uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}`,
});
setTimeout(() => {
uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}`,
});
}, 1500);
}
}
if (msg.constructor === MESSAGETYPES.BackToGame) {
@@ -331,8 +340,8 @@ onHide(() => {
v-if="start"
mode="team"
:power="start ? power : 0"
:currentRound="currentRound"
:totalRound="totalRounds"
:currentRound="scores.length"
:totalRound="3"
:scores="scores"
:blueScores="blueScores"
/>