bug修复
This commit is contained in:
@@ -168,9 +168,7 @@ function recoverData(battleInfo) {
|
|||||||
players.value = [...battleInfo.blueTeam, ...battleInfo.redTeam];
|
players.value = [...battleInfo.blueTeam, ...battleInfo.redTeam];
|
||||||
players.value.forEach((p) => {
|
players.value.forEach((p) => {
|
||||||
playersScores.value[p.id] = [...p.arrows];
|
playersScores.value[p.id] = [...p.arrows];
|
||||||
if (p.id === user.value.id) {
|
if (p.id === user.value.id) scores.value = [...p.arrows];
|
||||||
scores.value = [...p.arrows];
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (battleInfo.status === 2) {
|
if (battleInfo.status === 2) {
|
||||||
startCount.value = true;
|
startCount.value = true;
|
||||||
@@ -451,8 +449,8 @@ async function onReceiveMessage(messages = []) {
|
|||||||
...msg.groupUserStatus.redTeam,
|
...msg.groupUserStatus.redTeam,
|
||||||
...msg.groupUserStatus.blueTeam,
|
...msg.groupUserStatus.blueTeam,
|
||||||
].forEach((player) => {
|
].forEach((player) => {
|
||||||
playersScores.value[player.id] = player.arrows;
|
playersScores.value[player.id] = [...player.arrows];
|
||||||
if (p.id === user.value.id) scores.value = [...p.arrows];
|
if (player.id === user.value.id) scores.value = [...player.arrows];
|
||||||
});
|
});
|
||||||
startCount.value = false;
|
startCount.value = false;
|
||||||
halfTimeTip.value = true;
|
halfTimeTip.value = true;
|
||||||
|
|||||||
@@ -57,9 +57,7 @@ function recoverData(battleInfo) {
|
|||||||
players.value = [...battleInfo.blueTeam, ...battleInfo.redTeam];
|
players.value = [...battleInfo.blueTeam, ...battleInfo.redTeam];
|
||||||
players.value.forEach((p) => {
|
players.value.forEach((p) => {
|
||||||
playersScores.value[p.id] = [...p.arrows];
|
playersScores.value[p.id] = [...p.arrows];
|
||||||
if (p.id === user.value.id) {
|
if (p.id === user.value.id) scores.value = [...p.arrows];
|
||||||
scores.value = [...p.arrows];
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
const remain = Date.now() / 1000 - battleInfo.startTime;
|
const remain = Date.now() / 1000 - battleInfo.startTime;
|
||||||
console.log(`当前局已进行${remain}秒`);
|
console.log(`当前局已进行${remain}秒`);
|
||||||
@@ -95,7 +93,6 @@ onLoad(async (options) => {
|
|||||||
const battleInfo = uni.getStorageSync("current-battle");
|
const battleInfo = uni.getStorageSync("current-battle");
|
||||||
if (battleInfo) {
|
if (battleInfo) {
|
||||||
recoverData(battleInfo);
|
recoverData(battleInfo);
|
||||||
console.log("remove last time");
|
|
||||||
uni.removeStorageSync("last-awake-time");
|
uni.removeStorageSync("last-awake-time");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -145,6 +142,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
halfTimeTip.value = false;
|
halfTimeTip.value = false;
|
||||||
}
|
}
|
||||||
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
||||||
|
if (!start.value) getCurrentGameAPI();
|
||||||
if (msg.userId === user.value.id) {
|
if (msg.userId === user.value.id) {
|
||||||
scores.value.push({ ...msg.target });
|
scores.value.push({ ...msg.target });
|
||||||
power.value = msg.target.battery;
|
power.value = msg.target.battery;
|
||||||
@@ -155,8 +153,8 @@ async function onReceiveMessage(messages = []) {
|
|||||||
uni.$emit("update-ramain", 0);
|
uni.$emit("update-ramain", 0);
|
||||||
[...msg.groupUserStatus.redTeam, ...msg.groupUserStatus.blueTeam].forEach(
|
[...msg.groupUserStatus.redTeam, ...msg.groupUserStatus.blueTeam].forEach(
|
||||||
(player) => {
|
(player) => {
|
||||||
playersScores.value[player.id] = player.arrows;
|
playersScores.value[player.id] = [...player.arrows];
|
||||||
if (p.id === user.value.id) scores.value = [...p.arrows];
|
if (player.id === user.value.id) scores.value = [...player.arrows];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
startCount.value = false;
|
startCount.value = false;
|
||||||
@@ -211,7 +209,7 @@ onShow(async () => {
|
|||||||
if (battleId.value) {
|
if (battleId.value) {
|
||||||
if (!isEnded.value && (await isGameEnded())) return;
|
if (!isEnded.value && (await isGameEnded())) return;
|
||||||
const lastAwakeTime = uni.getStorageSync("last-awake-time");
|
const lastAwakeTime = uni.getStorageSync("last-awake-time");
|
||||||
if (lastAwakeTime) await getCurrentGameAPI();
|
if (lastAwakeTime) getCurrentGameAPI();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
onHide(() => {
|
onHide(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user