Merge branch 'new-race-mode' into test
This commit is contained in:
@@ -19,12 +19,17 @@ const ended = ref(false);
|
|||||||
const halfTime = ref(false);
|
const halfTime = ref(false);
|
||||||
const currentShot = ref(0);
|
const currentShot = ref(0);
|
||||||
const totalShot = ref(0);
|
const totalShot = ref(0);
|
||||||
|
/** 标记组件是否已完成挂载,防止 immediate watcher 在挂载前用旧 store 值触发意外播音 */
|
||||||
|
const isMounted = ref(false);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => tips.value,
|
() => tips.value,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
|
// 挂载完成前不播音(避免 immediate store watcher 用旧值触发多余播报)
|
||||||
|
if (!isMounted.value) return;
|
||||||
|
// 空字符串或含"重回"的 tips 均不播音
|
||||||
|
if (!newVal || newVal.includes("重回")) return;
|
||||||
let key = [];
|
let key = [];
|
||||||
if (newVal.includes("重回")) return;
|
|
||||||
if (currentRoundEnded.value) {
|
if (currentRoundEnded.value) {
|
||||||
// 播放当前轮次语音
|
// 播放当前轮次语音
|
||||||
key.push(`第${["一", "二", "三", "四", "五"][currentRound.value]}轮`);
|
key.push(`第${["一", "二", "三", "四", "五"][currentRound.value]}轮`);
|
||||||
@@ -113,6 +118,7 @@ watch(() => store.game.tips, (newVal) => {
|
|||||||
}, { immediate: true });
|
}, { immediate: true });
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
isMounted.value = true;
|
||||||
uni.$on("update-tips", onUpdateTips);
|
uni.$on("update-tips", onUpdateTips);
|
||||||
uni.$on("socket-inbox", onReceiveMessage);
|
uni.$on("socket-inbox", onReceiveMessage);
|
||||||
uni.$on("play-sound", playSound);
|
uni.$on("play-sound", playSound);
|
||||||
|
|||||||
@@ -98,8 +98,10 @@ onLoad(async (options) => {
|
|||||||
<Container title="好友约战" :showBackToGame="true">
|
<Container title="好友约战" :showBackToGame="true">
|
||||||
<view :style="{ width: '100%', height: '100%' }">
|
<view :style="{ width: '100%', height: '100%' }">
|
||||||
<GuideTwo>
|
<GuideTwo>
|
||||||
<text :style="{color: 'rgba(255,217,71,0.8)'}">约上朋友开几局,欢乐多,不寂寞</text>
|
<view class="guide-tips">
|
||||||
<text>一起练升级更快,早日加入全国排位赛!</text>
|
<text class="guide-tips__main">约上朋友开几局,欢乐多,不寂寞</text>
|
||||||
|
<text class="guide-tips__sub">一起练升级更快,早日加入全国排位赛!</text>
|
||||||
|
</view>
|
||||||
</GuideTwo>
|
</GuideTwo>
|
||||||
<view class="my-data">
|
<view class="my-data">
|
||||||
<view>
|
<view>
|
||||||
@@ -171,6 +173,24 @@ onLoad(async (options) => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.guide-tips {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 112rpx;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.guide-tips__main {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(255, 217, 71, 0.8);
|
||||||
|
}
|
||||||
|
.guide-tips__sub {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.8);
|
||||||
|
margin-top: 6rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.founded-room {
|
.founded-room {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -132,8 +132,18 @@ const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => {
|
|||||||
// ShootProgress2(v-if="start")尚未挂载,update-remain 事件会被丢弃。
|
// ShootProgress2(v-if="start")尚未挂载,update-remain 事件会被丢弃。
|
||||||
// 同时 HeaderProgress 对含"重回"的 tips 拦截音频,倒计时无法依赖
|
// 同时 HeaderProgress 对含"重回"的 tips 拦截音频,倒计时无法依赖
|
||||||
// onAudioEnded 驱动,需在 nextTick 后直接启动。
|
// onAudioEnded 驱动,需在 nextTick 后直接启动。
|
||||||
|
|
||||||
|
// playerId=0 表示后端处于过渡状态(上一位射手已完成、下一位尚未分配)
|
||||||
|
// 此时 startTime/targetTeam 均不可靠,停止进度条并等待 WS ToSomeoneShoot 驱动
|
||||||
|
if (!battleInfo.current.playerId) {
|
||||||
|
nextTick(() => {
|
||||||
|
uni.$emit("update-tips", nextTips);
|
||||||
|
uni.$emit("update-remain", {stop: true});
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const elapsed = (Date.now() - battleInfo.current.startTime) / 1000;
|
const elapsed = (Date.now() - battleInfo.current.startTime) / 1000;
|
||||||
console.log(`当前轮已进行${elapsed}秒`);
|
|
||||||
if (elapsed > 0 && elapsed < shootTimeTotal.value) {
|
if (elapsed > 0 && elapsed < shootTimeTotal.value) {
|
||||||
updateRemainSecond.value = shootTimeTotal.value - elapsed - 0.2;
|
updateRemainSecond.value = shootTimeTotal.value - elapsed - 0.2;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user