细节完善

This commit is contained in:
kron
2025-07-16 17:55:11 +08:00
parent 5770fb2ce2
commit 0adc1fa73a
4 changed files with 16 additions and 12 deletions

View File

@@ -17,7 +17,7 @@ const props = defineProps({
},
total: {
type: Number,
default: 90,
default: 120,
},
seq: {
type: Number,
@@ -25,7 +25,7 @@ const props = defineProps({
},
currentRound: {
type: Number,
default: 90,
default: 0,
},
battleId: {
type: String,
@@ -45,6 +45,7 @@ const currentSound = ref("");
const currentRound = ref(props.currentRound);
const currentRoundEnded = ref(!props.battleId);
const ended = ref(false);
const halfTime = ref(false);
watch(
() => props.tips,
@@ -133,7 +134,7 @@ async function onReceiveMessage(messages = []) {
(!props.battleId && msg.constructor === MESSAGETYPES.ShootSyncMeArrowID)
) {
if (props.melee && msg.userId !== user.value.id) return;
if (msg.target) {
if (!halfTime.value && msg.target) {
currentSound.value = msg.target.ring
? `${msg.target.ring}`
: "未上靶";
@@ -142,10 +143,12 @@ async function onReceiveMessage(messages = []) {
} else if (msg.constructor === MESSAGETYPES.AllReady) {
audioManager.play("比赛开始");
} else if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
halfTime.value = false;
audioManager.play("比赛开始");
} else if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
currentRoundEnded.value = true;
} else if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
halfTime.value = true;
audioManager.play("中场休息");
} else if (msg.constructor === MESSAGETYPES.MatchOver) {
audioManager.play("比赛结束");

View File

@@ -138,6 +138,9 @@ onLoad(async (options) => {
players.value = [...battleInfo.blueTeam, ...battleInfo.redTeam];
players.value.forEach((p) => {
playersScores.value[p.id] = p.arrows;
if (p.id === user.value.id) {
scores.value = p.arrows;
}
});
if (battleInfo.startTime) {
const remain = Date.now() / 1000 - battleInfo.startTime;
@@ -330,8 +333,8 @@ async function onReceiveMessage(messages = []) {
seq.value += 1;
timerSeq.value = 0;
tips.value = "请连续射出6支箭";
scores.value = [];
total.value = 90;
halfTimeTip.value = false;
}
if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
if (battleType.value === 1) {

View File

@@ -222,12 +222,7 @@ const onClose = () => {
<view style="height: 570px" v-if="step === 1">
<Swiper :onChange="onSwiperIndexChange" :data="guideImages" />
</view>
<ShootProgress
v-if="step === 4"
tips="请开始连续射箭"
:total="100"
:start="start"
/>
<ShootProgress v-if="step === 4" tips="请开始连续射箭" :start="start" />
<TestDistance v-if="step === 2" :guide="false" />
<view
class="user-row"

View File

@@ -64,6 +64,9 @@ onLoad(async (options) => {
players.value = [...battleInfo.blueTeam, ...battleInfo.redTeam];
players.value.forEach((p) => {
playersScores.value[p.id] = p.arrows;
if (p.id === user.value.id) {
scores.value = p.arrows;
}
});
if (battleInfo.startTime) {
const remain = Date.now() / 1000 - battleInfo.startTime;
@@ -72,7 +75,6 @@ onLoad(async (options) => {
uni.$emit("update-ramain", remain);
}, 300);
} else if (remain > 90 && remain <= 110) {
halfTimeTip.value = true;
startCount.value = false;
tips.value = "准备下半场";
} else if (remain > 110) {
@@ -123,6 +125,7 @@ async function onReceiveMessage(messages = []) {
players.value.forEach((p) => {
playersScores.value[p.id] = [];
});
uni.$hideHint();
};
}
if (msg.id !== battleId.value) return;
@@ -132,7 +135,7 @@ async function onReceiveMessage(messages = []) {
seq.value += 1;
timerSeq.value = 0;
tips.value = "请连续射出6支箭";
scores.value = [];
halfTimeTip.value = false;
}
if (msg.constructor === MESSAGETYPES.ShootResult) {
if (msg.userId === user.value.id) {