完成打乱斗数据调试

This commit is contained in:
kron
2026-02-07 10:52:56 +08:00
parent 09d8e7b3da
commit 6101cd80ce
20 changed files with 444 additions and 473 deletions

View File

@@ -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>