BUG修复
This commit is contained in:
@@ -106,7 +106,7 @@ onUnmounted(() => {
|
|||||||
<view class="container">
|
<view class="container">
|
||||||
<view>
|
<view>
|
||||||
<image src="../static/shooter.png" mode="widthFix" />
|
<image src="../static/shooter.png" mode="widthFix" />
|
||||||
<text>{{ start && remain === 0 ? "射箭时间到!" : tips }}</text>
|
<text>{{ start && remain === 0 ? "时间到!" : tips }}</text>
|
||||||
<button hover-class="none" @click="() => (sound = !sound)">
|
<button hover-class="none" @click="() => (sound = !sound)">
|
||||||
<image
|
<image
|
||||||
:src="`../static/sound${sound ? '' : '-off'}-yellow.png`"
|
:src="`../static/sound${sound ? '' : '-off'}-yellow.png`"
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ onLoad(async (options) => {
|
|||||||
if (battleInfo) {
|
if (battleInfo) {
|
||||||
battleId.value = battleInfo.id;
|
battleId.value = battleInfo.id;
|
||||||
start.value = true;
|
start.value = true;
|
||||||
|
if (battleInfo.config.mode === 1) {
|
||||||
redTeam.value = battleInfo.redTeam;
|
redTeam.value = battleInfo.redTeam;
|
||||||
blueTeam.value = battleInfo.blueTeam;
|
blueTeam.value = battleInfo.blueTeam;
|
||||||
currentRound.value = battleInfo.currentRound;
|
currentRound.value = battleInfo.currentRound;
|
||||||
@@ -85,6 +86,30 @@ onLoad(async (options) => {
|
|||||||
totalRounds.value = battleInfo.maxRound;
|
totalRounds.value = battleInfo.maxRound;
|
||||||
roundResults.value = battleInfo.roundResults;
|
roundResults.value = battleInfo.roundResults;
|
||||||
currentShooterId.value = battleInfo.firePlayerIndex;
|
currentShooterId.value = battleInfo.firePlayerIndex;
|
||||||
|
if (
|
||||||
|
battleInfo.redTeam[0].shotHistory[battleInfo.currentRound] ||
|
||||||
|
battleInfo.blueTeam[0].shotHistory[battleInfo.currentRound]
|
||||||
|
) {
|
||||||
|
roundResults.value.push({
|
||||||
|
redArrows:
|
||||||
|
battleInfo.redTeam[0].shotHistory[battleInfo.currentRound],
|
||||||
|
blueArrows:
|
||||||
|
battleInfo.blueTeam[0].shotHistory[battleInfo.currentRound],
|
||||||
|
});
|
||||||
|
} else if (battleInfo.currentRound < 5) {
|
||||||
|
roundResults.value.push({
|
||||||
|
redArrows: [],
|
||||||
|
blueArrows: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (battleInfo.firePlayerIndex) {
|
||||||
|
currentShooterId.value = battleInfo.firePlayerIndex;
|
||||||
|
if (redTeam.value[0].id === currentShooterId.value) {
|
||||||
|
tips.value = `请红队射箭-第${roundsName[currentRound.value]}轮`;
|
||||||
|
} else {
|
||||||
|
tips.value = `请蓝队射箭-第${roundsName[currentRound.value]}轮`;
|
||||||
|
}
|
||||||
|
}
|
||||||
const remain = Date.now() / 1000 - battleInfo.fireTime;
|
const remain = Date.now() / 1000 - battleInfo.fireTime;
|
||||||
if (remain > 0 && remain < 15) {
|
if (remain > 0 && remain < 15) {
|
||||||
// 等渲染好再通知
|
// 等渲染好再通知
|
||||||
@@ -92,6 +117,32 @@ onLoad(async (options) => {
|
|||||||
uni.$emit("update-ramain", remain);
|
uni.$emit("update-ramain", remain);
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
|
} else if (battleInfo.config.mode === 2) {
|
||||||
|
tips.value = "请连续射出6支箭";
|
||||||
|
players.value = [...battleInfo.blueTeam, ...battleInfo.redTeam];
|
||||||
|
players.value.forEach((p) => {
|
||||||
|
playersScores.value[p.id] = p.arrows;
|
||||||
|
});
|
||||||
|
if (battleInfo.startTime) {
|
||||||
|
const remain = Date.now() / 1000 - battleInfo.startTime;
|
||||||
|
if (remain <= 90) {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.$emit("update-ramain", remain);
|
||||||
|
}, 300);
|
||||||
|
} else if (remain > 90 && remain <= 110) {
|
||||||
|
halfTimeTip.value = true;
|
||||||
|
countDown.value = 20;
|
||||||
|
tips.value = "准备下半场";
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.$emit("update-ramain", 110 - remain);
|
||||||
|
}, 300);
|
||||||
|
} else if (remain > 110) {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.$emit("update-ramain", remain - 110);
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (options.roomNumber) {
|
if (options.roomNumber) {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ watch(
|
|||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
if (options.battleId) {
|
if (options.battleId) {
|
||||||
const battleInfo = uni.getStorageSync(`battle-${options.battleId}`);
|
const battleInfo = uni.getStorageSync(`battle-${options.battleId}`);
|
||||||
// console.log("----battleInfo", battleInfo);
|
console.log("----battleInfo", battleInfo);
|
||||||
if (battleInfo) {
|
if (battleInfo) {
|
||||||
battleId.value = battleInfo.id;
|
battleId.value = battleInfo.id;
|
||||||
start.value = true;
|
start.value = true;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const isFinalShoot = ref(false);
|
|||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
if (options.battleId) {
|
if (options.battleId) {
|
||||||
const battleInfo = uni.getStorageSync(`battle-${options.battleId}`);
|
const battleInfo = uni.getStorageSync(`battle-${options.battleId}`);
|
||||||
console.log("----battleInfo", battleInfo);
|
// console.log("----battleInfo", battleInfo);
|
||||||
if (battleInfo) {
|
if (battleInfo) {
|
||||||
battleId.value = battleInfo.id;
|
battleId.value = battleInfo.id;
|
||||||
start.value = true;
|
start.value = true;
|
||||||
@@ -58,6 +58,21 @@ onLoad(async (options) => {
|
|||||||
redPoints.value = battleInfo.redScore;
|
redPoints.value = battleInfo.redScore;
|
||||||
totalRounds.value = battleInfo.maxRound;
|
totalRounds.value = battleInfo.maxRound;
|
||||||
roundResults.value = battleInfo.roundResults;
|
roundResults.value = battleInfo.roundResults;
|
||||||
|
if (
|
||||||
|
battleInfo.redTeam[0].shotHistory[battleInfo.currentRound] ||
|
||||||
|
battleInfo.blueTeam[0].shotHistory[battleInfo.currentRound]
|
||||||
|
) {
|
||||||
|
roundResults.value.push({
|
||||||
|
redArrows: battleInfo.redTeam[0].shotHistory[battleInfo.currentRound],
|
||||||
|
blueArrows:
|
||||||
|
battleInfo.blueTeam[0].shotHistory[battleInfo.currentRound],
|
||||||
|
});
|
||||||
|
} else if (battleInfo.currentRound < 5) {
|
||||||
|
roundResults.value.push({
|
||||||
|
redArrows: [],
|
||||||
|
blueArrows: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
if (battleInfo.firePlayerIndex) {
|
if (battleInfo.firePlayerIndex) {
|
||||||
currentShooterId.value = battleInfo.firePlayerIndex;
|
currentShooterId.value = battleInfo.firePlayerIndex;
|
||||||
if (redTeam.value[0].id === currentShooterId.value) {
|
if (redTeam.value[0].id === currentShooterId.value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user