细节调整

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

@@ -25,7 +25,10 @@ defineProps({
<view class="players"> <view class="players">
<view> <view>
<view v-for="(result, index) in roundResults" :key="index"> <view v-for="(result, index) in roundResults" :key="index">
<text>Round {{ index + 1 }}</text> <text
>{{ index > 4 ? "决金箭" : "Round" }}
{{ index > 4 ? `R${index - 4}` : index + 1 }}</text
>
<view> <view>
<text>{{ <text>{{
result.blueArrows.length result.blueArrows.length
@@ -40,7 +43,10 @@ defineProps({
</view> </view>
<view> <view>
<view v-for="(result, index) in roundResults" :key="index"> <view v-for="(result, index) in roundResults" :key="index">
<text>Round {{ index + 1 }}</text> <text
>{{ index > 4 ? "决金箭" : "Round" }}
{{ index > 4 ? `R${index - 4}` : index + 1 }}</text
>
<view> <view>
<text>{{ <text>{{
result.redArrows.length result.redArrows.length

View File

@@ -41,7 +41,7 @@ const props = defineProps({
height: 105rpx; height: 105rpx;
padding-top: 10px; padding-top: 10px;
padding-left: 20rpx; padding-left: 20rpx;
top: 25%; top: 0;
left: 15%; left: 15%;
} }
.long { .long {

View File

@@ -239,11 +239,8 @@ onUnmounted(() => {
transform: translateX(10px) translateY(-10px); transform: translateX(10px) translateY(-10px);
} }
.container > view:last-child { .container > view:last-child {
display: flex;
justify-content: center;
align-items: center;
z-index: -1; z-index: -1;
width: clac(100% - 30px); width: calc(100% - 30px);
margin: 0 15px; margin: 0 15px;
text-align: center; text-align: center;
background-color: #ffffff80; background-color: #ffffff80;

View File

@@ -23,6 +23,9 @@ onMounted(() => {
if (props.lvl > user.value.lvl) { if (props.lvl > user.value.lvl) {
updateUser({ ...user.value, lvl: props.lvl }); updateUser({ ...user.value, lvl: props.lvl });
} }
setTimeout(() => {
props.onClose();
}, 1500);
}); });
</script> </script>
@@ -51,7 +54,7 @@ onMounted(() => {
<text>射灵{{ lvl }}</text> <text>射灵{{ lvl }}</text>
<text>!</text> <text>!</text>
</view> </view>
<button @click="onClose" hover-class="none">关闭</button> <!-- <button @click="onClose" hover-class="none">关闭</button> -->
</view> </view>
</template> </template>

View File

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

View File

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

View File

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