BUG修复

This commit is contained in:
kron
2025-08-18 16:09:11 +08:00
parent b31689b19f
commit 1ce2ea9eb7
13 changed files with 302 additions and 166 deletions

View File

@@ -19,6 +19,10 @@ defineProps({
type: Number,
default: 0,
},
goldenRound: {
type: Number,
default: 0,
},
});
</script>
@@ -43,7 +47,21 @@ defineProps({
<view class="players">
<view>
<view v-for="(result, index) in roundResults" :key="index">
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
<block
v-if="goldenRound > 0 && index >= roundResults.length - goldenRound"
>
<image
:src="
RoundImages[
`gold${index + 1 - (roundResults.length - goldenRound)}`
]
"
mode="widthFix"
/>
</block>
<block v-else>
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
</block>
<view>
<text>{{
result.blueArrows.length
@@ -70,7 +88,21 @@ defineProps({
</view>
<view>
<view v-for="(result, index) in roundResults" :key="index">
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
<block
v-if="goldenRound > 0 && index >= roundResults.length - goldenRound"
>
<image
:src="
RoundImages[
`gold${index + 1 - (roundResults.length - goldenRound)}`
]
"
mode="widthFix"
/>
</block>
<block v-else>
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
</block>
<view>
<text>{{
result.redArrows.length

View File

@@ -137,9 +137,10 @@ defineProps({
}
.players > view > image:last-child {
position: absolute;
width: 40px;
top: 0;
left: 0;
width: 50px;
top: -10%;
left: -5%;
transform: rotate(-12deg);
}
.players > view > view {
display: flex;

View File

@@ -9,7 +9,6 @@ const { user } = storeToRefs(store);
const tips = ref("");
const melee = ref(false);
const battleId = ref("");
const timer = ref(null);
const sound = ref(true);
const currentSound = ref("");
@@ -51,16 +50,15 @@ const updateSound = () => {
async function onReceiveMessage(messages = []) {
if (!sound.value || ended.value) return;
messages.forEach((msg) => {
if (battleId.value && msg.constructor === MESSAGETYPES.ShootResult) {
if (msg.constructor === MESSAGETYPES.ShootResult) {
if (melee.value && msg.userId !== user.value.id) return;
if (!halfTime.value && msg.target) {
currentSound.value = msg.target.ring
? `${msg.target.ring}`
: "未上靶";
console.log(currentSound.value);
audioManager.play(currentSound.value);
}
} else if (msg.constructor === MESSAGETYPES.WaitForAllReady) {
battleId.value = msg.id;
} else if (msg.constructor === MESSAGETYPES.AllReady) {
currentRoundEnded.value = true;
audioManager.play("比赛开始");
@@ -84,6 +82,10 @@ async function onReceiveMessage(messages = []) {
ended.value = true;
} else if (msg.constructor === MESSAGETYPES.MatchOver) {
ended.value = true;
} else if (msg.constructor === MESSAGETYPES.BackToGame) {
if (msg.battleInfo) {
melee.value = msg.battleInfo.config.battleMode === 2;
}
}
});
}

View File

@@ -101,9 +101,9 @@ onUnmounted(() => {
<block v-if="isFinal">
<view class="point-view2">
<text>蓝队</text>
<text>5</text>
<text>{{ bluePoint }}</text>
<text>红队</text>
<text>5</text>
<text>{{ redPoint }}</text>
<text></text>
</view>
<text>同分僵局最后一箭定江山</text>