BUG修复

This commit is contained in:
kron
2025-08-18 16:09:11 +08:00
parent b31689b19f
commit 1ce2ea9eb7
13 changed files with 302 additions and 166 deletions

View File

@@ -268,10 +268,8 @@ export const getGameAPI = async (battleId) => {
data.redPlayers = {}; data.redPlayers = {};
data.bluePlayers = {}; data.bluePlayers = {};
data.mvps = []; data.mvps = [];
data.goldenRound = data.goldenRounds =
goldenRoundRecords && goldenRoundRecords.length goldenRoundRecords && goldenRoundRecords.length ? goldenRoundRecords : [];
? goldenRoundRecords[0]
: null;
playerStats.forEach((item) => { playerStats.forEach((item) => {
const { playerBattleStats = {}, roundRecords = [] } = item; const { playerBattleStats = {}, roundRecords = [] } = item;
if (playerBattleStats.team === 0) { if (playerBattleStats.team === 0) {
@@ -290,6 +288,20 @@ export const getGameAPI = async (battleId) => {
}; };
}); });
}); });
(goldenRoundRecords || []).forEach((item, index) => {
item.arrowHistory.forEach((arrow) => {
if (!data.roundsData[playerStats.length + index + 1]) {
data.roundsData[playerStats.length + index + 1] = {};
}
if (!data.roundsData[playerStats.length + index + 1][arrow.playerId]) {
data.roundsData[playerStats.length + index + 1][arrow.playerId] = [];
}
data.roundsData[playerStats.length + index + 1][arrow.playerId].push(
arrow
);
});
});
data.mvps.sort((a, b) => b.totalRings - a.totalRings); data.mvps.sort((a, b) => b.totalRings - a.totalRings);
} }
if (battleStats && battleStats.mode === 2) { if (battleStats && battleStats.mode === 2) {

View File

@@ -19,6 +19,10 @@ defineProps({
type: Number, type: Number,
default: 0, default: 0,
}, },
goldenRound: {
type: Number,
default: 0,
},
}); });
</script> </script>
@@ -43,7 +47,21 @@ defineProps({
<view class="players"> <view class="players">
<view> <view>
<view v-for="(result, index) in roundResults" :key="index"> <view v-for="(result, index) in roundResults" :key="index">
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" /> <block
v-if="goldenRound > 0 && index >= roundResults.length - goldenRound"
>
<image
:src="
RoundImages[
`gold${index + 1 - (roundResults.length - goldenRound)}`
]
"
mode="widthFix"
/>
</block>
<block v-else>
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
</block>
<view> <view>
<text>{{ <text>{{
result.blueArrows.length result.blueArrows.length
@@ -70,7 +88,21 @@ defineProps({
</view> </view>
<view> <view>
<view v-for="(result, index) in roundResults" :key="index"> <view v-for="(result, index) in roundResults" :key="index">
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" /> <block
v-if="goldenRound > 0 && index >= roundResults.length - goldenRound"
>
<image
:src="
RoundImages[
`gold${index + 1 - (roundResults.length - goldenRound)}`
]
"
mode="widthFix"
/>
</block>
<block v-else>
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
</block>
<view> <view>
<text>{{ <text>{{
result.redArrows.length result.redArrows.length

View File

@@ -137,9 +137,10 @@ defineProps({
} }
.players > view > image:last-child { .players > view > image:last-child {
position: absolute; position: absolute;
width: 40px; width: 50px;
top: 0; top: -10%;
left: 0; left: -5%;
transform: rotate(-12deg);
} }
.players > view > view { .players > view > view {
display: flex; display: flex;

View File

@@ -9,7 +9,6 @@ const { user } = storeToRefs(store);
const tips = ref(""); const tips = ref("");
const melee = ref(false); const melee = ref(false);
const battleId = ref("");
const timer = ref(null); const timer = ref(null);
const sound = ref(true); const sound = ref(true);
const currentSound = ref(""); const currentSound = ref("");
@@ -51,16 +50,15 @@ const updateSound = () => {
async function onReceiveMessage(messages = []) { async function onReceiveMessage(messages = []) {
if (!sound.value || ended.value) return; if (!sound.value || ended.value) return;
messages.forEach((msg) => { messages.forEach((msg) => {
if (battleId.value && msg.constructor === MESSAGETYPES.ShootResult) { if (msg.constructor === MESSAGETYPES.ShootResult) {
if (melee.value && msg.userId !== user.value.id) return; if (melee.value && msg.userId !== user.value.id) return;
if (!halfTime.value && msg.target) { if (!halfTime.value && msg.target) {
currentSound.value = msg.target.ring currentSound.value = msg.target.ring
? `${msg.target.ring}` ? `${msg.target.ring}`
: "未上靶"; : "未上靶";
console.log(currentSound.value);
audioManager.play(currentSound.value); audioManager.play(currentSound.value);
} }
} else if (msg.constructor === MESSAGETYPES.WaitForAllReady) {
battleId.value = msg.id;
} else if (msg.constructor === MESSAGETYPES.AllReady) { } else if (msg.constructor === MESSAGETYPES.AllReady) {
currentRoundEnded.value = true; currentRoundEnded.value = true;
audioManager.play("比赛开始"); audioManager.play("比赛开始");
@@ -84,6 +82,10 @@ async function onReceiveMessage(messages = []) {
ended.value = true; ended.value = true;
} else if (msg.constructor === MESSAGETYPES.MatchOver) { } else if (msg.constructor === MESSAGETYPES.MatchOver) {
ended.value = true; ended.value = true;
} else if (msg.constructor === MESSAGETYPES.BackToGame) {
if (msg.battleInfo) {
melee.value = msg.battleInfo.config.battleMode === 2;
}
} }
}); });
} }

View File

@@ -101,9 +101,9 @@ onUnmounted(() => {
<block v-if="isFinal"> <block v-if="isFinal">
<view class="point-view2"> <view class="point-view2">
<text>蓝队</text> <text>蓝队</text>
<text>5</text> <text>{{ bluePoint }}</text>
<text>红队</text> <text>红队</text>
<text>5</text> <text>{{ redPoint }}</text>
<text></text> <text></text>
</view> </view>
<text>同分僵局最后一箭定江山</text> <text>同分僵局最后一箭定江山</text>

View File

@@ -177,23 +177,39 @@ export const getBattleResultTips = (
}; };
export const RoundImages = { export const RoundImages = {
"round1":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggifbnw9snvs.png", round1:
"round2":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgf0swue5xzpd.png", "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggifbnw9snvs.png",
"round3":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slglkylhmq8beb.png", round2:
"round4":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggc88nasmxf5.png", "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgf0swue5xzpd.png",
"round5":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeloitb8mixf.png", round3:
"round6":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgsjbyyuu1des.png", "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slglkylhmq8beb.png",
"round7":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgdysd1wqulj5.png", round4:
"round8":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgm82ny3qjd8m.png", "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggc88nasmxf5.png",
} round5:
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeloitb8mixf.png",
gold1:
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgsjbyyuu1des.png",
gold2:
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgdysd1wqulj5.png",
gold3:
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgm82ny3qjd8m.png",
};
export const RoundGoldImages = { export const RoundGoldImages = {
"round1":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slg7kfzzwwiwcb.png", round1:
"round2":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgs5htghfh3a9.png", "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slg7kfzzwwiwcb.png",
"round3":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgc9ge3paqkba.png", round2:
"round4":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgehduk96yurp.png", "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgs5htghfh3a9.png",
"round5":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgefz3hdmwbnz.png", round3:
"round6":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeyb4cqwezgc.png", "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgc9ge3paqkba.png",
"round7":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggu3tlh97v5p.png", round4:
"round8":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgszmdtmaotch.png", "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgehduk96yurp.png",
} round5:
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgefz3hdmwbnz.png",
gold1:
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeyb4cqwezgc.png",
gold2:
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggu3tlh97v5p.png",
gold3:
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgszmdtmaotch.png",
};

View File

@@ -120,7 +120,11 @@ const checkBowData = () => {
:src="`../static/${data.winner === 1 ? 'blue' : 'red'}-team-win.png`" :src="`../static/${data.winner === 1 ? 'blue' : 'red'}-team-win.png`"
mode="widthFix" mode="widthFix"
/> />
<view> <view
:style="{
transform: `translateY(50px) rotate(-${5 + data.mvps.length}deg)`,
}"
>
<view v-if="data.mvps && data.mvps[0].totalRings"> <view v-if="data.mvps && data.mvps[0].totalRings">
<image src="../static/title-mvp.png" mode="widthFix" /> <image src="../static/title-mvp.png" mode="widthFix" />
<text <text
@@ -132,7 +136,7 @@ const checkBowData = () => {
</view> </view>
<view v-if="data.mvps && data.mvps.length"> <view v-if="data.mvps && data.mvps.length">
<view v-for="(player, index) in data.mvps" :key="index"> <view v-for="(player, index) in data.mvps" :key="index">
<view class="team-avatar"> <view class="team-avatar" :style="{ transform: 'rotate(10deg)' }">
<Avatar <Avatar
:src="player.avatar" :src="player.avatar"
:size="40" :size="40"
@@ -495,13 +499,11 @@ const checkBowData = () => {
.header-mvp > view { .header-mvp > view {
display: flex; display: flex;
justify-content: center; justify-content: center;
transform: translateY(55px);
} }
.header-mvp > view > view:first-child { .header-mvp > view > view:first-child {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
margin-right: 5vw;
} }
.header-mvp > view > view:first-child > image { .header-mvp > view > view:first-child > image {
width: 24vw; width: 24vw;
@@ -509,24 +511,24 @@ const checkBowData = () => {
.header-mvp > view > view:first-child > text { .header-mvp > view > view:first-child > text {
color: #fff; color: #fff;
font-size: 14px; font-size: 14px;
transform: translateY(-4px) rotate(-5deg); transform: skewX(-10deg);
} }
.header-mvp > view > view:last-child { .header-mvp > view > view:last-child {
display: flex; display: flex;
align-items: center; align-items: center;
color: #fff; color: #fff;
font-size: 8px; font-size: 9px;
text-align: center; text-align: center;
transform: translateY(-16px) rotate(-5deg); transform: translateY(-4px);
min-width: 40%;
} }
.header-mvp > view > view:last-child > view { .header-mvp > view > view:last-child > view {
margin-right: 4vw; margin-left: 4vw;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.header-mvp > view > view:last-child > view > text { .header-mvp > view > view:last-child > view > text {
margin-top: 4px; margin-top: 4px;
width: 40px; width: 40px;
transform: skewX(-10deg) translateX(-3px);
} }
</style> </style>

View File

@@ -12,6 +12,7 @@ import { getGameAPI } from "@/apis";
const blueTeam = ref([]); const blueTeam = ref([]);
const redTeam = ref([]); const redTeam = ref([]);
const roundsData = ref([]); const roundsData = ref([]);
const goldenRoundsData = ref([]);
const battleId = ref(""); const battleId = ref("");
const data = ref({ const data = ref({
players: [], players: [],
@@ -20,7 +21,7 @@ const data = ref({
onLoad(async (options) => { onLoad(async (options) => {
if (options.id) { if (options.id) {
battleId.value = options.id || "BATTLE-1755239389665389000-812"; battleId.value = options.id || "BATTLE-1755484626207409508-955";
const result = await getGameAPI(battleId.value); const result = await getGameAPI(battleId.value);
data.value = result; data.value = result;
if (result.mode === 1) { if (result.mode === 1) {
@@ -34,10 +35,12 @@ onLoad(async (options) => {
let blueArrows = []; let blueArrows = [];
let redArrows = []; let redArrows = [];
blueTeam.value.forEach((p) => { blueTeam.value.forEach((p) => {
if (!item[p.playerId]) return;
blueTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0); blueTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0);
blueArrows = [...blueArrows, ...item[p.playerId]]; blueArrows = [...blueArrows, ...item[p.playerId]];
}); });
redTeam.value.forEach((p) => { redTeam.value.forEach((p) => {
if (!item[p.playerId]) return;
redTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0); redTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0);
redArrows = [...redArrows, ...item[p.playerId]]; redArrows = [...redArrows, ...item[p.playerId]];
}); });
@@ -50,14 +53,12 @@ onLoad(async (options) => {
} }
roundsData.value.push({ roundsData.value.push({
blue: { blue: {
names: blueTeam.value.map((p) => p.name),
avatars: blueTeam.value.map((p) => p.avatar), avatars: blueTeam.value.map((p) => p.avatar),
arrows: blueArrows, arrows: blueArrows,
totalRing: blueTotalRings, totalRing: blueTotalRings,
totalScore: bluePoint, totalScore: bluePoint,
}, },
red: { red: {
names: redTeam.value.map((p) => p.name),
avatars: redTeam.value.map((p) => p.avatar), avatars: redTeam.value.map((p) => p.avatar),
arrows: redArrows, arrows: redArrows,
totalRing: redTotalRings, totalRing: redTotalRings,
@@ -65,6 +66,19 @@ onLoad(async (options) => {
}, },
}); });
}); });
result.goldenRounds.forEach((round) => {
goldenRoundsData.value.push({
blue: {
avatars: blueTeam.value.map((p) => p.avatar),
arrows: round.arrowHistory.filter((a) => a.team === 1),
},
red: {
avatars: redTeam.value.map((p) => p.avatar),
arrows: round.arrowHistory.filter((a) => a.team === 0),
},
winner: round.winner,
});
});
} }
} }
}); });
@@ -113,7 +127,7 @@ const checkBowData = () => {
:totalRing="player.totalRings" :totalRing="player.totalRings"
:rank="index + 1" :rank="index + 1"
/> />
<block v-if="data.goldenRound"> <block v-for="(round, index) in goldenRoundsData" :key="index">
<view class="score-header"> <view class="score-header">
<text>决金箭轮环数</text> <text>决金箭轮环数</text>
<view @click="checkBowData"> <view @click="checkBowData">
@@ -121,61 +135,6 @@ const checkBowData = () => {
<image src="../static/back.png" mode="widthFix" /> <image src="../static/back.png" mode="widthFix" />
</view> </view>
</view> </view>
<view class="score-row">
<view>
<Avatar
:src="blueTeam[0].avatar"
:size="25"
borderColor="#64BAFF"
/>
<text
v-if="data.goldenRound.blueTotal"
v-for="(arrow, index) in data.goldenRound.arrowHistory.filter(
(a) => a.playerId === blueTeam[0].playerId
)"
:key="index"
>
{{ arrow.ring }}环
</text>
</view>
<image
v-if="data.goldenRound.winner === 1"
src="../static/winner-badge.png"
mode="widthFix"
/>
</view>
<view class="score-row" :style="{ marginBottom: '5px' }">
<view>
<Avatar :src="redTeam[0].avatar" :size="25" borderColor="#FF6767" />
<text
v-if="data.goldenRound.redTotal"
v-for="(arrow, index) in data.goldenRound.arrowHistory.filter(
(a) => a.playerId === redTeam[0].playerId
)"
:key="index"
>
{{ arrow.ring }}环
</text>
</view>
<image
v-if="data.goldenRound.winner === 0"
src="../static/winner-badge.png"
mode="widthFix"
/>
</view>
</block>
<view
v-for="(round, index) in roundsData"
:key="index"
:style="{ marginBottom: '5px' }"
>
<view class="score-header">
<text>第{{ index + 1 }}轮</text>
<view @click="checkBowData">
<text>查看靶纸</text>
<image src="../static/back.png" mode="widthFix" />
</view>
</view>
<view class="score-row"> <view class="score-row">
<view> <view>
<view> <view>
@@ -190,18 +149,17 @@ const checkBowData = () => {
mode="widthFix" mode="widthFix"
/> />
</view> </view>
<text v-for="(arrow, index2) in round.blue.arrows" :key="index2"> <text v-for="(arrow, index) in round.blue.arrows" :key="index">
{{ arrow.ring }} {{ arrow.ring }}
</text> </text>
</view> </view>
<view> <image
<text :style="{ color: '#64BAFF' }"> v-if="round.winner === 1"
{{ round.blue.totalRing }}环 src="../static/winner-badge.png"
</text> mode="widthFix"
<text>得分 {{ round.blue.totalScore }}</text> />
</view>
</view> </view>
<view class="score-row"> <view class="score-row" :style="{ marginBottom: '5px' }">
<view> <view>
<view> <view>
<image <image
@@ -215,17 +173,85 @@ const checkBowData = () => {
mode="widthFix" mode="widthFix"
/> />
</view> </view>
<text v-for="(arrow, index2) in round.red.arrows" :key="index2"> <text v-for="(arrow, index) in round.red.arrows" :key="index">
{{ arrow.ring }} {{ arrow.ring }}
</text> </text>
</view> </view>
<view> <image
<text :style="{ color: '#FF6767' }"> v-if="round.winner === 0"
{{ round.red.totalRing }}环 src="../static/winner-badge.png"
</text> mode="widthFix"
<text>得分 {{ round.red.totalScore }}</text> />
</view>
</view> </view>
</block>
<view
v-for="(round, index) in roundsData"
:key="index"
:style="{ marginBottom: '5px' }"
>
<block
v-if="
index < Object.keys(roundsData).length - goldenRoundsData.length
"
>
<view class="score-header">
<text>第{{ index + 1 }}轮</text>
<view @click="checkBowData">
<text>查看靶纸</text>
<image src="../static/back.png" mode="widthFix" />
</view>
</view>
<view class="score-row">
<view>
<view>
<image
v-for="(src, index) in round.blue.avatars"
:style="{
borderColor: '#64BAFF',
transform: `translateX(-${index * 15}px)`,
}"
:src="src"
:key="index"
mode="widthFix"
/>
</view>
<text v-for="(arrow, index2) in round.blue.arrows" :key="index2">
{{ arrow.ring }}环
</text>
</view>
<view>
<text :style="{ color: '#64BAFF' }">
{{ round.blue.totalRing }}环
</text>
<text>得分 {{ round.blue.totalScore }}</text>
</view>
</view>
<view class="score-row">
<view>
<view>
<image
v-for="(src, index) in round.red.avatars"
:style="{
borderColor: '#FF6767',
transform: `translateX(-${index * 15}px)`,
}"
:src="src"
:key="index"
mode="widthFix"
/>
</view>
<text v-for="(arrow, index2) in round.red.arrows" :key="index2">
{{ arrow.ring }}环
</text>
</view>
<view>
<text :style="{ color: '#FF6767' }">
{{ round.red.totalRing }}环
</text>
<text>得分 {{ round.red.totalScore }}</text>
</view>
</view>
</block>
</view> </view>
<view :style="{ height: '20px' }"></view> <view :style="{ height: '20px' }"></view>
</view> </view>
@@ -299,10 +325,10 @@ const checkBowData = () => {
.score-row > image:last-child { .score-row > image:last-child {
width: 40px; width: 40px;
} }
.score-row > view:last-child { .score-row > view:nth-child(2) {
padding-right: 5px; padding-right: 5px;
} }
.score-row > view:last-child > text:last-child { .score-row > view:nth-child(2) > text:last-child {
margin-left: 20px; margin-left: 20px;
} }
</style> </style>

View File

@@ -16,25 +16,28 @@ const addBg = ref("");
onMounted(async () => { onMounted(async () => {
const menuBtnInfo = uni.getMenuButtonBoundingClientRect(); const menuBtnInfo = uni.getMenuButtonBoundingClientRect();
capsuleHeight.value = menuBtnInfo.top - 9; capsuleHeight.value = menuBtnInfo.top - 9;
currentList.value = rankData.value.rank; handleSelect(0);
if (rankData.value.myRankPos) myData.value = rankData.value.myRankPos;
}); });
const handleSelect = (index) => { const handleSelect = (index) => {
selectedIndex.value = index; selectedIndex.value = index;
myData.value = {};
currentList.value = [];
if (index === 0) { if (index === 0) {
currentList.value = rankData.value.rank; currentList.value = rankData.value.rank;
if (rankData.value.myRankPos) myData.value = rankData.value.myRankPos;
} else if (index === 1) { } else if (index === 1) {
currentList.value = rankData.value.mvpRank; currentList.value = rankData.value.mvpRank;
if (rankData.value.myMvpRankPos) myData.value = rankData.value.myMvpRankPos;
} else if (index === 2) { } else if (index === 2) {
currentList.value = rankData.value.ringRank; currentList.value = rankData.value.ringRank;
if (rankData.value.myRingRankPos) }
myData.value = rankData.value.myRingRankPos; if (user.value.id) {
} else { currentList.value.some((item) => {
myData.value = {}; if (item.userId === user.value.id) {
currentList.value = []; myData.value = item;
return true;
}
return false;
});
} }
}; };
@@ -172,18 +175,24 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
<text class="truncate">{{ user.nickName }}</text> <text class="truncate">{{ user.nickName }}</text>
<text>{{ user.lvlName }}{{ myData.TotalGames }}</text> <text>{{ user.lvlName }}{{ myData.TotalGames }}</text>
</view> </view>
<text class="rank-item-integral" v-if="selectedIndex === 0">
<text
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
>{{ myData.totalScore }}</text
></text
>
<text class="rank-item-integral" v-if="selectedIndex === 1">
<text
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
>{{ myData.TotalGames }}</text
></text
>
<text class="rank-item-integral" v-if="selectedIndex === 2"> <text class="rank-item-integral" v-if="selectedIndex === 2">
<text <text
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }" :style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
>{{ rankData.myRankPos.TenRings }}</text >{{ myData.TenRings }}</text
></text ></text
> >
<text class="rank-item-integral" v-else>
<text
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
>{{ rankData.myRingRankPos.totalScore }}</text
></text
>
</view> </view>
</scroll-view> </scroll-view>
</template> </template>

View File

@@ -25,6 +25,7 @@ const start = ref(false);
const tips = ref(""); const tips = ref("");
const battleId = ref(""); const battleId = ref("");
const currentRound = ref(1); const currentRound = ref(1);
const goldenRound = ref(0);
const currentRedPoint = ref(0); const currentRedPoint = ref(0);
const currentBluePoint = ref(0); const currentBluePoint = ref(0);
const totalRounds = ref(0); const totalRounds = ref(0);
@@ -105,6 +106,7 @@ function recoverData(battleInfo) {
const { ShotCount, RedRecords, BlueRecords } = battleInfo.goldenRound; const { ShotCount, RedRecords, BlueRecords } = battleInfo.goldenRound;
const roundCount = Math.max(RedRecords.length, BlueRecords.length); const roundCount = Math.max(RedRecords.length, BlueRecords.length);
currentRound.value += roundCount; currentRound.value += roundCount;
goldenRound.value += roundCount;
isFinalShoot.value = true; isFinalShoot.value = true;
for (let i = 0; i < roundCount; i++) { for (let i = 0; i < roundCount; i++) {
const roundData = { const roundData = {
@@ -112,6 +114,7 @@ function recoverData(battleInfo) {
RedRecords && RedRecords[i] ? RedRecords[i].Arrows || [] : [], RedRecords && RedRecords[i] ? RedRecords[i].Arrows || [] : [],
blueArrows: blueArrows:
BlueRecords && BlueRecords[i] ? BlueRecords[i].Arrows || [] : [], BlueRecords && BlueRecords[i] ? BlueRecords[i].Arrows || [] : [],
gold: true,
}; };
if (roundResults.value[5 + i]) { if (roundResults.value[5 + i]) {
roundResults.value[5 + i] = roundData; roundResults.value[5 + i] = roundData;
@@ -185,6 +188,7 @@ async function onReceiveMessage(messages = []) {
roundResults.value.push({ roundResults.value.push({
redArrows: [], redArrows: [],
blueArrows: [], blueArrows: [],
gold: goldenRound.value > 0,
}); });
} }
roundResults.value[currentRound.value - 1][ roundResults.value[currentRound.value - 1][
@@ -211,11 +215,13 @@ async function onReceiveMessage(messages = []) {
} }
if (msg.constructor === MESSAGETYPES.FinalShoot) { if (msg.constructor === MESSAGETYPES.FinalShoot) {
currentShooterId.value = 0; currentShooterId.value = 0;
currentRound.value += 1; goldenRound.value += 1;
roundResults.value.push({ roundResults.value.push({
redArrows: [], redArrows: [],
blueArrows: [], blueArrows: [],
}); });
currentBluePoint.value = bluePoints.value;
currentRedPoint.value = redPoints.value;
if (!isFinalShoot.value) { if (!isFinalShoot.value) {
isFinalShoot.value = true; isFinalShoot.value = true;
showRoundTip.value = true; showRoundTip.value = true;
@@ -307,7 +313,12 @@ onHide(() => {
:isRed="false" :isRed="false"
:currentShooterId="currentShooterId" :currentShooterId="currentShooterId"
/> />
<ShootProgress2 :tips="tips" :currentRound="'round' + currentRound" /> <ShootProgress2
:tips="tips"
:currentRound="
goldenRound > 0 ? 'gold' + goldenRound : 'round' + currentRound
"
/>
<TeamAvatars :team="redTeam" :currentShooterId="currentShooterId" /> <TeamAvatars :team="redTeam" :currentShooterId="currentShooterId" />
</view> </view>
<BowTarget <BowTarget
@@ -322,6 +333,7 @@ onHide(() => {
:roundResults="roundResults" :roundResults="roundResults"
:redPoints="redPoints" :redPoints="redPoints"
:bluePoints="bluePoints" :bluePoints="bluePoints"
:goldenRound="goldenRound"
:power="power" :power="power"
/> />
<Timer v-if="!start" /> <Timer v-if="!start" />

View File

@@ -12,11 +12,13 @@ const blueScores = ref([]);
const tabs = ref(["所有轮次"]); const tabs = ref(["所有轮次"]);
const players = ref([]); const players = ref([]);
const allRoundsScore = ref({}); const allRoundsScore = ref({});
const data = ref({}); const data = ref({
goldenRounds: [],
});
onLoad(async (options) => { onLoad(async (options) => {
if (options.battleId) { if (options.battleId) {
const result = await getGameAPI( const result = await getGameAPI(
options.battleId || "BATTLE-1754988051086075885-926" options.battleId || "BATTLE-1755484626207409508-955"
); );
data.value = result; data.value = result;
Object.values(result.bluePlayers).forEach((p, index) => { Object.values(result.bluePlayers).forEach((p, index) => {
@@ -28,9 +30,18 @@ onLoad(async (options) => {
players.value.push(Object.values(result.redPlayers)[index]); players.value.push(Object.values(result.redPlayers)[index]);
} }
}); });
if (result.goldenRound) tabs.value.push("决金箭"); if (result.goldenRounds) {
Object.keys(result.roundsData).forEach((key) => { result.goldenRounds.forEach(() => {
tabs.value.push(`${roundsName[key]}`); tabs.value.push("决金箭");
});
}
Object.keys(result.roundsData).forEach((key, index) => {
if (
index <
Object.keys(result.roundsData).length - result.goldenRounds.length
) {
tabs.value.push(`${roundsName[key]}`);
}
}); });
onClickTab(0); onClickTab(0);
} }
@@ -39,11 +50,13 @@ const onClickTab = (index) => {
selected.value = index; selected.value = index;
redScores.value = []; redScores.value = [];
blueScores.value = []; blueScores.value = [];
const { bluePlayers, redPlayers, roundsData, goldenRound } = data.value; const { bluePlayers, redPlayers, roundsData, goldenRounds } = data.value;
let maxArrowLength = 0;
if (index === 0) { if (index === 0) {
Object.keys(bluePlayers).forEach((p) => { Object.keys(bluePlayers).forEach((p) => {
allRoundsScore.value[p] = []; allRoundsScore.value[p] = [];
Object.values(roundsData).forEach((round) => { Object.values(roundsData).forEach((round) => {
if (!round[p]) return;
allRoundsScore.value[p].push( allRoundsScore.value[p].push(
round[p].reduce((last, next) => last + next.ring, 0) round[p].reduce((last, next) => last + next.ring, 0)
); );
@@ -55,6 +68,7 @@ const onClickTab = (index) => {
Object.keys(redPlayers).forEach((p) => { Object.keys(redPlayers).forEach((p) => {
allRoundsScore.value[p] = []; allRoundsScore.value[p] = [];
Object.values(roundsData).forEach((round) => { Object.values(roundsData).forEach((round) => {
if (!round[p]) return;
allRoundsScore.value[p].push( allRoundsScore.value[p].push(
round[p].reduce((last, next) => last + next.ring, 0) round[p].reduce((last, next) => last + next.ring, 0)
); );
@@ -63,20 +77,29 @@ const onClickTab = (index) => {
}); });
}); });
}); });
} else if (index === 1 && goldenRound) { } else if (index <= goldenRounds.length) {
if (goldenRound.winner === 1) { const dataIndex =
blueScores.value = goldenRound.arrowHistory; Object.keys(roundsData).length - goldenRounds.length + index;
} else {
redScores.value = goldenRound.arrowHistory;
}
} else {
Object.keys(bluePlayers).forEach((p) => { Object.keys(bluePlayers).forEach((p) => {
roundsData[goldenRound ? index - 1 : index][p].forEach((arrow) => { if (!roundsData[dataIndex][p]) return;
roundsData[dataIndex][p].forEach((arrow) => {
blueScores.value.push(arrow); blueScores.value.push(arrow);
}); });
}); });
Object.keys(redPlayers).forEach((p) => { Object.keys(redPlayers).forEach((p) => {
roundsData[goldenRound ? index - 1 : index][p].forEach((arrow) => { if (!roundsData[dataIndex][p]) return;
roundsData[dataIndex][p].forEach((arrow) => {
redScores.value.push(arrow);
});
});
} else {
Object.keys(bluePlayers).forEach((p) => {
roundsData[index - goldenRounds.length][p].forEach((arrow) => {
blueScores.value.push(arrow);
});
});
Object.keys(redPlayers).forEach((p) => {
roundsData[index - goldenRounds.length][p].forEach((arrow) => {
redScores.value.push(arrow); redScores.value.push(arrow);
}); });
}); });
@@ -127,25 +150,23 @@ const onClickTab = (index) => {
</view> </view>
<view <view
v-if=" v-if="
selected === 1 && selected >= data.goldenRounds.length &&
data.goldenRound && selected <= data.goldenRounds.length
data.goldenRound.arrowHistory.find(
(a) => a.playerId === player.playerId
)
" "
v-for="(score, index) in data.goldenRound.arrowHistory" v-for="(score, index) in data.roundsData[
Object.keys(data.roundsData).length -
data.goldenRounds.length +
selected
][player.playerId]"
:key="index" :key="index"
class="score-item" class="score-item"
> >
{{ score.ring }} {{ score.ring }}
</view> </view>
<view <view
v-if=" v-if="selected > data.goldenRounds.length"
(!data.goldenRound && selected > 0) ||
(data.goldenRound && selected > 1)
"
v-for="(score, index) in data.roundsData[ v-for="(score, index) in data.roundsData[
data.goldenRound ? selected - 1 : selected selected - data.goldenRounds.length
][player.playerId]" ][player.playerId]"
:key="index" :key="index"
class="score-item" class="score-item"
@@ -196,7 +217,9 @@ const onClickTab = (index) => {
.score-row { .score-row {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
margin-left: 5px; margin-bottom: 5px;
width: calc(50% - 5px);
padding-left: 5px;
} }
.score-row > view:last-child { .score-row > view:last-child {
margin-left: 10px; margin-left: 10px;
@@ -204,6 +227,7 @@ const onClickTab = (index) => {
grid-template-columns: repeat(3, auto); grid-template-columns: repeat(3, auto);
gap: 5px; gap: 5px;
margin-right: 5px; margin-right: 5px;
min-width: 26%;
} }
.score-item { .score-item {
background-image: url("../static/score-bg.png"); background-image: url("../static/score-bg.png");
@@ -219,8 +243,8 @@ const onClickTab = (index) => {
height: 10vw; height: 10vw;
} }
.score-container { .score-container {
display: grid; display: flex;
grid-template-columns: repeat(2, 1fr); flex-wrap: wrap;
row-gap: 15px; width: 100%;
} }
</style> </style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB