优化轮到你了声音播放
This commit is contained in:
@@ -18,7 +18,6 @@ const ended = ref(false);
|
||||
const halfTime = ref(false);
|
||||
const currentShot = ref(0);
|
||||
const totalShot = ref(0);
|
||||
const yourTurn = ref(false);
|
||||
|
||||
watch(
|
||||
() => tips.value,
|
||||
@@ -37,9 +36,8 @@ watch(
|
||||
// 延迟播放队伍提示音
|
||||
setTimeout(
|
||||
() => {
|
||||
if (key && !yourTurn.value) audioManager.play(key);
|
||||
if (key) audioManager.play(newVal.includes("你") ? "轮到你了" : key);
|
||||
currentRoundEnded.value = false;
|
||||
yourTurn.value = false;
|
||||
},
|
||||
currentRoundEnded.value ? 1000 : 0
|
||||
);
|
||||
@@ -81,8 +79,6 @@ async function onReceiveMessage(messages = []) {
|
||||
: "未上靶";
|
||||
audioManager.play(currentSound.value);
|
||||
}
|
||||
} else if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
|
||||
yourTurn.value = user.value.id === msg.userId;
|
||||
} else if (msg.constructor === MESSAGETYPES.InvalidShot) {
|
||||
if (msg.userId === user.value.id) {
|
||||
uni.showToast({
|
||||
@@ -159,7 +155,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<text>{{ tips }}</text>
|
||||
<text>{{ (tips || "").replace(/你/g, "") }}</text>
|
||||
<text v-if="totalShot > 0"> ({{ currentShot }}/{{ totalShot }}) </text>
|
||||
<button v-if="!!tips" hover-class="none" @click="updateSound">
|
||||
<image
|
||||
|
||||
@@ -61,7 +61,11 @@ onBeforeUnmount(() => {
|
||||
<template>
|
||||
<view class="container">
|
||||
<image :src="RoundGoldImages[props.currentRound]" mode="widthFix" />
|
||||
<view>
|
||||
<view
|
||||
:style="{
|
||||
justifyContent: tips.includes('红队') ? 'flex-end' : 'flex-start',
|
||||
}"
|
||||
>
|
||||
<view
|
||||
:style="{
|
||||
width: `${(remain / total) * 100}%`,
|
||||
@@ -85,7 +89,7 @@ onBeforeUnmount(() => {
|
||||
.container > image {
|
||||
width: 360rpx;
|
||||
height: 80rpx;
|
||||
transform: translateY(24rpx);
|
||||
transform: translateY(20rpx);
|
||||
}
|
||||
.container > view:last-child {
|
||||
width: 100%;
|
||||
@@ -95,6 +99,8 @@ onBeforeUnmount(() => {
|
||||
height: 24rpx;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.container > view:last-child > view {
|
||||
height: 24rpx;
|
||||
|
||||
Reference in New Issue
Block a user