重回比赛逻辑优化
This commit is contained in:
@@ -57,30 +57,31 @@ onLoad(async (options) => {
|
||||
console.log("----battleInfo", battleInfo);
|
||||
if (battleInfo) {
|
||||
battleId.value = battleInfo.id;
|
||||
start.value = true;
|
||||
startCount.value = true;
|
||||
tips.value = "请连续射出6支箭";
|
||||
players.value = [...battleInfo.blueTeam, ...battleInfo.redTeam];
|
||||
players.value.forEach((p) => {
|
||||
playersScores.value[p.id] = [];
|
||||
});
|
||||
if (battleInfo.startTime <= 0) return;
|
||||
start.value = true;
|
||||
tips.value = "请连续射出6支箭";
|
||||
players.value.forEach((p) => {
|
||||
playersScores.value[p.id] = p.arrows;
|
||||
if (p.id === user.value.id) {
|
||||
scores.value = p.arrows;
|
||||
}
|
||||
});
|
||||
if (battleInfo.startTime > 0) {
|
||||
const remain = Date.now() / 1000 - battleInfo.startTime;
|
||||
if (remain <= 90) {
|
||||
setTimeout(() => {
|
||||
uni.$emit("update-ramain", remain);
|
||||
}, 300);
|
||||
} else if (remain > 90 && remain <= 110) {
|
||||
startCount.value = false;
|
||||
tips.value = "准备下半场";
|
||||
} else if (remain > 110) {
|
||||
setTimeout(() => {
|
||||
uni.$emit("update-ramain", remain - 110);
|
||||
}, 300);
|
||||
}
|
||||
const remain = Date.now() / 1000 - battleInfo.startTime;
|
||||
if (remain <= 90) {
|
||||
setTimeout(() => {
|
||||
uni.$emit("update-ramain", remain);
|
||||
}, 300);
|
||||
} else if (remain > 90 && remain <= 110) {
|
||||
startCount.value = false;
|
||||
tips.value = "准备下半场";
|
||||
} else if (remain > 110) {
|
||||
setTimeout(() => {
|
||||
uni.$emit("update-ramain", remain - 110);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user