完成决金箭调试
This commit is contained in:
@@ -23,7 +23,7 @@ const bubbleTypes = [
|
||||
<image
|
||||
v-if="!noBg"
|
||||
:src="bubbleTypes[type]"
|
||||
:style="{ top: type === 2 ? '-5%' : '-12%' }"
|
||||
:style="{ top: type === 2 ? '-6%' : '-12%' }"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<slot />
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from "vue";
|
||||
import { ref, watch, onMounted, onUnmounted } from "vue";
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
isFinal: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
round: {
|
||||
type: Number,
|
||||
@@ -21,15 +21,31 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
onAutoClose: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
const count = ref(10);
|
||||
const count = ref(3);
|
||||
const tiemr = ref(null);
|
||||
onMounted(() => {
|
||||
function startCount() {
|
||||
if (tiemr.value) clearInterval(tiemr.value);
|
||||
tiemr.value = setInterval(() => {
|
||||
if (count.value === 0) clearInterval(tiemr.value);
|
||||
else count.value -= 1;
|
||||
if (count.value === 0) {
|
||||
clearInterval(tiemr.value);
|
||||
props.onAutoClose();
|
||||
} else count.value -= 1;
|
||||
}, 1000);
|
||||
}
|
||||
watch(
|
||||
() => [props.isFinal, props.roundData],
|
||||
([n_isFinal, n_roundData]) => {
|
||||
count.value = n_isFinal ? 10 : 3;
|
||||
startCount();
|
||||
}
|
||||
);
|
||||
onMounted(() => {
|
||||
startCount();
|
||||
});
|
||||
onUnmounted(() => {
|
||||
if (tiemr.value) clearInterval(tiemr.value);
|
||||
@@ -39,7 +55,7 @@ onUnmounted(() => {
|
||||
<template>
|
||||
<view class="round-end-tip">
|
||||
<text>第{{ round }}轮射击结束</text>
|
||||
<block v-if="type === 0">
|
||||
<block v-if="!isFinal">
|
||||
<view class="point-view1">
|
||||
<text>本轮红队</text>
|
||||
<text>{{
|
||||
@@ -76,7 +92,7 @@ onUnmounted(() => {
|
||||
>分
|
||||
</text>
|
||||
</block>
|
||||
<block v-if="type === 1">
|
||||
<block v-if="isFinal">
|
||||
<view class="point-view2">
|
||||
<text>蓝队</text>
|
||||
<text>{{ bluePoint }}</text>
|
||||
|
||||
@@ -16,7 +16,7 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
const getContentHeight = () => {
|
||||
if (props.mode === "tall") return "47vw";
|
||||
if (props.mode === "tall") return "50vw";
|
||||
if (props.mode === "square") return "74vw";
|
||||
return "36vw";
|
||||
};
|
||||
|
||||
@@ -18,6 +18,7 @@ export const MESSAGETYPES = {
|
||||
SomeoneComplete: 2921416944,
|
||||
HalfTimeOver: 388606440,
|
||||
BackToGame: 1899960424,
|
||||
FinalShootResult: 3813452544,
|
||||
};
|
||||
|
||||
export const topThreeColors = ["#FFD947", "#D2D2D2", "#FFA515"];
|
||||
|
||||
@@ -51,6 +51,7 @@ const showRoundTip = ref(false);
|
||||
const playersScores = ref({});
|
||||
const showModal = ref(false);
|
||||
const halfTimeTip = ref(false);
|
||||
const isFinalShoot = ref(false);
|
||||
const total = ref(90);
|
||||
|
||||
onLoad(async (options) => {
|
||||
@@ -225,9 +226,14 @@ async function onReceiveMessage(messages = []) {
|
||||
seq.value += 1;
|
||||
currentShooterId.value = msg.userId;
|
||||
if (redTeam.value[0].id === currentShooterId.value) {
|
||||
tips.value = `请红队射箭-第${roundsName[currentRound.value]}轮`;
|
||||
tips.value = "请红队射箭-";
|
||||
} else {
|
||||
tips.value = `请蓝队射箭-第${roundsName[currentRound.value]}轮`;
|
||||
tips.value = "请蓝队射箭-";
|
||||
}
|
||||
if (isFinalShoot.value) {
|
||||
tips.value += "决金箭";
|
||||
} else {
|
||||
tips.value += `第${roundsName[currentRound.value]}轮`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,17 +264,15 @@ async function onReceiveMessage(messages = []) {
|
||||
currentRedPoint.value = result.redScore;
|
||||
bluePoints.value += result.blueScore;
|
||||
redPoints.value += result.redScore;
|
||||
showRoundTip.value = true;
|
||||
if (
|
||||
result.currentRound > 0 &&
|
||||
result.currentRound < totalRounds.value
|
||||
) {
|
||||
// 开始下一轮;
|
||||
roundResults.value = result.roundResults;
|
||||
currentRound.value = result.currentRound + 1;
|
||||
}
|
||||
roundResults.value = result.roundResults;
|
||||
currentRound.value = result.currentRound + 1;
|
||||
if (result.currentRound < 5) showRoundTip.value = true;
|
||||
}
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.FinalShoot) {
|
||||
isFinalShoot.value = true;
|
||||
showRoundTip.value = true;
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||
startCount.value = false;
|
||||
halfTimeTip.value = true;
|
||||
@@ -304,7 +308,11 @@ onUnmounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Container title="对战" :onBack="() => (showModal = true)">
|
||||
<Container
|
||||
title="对战"
|
||||
:onBack="() => (showModal = true)"
|
||||
:bgType="battleId ? 1 : 0"
|
||||
>
|
||||
<view class="standby-phase" v-if="step === 1">
|
||||
<Guide>
|
||||
<view :style="{ display: 'flex', flexDirection: 'column' }">
|
||||
@@ -406,10 +414,12 @@ onUnmounted(() => {
|
||||
<Timer :seq="timerSeq" />
|
||||
<ScreenHint :show="showRoundTip" :onClose="() => (showRoundTip = false)">
|
||||
<RoundEndTip
|
||||
:isFinal="isFinalShoot"
|
||||
:round="currentRound - 1"
|
||||
:bluePoint="currentBluePoint"
|
||||
:redPoint="currentRedPoint"
|
||||
:roundData="roundResults[roundResults.length - 1]"
|
||||
:onAutoClose="() => (showRoundTip = false)"
|
||||
/>
|
||||
</ScreenHint>
|
||||
<ScreenHint
|
||||
|
||||
@@ -56,7 +56,6 @@ onMounted(async () => {
|
||||
updateConfig(config);
|
||||
console.log("全局配置:", config);
|
||||
const rankList = await getRankListAPI();
|
||||
console.log("排位赛数据:", rankList);
|
||||
updateRank(rankList);
|
||||
const token = uni.getStorageSync("token");
|
||||
if (token) {
|
||||
|
||||
@@ -44,6 +44,7 @@ const bluePoints = ref(0);
|
||||
const showRoundTip = ref(false);
|
||||
const onComplete = ref(null);
|
||||
const showModal = ref(false);
|
||||
const isFinalShoot = ref(false);
|
||||
|
||||
onLoad(async (options) => {
|
||||
if (options.battleId) {
|
||||
@@ -126,9 +127,14 @@ async function onReceiveMessage(messages = []) {
|
||||
seq.value += 1;
|
||||
currentShooterId.value = msg.userId;
|
||||
if (redTeam.value[0].id === currentShooterId.value) {
|
||||
tips.value = `请红队射箭-第${roundsName[currentRound.value]}轮`;
|
||||
tips.value = "请红队射箭-";
|
||||
} else {
|
||||
tips.value = `请蓝队射箭-第${roundsName[currentRound.value]}轮`;
|
||||
tips.value = "请蓝队射箭-";
|
||||
}
|
||||
if (isFinalShoot.value) {
|
||||
tips.value += "决金箭";
|
||||
} else {
|
||||
tips.value += `第${roundsName[currentRound.value]}轮`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,10 +155,13 @@ async function onReceiveMessage(messages = []) {
|
||||
currentRedPoint.value = result.redScore;
|
||||
bluePoints.value += result.blueScore;
|
||||
redPoints.value += result.redScore;
|
||||
showRoundTip.value = true;
|
||||
// 开始下一轮;
|
||||
roundResults.value = result.roundResults;
|
||||
currentRound.value = result.currentRound + 1;
|
||||
if (result.currentRound < 5) showRoundTip.value = true;
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.FinalShoot) {
|
||||
isFinalShoot.value = true;
|
||||
showRoundTip.value = true;
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||
uni.redirectTo({
|
||||
@@ -223,12 +232,15 @@ onUnmounted(() => {
|
||||
<ScreenHint
|
||||
:show="showRoundTip"
|
||||
:onClose="() => (showRoundTip = false)"
|
||||
:mode="isFinalShoot ? 'tall' : 'normal'"
|
||||
>
|
||||
<RoundEndTip
|
||||
:isFinal="isFinalShoot"
|
||||
:round="currentRound - 1"
|
||||
:bluePoint="currentBluePoint"
|
||||
:redPoint="currentRedPoint"
|
||||
:roundData="roundResults[roundResults.length - 1]"
|
||||
:onAutoClose="() => (showRoundTip = false)"
|
||||
/>
|
||||
</ScreenHint>
|
||||
</block>
|
||||
|
||||
Reference in New Issue
Block a user