完成打乱斗数据调试
This commit is contained in:
@@ -16,6 +16,7 @@ const ifWin = ref(false);
|
||||
const data = ref({});
|
||||
const totalPoints = ref(0);
|
||||
const rank = ref(0);
|
||||
const players = ref([]);
|
||||
|
||||
function exit() {
|
||||
if (data.value.roomId) {
|
||||
@@ -30,27 +31,36 @@ function exit() {
|
||||
onLoad(async (options) => {
|
||||
if (!options.battleId) return;
|
||||
const myId = user.value.id;
|
||||
const result = await getBattleAPI(options.battleId || "58351917302157312");
|
||||
const result = await getBattleAPI(options.battleId || "59090720979554304");
|
||||
console.log("result", result);
|
||||
data.value = result;
|
||||
if (result.winTeam) {
|
||||
ifWin.value = result.teams[result.winTeam].players.some(
|
||||
(p) => p.id === myId
|
||||
);
|
||||
}
|
||||
if (result.way === 1) {
|
||||
if (result.mode <= 3) {
|
||||
audioManager.play(ifWin.value ? "胜利" : "失败");
|
||||
} else if (result.way === 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("失败");
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
players.value = result.resultList.map((item, index) => {
|
||||
const plist = result.teams[0] ? result.teams[0].players : [];
|
||||
const p = plist.find((p) => p.id === item.userId);
|
||||
if (p.id === user.value.id) {
|
||||
totalPoints.value = p.score;
|
||||
rank.value = index + 1;
|
||||
}
|
||||
return {
|
||||
...item,
|
||||
rank: index + 1,
|
||||
name: p.name,
|
||||
avatar: p.avatar || "",
|
||||
};
|
||||
});
|
||||
if (rank.value <= players.value * 0.3) {
|
||||
audioManager.play("胜利");
|
||||
} else {
|
||||
audioManager.play("胜利");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -71,7 +81,7 @@ const checkBowData = () => {
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<block v-if="data.way === 1">
|
||||
<block v-if="data.mode <= 3">
|
||||
<view class="header-team" :style="{ marginTop: '25%' }">
|
||||
<image src="../static/battle-result.png" mode="widthFix" />
|
||||
<view class="header-solo" v-if="data.mode === 1">
|
||||
@@ -161,7 +171,7 @@ const checkBowData = () => {
|
||||
/>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="data.way === 2">
|
||||
<block v-else>
|
||||
<view class="header-melee">
|
||||
<view />
|
||||
<image src="../static/battle-result.png" mode="widthFix" />
|
||||
@@ -170,11 +180,11 @@ const checkBowData = () => {
|
||||
<view
|
||||
class="players"
|
||||
:style="{
|
||||
height: `${Math.max(data.playerStats.length > 5 ? '330' : '300')}px`,
|
||||
height: `${Math.max(players.length > 5 ? '330' : '300')}px`,
|
||||
}"
|
||||
>
|
||||
<view
|
||||
v-for="(player, index) in data.playerStats"
|
||||
v-for="(player, index) in players"
|
||||
:key="index"
|
||||
:style="{
|
||||
border: player.id === user.id ? '1px solid #B04630' : 'none',
|
||||
@@ -229,7 +239,7 @@ const checkBowData = () => {
|
||||
<text>{{ getLvlName(player.rank_lvl) }}</text>
|
||||
</view>
|
||||
<text
|
||||
><text :style="{ color: '#fff' }">{{ player.totalRings }}</text>
|
||||
><text :style="{ color: '#fff' }">{{ player.totalRing }}</text>
|
||||
环</text
|
||||
>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user