fix bug
This commit is contained in:
@@ -25,7 +25,7 @@ onLoad(async (options) => {
|
|||||||
const myId = user.value.id;
|
const myId = user.value.id;
|
||||||
if (options.battleId) {
|
if (options.battleId) {
|
||||||
const result = await getGameAPI(
|
const result = await getGameAPI(
|
||||||
options.battleId || "BATTLE-1755841244966457660-735"
|
options.battleId || "BATTLE-1758270367040321900-868"
|
||||||
);
|
);
|
||||||
data.value = {
|
data.value = {
|
||||||
...result,
|
...result,
|
||||||
@@ -44,7 +44,6 @@ onLoad(async (options) => {
|
|||||||
data.value.myTeam = result.bluePlayers[myId].team;
|
data.value.myTeam = result.bluePlayers[myId].team;
|
||||||
ifWin.value = result.winner === 1;
|
ifWin.value = result.winner === 1;
|
||||||
}
|
}
|
||||||
audioManager.play(ifWin.value ? "胜利" : "失败");
|
|
||||||
}
|
}
|
||||||
if (result.mode === 2) {
|
if (result.mode === 2) {
|
||||||
data.value.playerStats = result.players.map((p) => ({
|
data.value.playerStats = result.players.map((p) => ({
|
||||||
@@ -54,9 +53,6 @@ onLoad(async (options) => {
|
|||||||
const mine = result.players.find((p) => p.playerId === myId);
|
const mine = result.players.find((p) => p.playerId === myId);
|
||||||
if (mine) totalPoints.value = mine.totalScore;
|
if (mine) totalPoints.value = mine.totalScore;
|
||||||
rank.value = result.players.findIndex((p) => p.playerId === myId) + 1;
|
rank.value = result.players.findIndex((p) => p.playerId === myId) + 1;
|
||||||
if (rank.value > result.players.length * 0.3) {
|
|
||||||
audioManager.play("胜利");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const battleInfo = uni.getStorageSync("last-battle");
|
const battleInfo = uni.getStorageSync("last-battle");
|
||||||
@@ -83,11 +79,21 @@ onLoad(async (options) => {
|
|||||||
totalPoints.value = mine.totalScore;
|
totalPoints.value = mine.totalScore;
|
||||||
if (battleInfo.mode === 1) {
|
if (battleInfo.mode === 1) {
|
||||||
ifWin.value = mine.team === battleInfo.winner;
|
ifWin.value = mine.team === battleInfo.winner;
|
||||||
audioManager.play(ifWin.value ? "胜利" : "失败");
|
}
|
||||||
} else {
|
}
|
||||||
if (rank.value > battleInfo.playerStats.length * 0.3) {
|
}
|
||||||
audioManager.play("胜利");
|
if (data.value.mode === 1) {
|
||||||
}
|
audioManager.play(ifWin.value ? "胜利" : "失败");
|
||||||
|
} else if (data.value.mode === 2) {
|
||||||
|
if (data.value.battleMode === 1) {
|
||||||
|
if (rank.value <= data.value.playerStats.length * 0.3) {
|
||||||
|
audioManager.play("胜利");
|
||||||
|
}
|
||||||
|
} else if (data.value.battleMode === 2) {
|
||||||
|
if (totalPoints.value > 0) {
|
||||||
|
audioManager.play("胜利");
|
||||||
|
} else if (totalPoints.value < 0) {
|
||||||
|
audioManager.play("失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,10 +279,14 @@ const checkBowData = () => {
|
|||||||
:size="40"
|
:size="40"
|
||||||
:borderColor="data.myTeam === 1 ? '#5fadff' : '#ff6060'"
|
:borderColor="data.myTeam === 1 ? '#5fadff' : '#ff6060'"
|
||||||
/>
|
/>
|
||||||
<text :style="{ backgroundColor: '#5fadff' }" v-if="data.myTeam === 1"
|
<text
|
||||||
|
:style="{ backgroundColor: '#5fadff' }"
|
||||||
|
v-if="data.mode === 1 && data.myTeam === 1"
|
||||||
>蓝队</text
|
>蓝队</text
|
||||||
>
|
>
|
||||||
<text :style="{ backgroundColor: '#ff6060' }" v-if="data.myTeam === 0"
|
<text
|
||||||
|
:style="{ backgroundColor: '#ff6060' }"
|
||||||
|
v-if="data.mode === 1 && data.myTeam === 0"
|
||||||
>红队</text
|
>红队</text
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
Reference in New Issue
Block a user