diff --git a/src/components/BattleFooter.vue b/src/components/BattleFooter.vue
index f92493b..e4e869e 100644
--- a/src/components/BattleFooter.vue
+++ b/src/components/BattleFooter.vue
@@ -41,7 +41,13 @@ defineProps({
-
+
+ Round
+
+
+ 环
+
+
@@ -62,7 +68,13 @@ defineProps({
-
+
+ Round
+
+
+ 环
+
+
diff --git a/src/components/RoundEndTip.vue b/src/components/RoundEndTip.vue
index 043fd21..1ad4284 100644
--- a/src/components/RoundEndTip.vue
+++ b/src/components/RoundEndTip.vue
@@ -56,7 +56,7 @@ onUnmounted(() => {
第{{ round }}轮射击结束
-
+
本轮蓝队
{{
(roundData.blueArrows || []).reduce(
@@ -73,10 +73,13 @@ onUnmounted(() => {
}}
环
-
- 本场比赛无人射箭,已取消
+
+ 连续3个来回无人射箭,比赛被取消
-
+
红队、蓝队各得{{
redPoint
}} {
- if (battleInfo.roundResults[battleInfo.roundResults.length - 1]) {
- scores.value = battleInfo.roundResults[
- battleInfo.roundResults.length - 1
- ].redArrows.filter((item) => !!item.playerId);
- blueScores.value = battleInfo.roundResults[
- battleInfo.roundResults.length - 1
- ].blueArrows.filter((item) => !!item.playerId);
- }
- }, 300);
+ if (battleInfo.roundResults[battleInfo.roundResults.length - 1]) {
+ scores.value = battleInfo.roundResults[
+ battleInfo.roundResults.length - 1
+ ].redArrows.filter((item) => !!item.playerId);
+ blueScores.value = battleInfo.roundResults[
+ battleInfo.roundResults.length - 1
+ ].blueArrows.filter((item) => !!item.playerId);
+ }
if (
battleInfo.redTeam[0].shotHistory[battleInfo.currentRound] ||
battleInfo.blueTeam[0].shotHistory[battleInfo.currentRound]
@@ -152,16 +150,36 @@ function recoverData(battleInfo) {
blueArrows: [],
});
}
+ if (battleInfo.goldenRound) {
+ const { ShotCount, RedRecords, BlueRecords } = battleInfo.goldenRound;
+ const roundCount = Math.max(RedRecords.length, BlueRecords.length);
+ currentRound.value += roundCount;
+ isFinalShoot.value = true;
+ for (let i = 0; i < roundCount; i++) {
+ const roundData = {
+ redArrows:
+ RedRecords && RedRecords[i] ? RedRecords[i].Arrows || [] : [],
+ blueArrows:
+ BlueRecords && BlueRecords[i] ? BlueRecords[i].Arrows || [] : [],
+ };
+ if (roundResults.value[5 + i]) {
+ roundResults.value[5 + i] = roundData;
+ } else {
+ roundResults.value.push(roundData);
+ }
+ }
+ }
}
// 这个状态不准
// if (battleInfo.status !== 11) return;
if (battleInfo.firePlayerIndex) {
currentShooterId.value = battleInfo.firePlayerIndex;
- if (redTeam.value[0].id === currentShooterId.value) {
- tips.value = `请红队射箭-第${roundsName[currentRound.value]}轮`;
- } else {
- tips.value = `请蓝队射箭-第${roundsName[currentRound.value]}轮`;
- }
+ if (redTeam.value[0].id === currentShooterId.value)
+ tips.value = "请红队射箭";
+ else tips.value = "请蓝队射箭";
+ tips.value += isFinalShoot.value
+ ? "决金箭"
+ : `第${roundsName[currentRound.value]}轮`;
}
if (battleInfo.fireTime > 0) {
const remain = Date.now() / 1000 - battleInfo.fireTime;
@@ -396,26 +414,15 @@ async function onReceiveMessage(messages = []) {
const isRed = redTeam.value.find((item) => item.id === msg.userId);
if (isRed) scores.value.push(msg.target);
else blueScores.value.push(msg.target);
- if (roundResults.value[currentRound.value - 1]) {
- if (isRed && roundResults.value[currentRound.value - 1].redArrows) {
- roundResults.value[currentRound.value - 1].redArrows.push(
- msg.target
- );
- }
- if (
- !isRed &&
- roundResults.value[currentRound.value - 1].blueArrows
- ) {
- roundResults.value[currentRound.value - 1].blueArrows.push(
- msg.target
- );
- }
- } else {
+ if (!roundResults.value[currentRound.value - 1]) {
roundResults.value.push({
redArrows: [],
blueArrows: [],
});
}
+ roundResults.value[currentRound.value - 1][
+ isRed ? "redArrows" : "blueArrows"
+ ].push(msg.target);
}
if (battleType.value === 2 && msg.userId === user.value.id) {
scores.value.push({ ...msg.target });
@@ -434,9 +441,9 @@ async function onReceiveMessage(messages = []) {
currentRedPoint.value = result.redScore;
bluePoints.value += result.blueScore;
redPoints.value += result.redScore;
- currentRound.value = result.currentRound + 1;
uni.$emit("update-ramain", 0);
if (result.currentRound < 5) {
+ currentRound.value += 1;
roundResults.value.push({
redArrows: [],
blueArrows: [],
@@ -446,6 +453,12 @@ async function onReceiveMessage(messages = []) {
}
}
if (msg.constructor === MESSAGETYPES.FinalShoot) {
+ currentShooterId.value = 0;
+ currentRound.value += 1;
+ roundResults.value.push({
+ redArrows: [],
+ blueArrows: [],
+ });
if (!isFinalShoot.value) {
isFinalShoot.value = true;
showRoundTip.value = true;
@@ -467,15 +480,14 @@ async function onReceiveMessage(messages = []) {
}
if (msg.constructor === MESSAGETYPES.MatchOver) {
if (msg.endStatus.noSaved) {
- // uni.showToast({
- // title: "本场比赛无人射箭,已取消",
- // icon: "none",
- // });
+ // 正常每回合结束通知,回合会加上1
+ currentRound.value += 1;
currentBluePoint.value = 0;
currentRedPoint.value = 0;
+ showRoundTip.value = true;
setTimeout(() => {
uni.navigateBack();
- }, 1500);
+ }, 3000);
} else {
isEnded.value = true;
uni.setStorageSync("last-battle", msg.endStatus);
@@ -559,7 +571,11 @@ onHide(() => {
-
+
@@ -568,7 +584,7 @@ onHide(() => {
1v1比赛即将开始!
大乱斗即将开始!
- 邀请好友
+ 复制房间号
diff --git a/src/pages/friend-battle.vue b/src/pages/friend-battle.vue
index 1b9f705..19ebefd 100644
--- a/src/pages/friend-battle.vue
+++ b/src/pages/friend-battle.vue
@@ -33,9 +33,11 @@ const enterRoom = debounce(async () => {
);
if (!alreadyIn) {
const result = await joinRoomAPI(roomNumber.value);
- if (result.full) warnning.value = "房间已满员";
- showModal.value = true;
- return;
+ if (result.full) {
+ warnning.value = "房间已满员";
+ showModal.value = true;
+ return;
+ }
}
roomNumber.value = "";
showModal.value = false;
diff --git a/src/pages/melee-match.vue b/src/pages/melee-match.vue
index 09fbb0b..9bb2189 100644
--- a/src/pages/melee-match.vue
+++ b/src/pages/melee-match.vue
@@ -168,7 +168,7 @@ async function onReceiveMessage(messages = []) {
uni.redirectTo({
url: "/pages/battle-result",
});
- }, 1500);
+ }, 3000);
}
if (msg.constructor === MESSAGETYPES.BackToGame) {
uni.$emit("update-header-loading", false);
diff --git a/src/pages/ranking.vue b/src/pages/ranking.vue
index 0c4baa0..1033d1f 100644
--- a/src/pages/ranking.vue
+++ b/src/pages/ranking.vue
@@ -121,7 +121,7 @@ const updateData = () => {
currentSeasonData.value[keyName] = {
totalGames: item.totalGames,
winCount: item.winCount,
- winRate: Number(((item.winCount / item.totalGames) * 100).toFixed(2)),
+ winRate: Number(((item.winCount / item.totalGames) * 100).toFixed(1)),
};
}
});
@@ -195,7 +195,7 @@ onShow(async () => {
赛季胜率
{{
- rankData.user.avg_win ? rankData.user.avg_win + "%" : "-"
+ rankData.user.avg_win ? rankData.user.avg_win * 100 + "%" : "-"
}}
diff --git a/src/pages/team-match.vue b/src/pages/team-match.vue
index c8822e2..72cece3 100644
--- a/src/pages/team-match.vue
+++ b/src/pages/team-match.vue
@@ -83,16 +83,14 @@ function recoverData(battleInfo) {
redPoints.value += 2;
}
});
- setTimeout(() => {
- if (battleInfo.roundResults[battleInfo.roundResults.length - 1]) {
- scores.value = battleInfo.roundResults[
- battleInfo.roundResults.length - 1
- ].redArrows.filter((item) => !!item.playerId);
- blueScores.value = battleInfo.roundResults[
- battleInfo.roundResults.length - 1
- ].blueArrows.filter((item) => !!item.playerId);
- }
- }, 300);
+ if (battleInfo.roundResults[battleInfo.roundResults.length - 1]) {
+ scores.value = battleInfo.roundResults[
+ battleInfo.roundResults.length - 1
+ ].redArrows.filter((item) => !!item.playerId);
+ blueScores.value = battleInfo.roundResults[
+ battleInfo.roundResults.length - 1
+ ].blueArrows.filter((item) => !!item.playerId);
+ }
if (
battleInfo.redTeam[0].shotHistory[battleInfo.currentRound] ||
battleInfo.blueTeam[0].shotHistory[battleInfo.currentRound]
@@ -111,15 +109,35 @@ function recoverData(battleInfo) {
blueArrows: [],
});
}
+ if (battleInfo.goldenRound) {
+ const { ShotCount, RedRecords, BlueRecords } = battleInfo.goldenRound;
+ const roundCount = Math.max(RedRecords.length, BlueRecords.length);
+ currentRound.value += roundCount;
+ isFinalShoot.value = true;
+ for (let i = 0; i < roundCount; i++) {
+ const roundData = {
+ redArrows:
+ RedRecords && RedRecords[i] ? RedRecords[i].Arrows || [] : [],
+ blueArrows:
+ BlueRecords && BlueRecords[i] ? BlueRecords[i].Arrows || [] : [],
+ };
+ if (roundResults.value[5 + i]) {
+ roundResults.value[5 + i] = roundData;
+ } else {
+ roundResults.value.push(roundData);
+ }
+ }
+ }
}
// if (battleInfo.status !== 11) return;
if (battleInfo.firePlayerIndex) {
currentShooterId.value = battleInfo.firePlayerIndex;
- if (redTeam.value[0].id === currentShooterId.value) {
- tips.value = `请红队射箭-第${roundsName[currentRound.value]}轮`;
- } else {
- tips.value = `请蓝队射箭-第${roundsName[currentRound.value]}轮`;
- }
+ if (redTeam.value[0].id === currentShooterId.value)
+ tips.value = "请红队射箭";
+ else tips.value = "请蓝队射箭";
+ tips.value += isFinalShoot.value
+ ? "决金箭"
+ : `第${roundsName[currentRound.value]}轮`;
}
if (battleInfo.fireTime > 0) {
const remain = Date.now() / 1000 - battleInfo.fireTime;
@@ -198,21 +216,15 @@ async function onReceiveMessage(messages = []) {
const isRed = redTeam.value.find((item) => item.id === msg.userId);
if (isRed) scores.value.push(msg.target);
else blueScores.value.push(msg.target);
- if (roundResults.value[currentRound.value - 1]) {
- if (isRed && roundResults.value[currentRound.value - 1].redArrows) {
- roundResults.value[currentRound.value - 1].redArrows.push(msg.target);
- }
- if (!isRed && roundResults.value[currentRound.value - 1].blueArrows) {
- roundResults.value[currentRound.value - 1].blueArrows.push(
- msg.target
- );
- }
- } else {
+ if (!roundResults.value[currentRound.value - 1]) {
roundResults.value.push({
redArrows: [],
blueArrows: [],
});
}
+ roundResults.value[currentRound.value - 1][
+ isRed ? "redArrows" : "blueArrows"
+ ].push(msg.target);
}
if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
const result = msg.preRoundResult;
@@ -223,8 +235,8 @@ async function onReceiveMessage(messages = []) {
currentRedPoint.value = result.redScore;
bluePoints.value += result.blueScore;
redPoints.value += result.redScore;
- currentRound.value = result.currentRound + 1;
if (result.currentRound < 5) {
+ currentRound.value = result.currentRound + 1;
roundResults.value.push({
redArrows: [],
blueArrows: [],
@@ -234,6 +246,11 @@ async function onReceiveMessage(messages = []) {
}
if (msg.constructor === MESSAGETYPES.FinalShoot) {
currentShooterId.value = 0;
+ currentRound.value += 1;
+ roundResults.value.push({
+ redArrows: [],
+ blueArrows: [],
+ });
if (!isFinalShoot.value) {
isFinalShoot.value = true;
showRoundTip.value = true;
@@ -242,15 +259,13 @@ async function onReceiveMessage(messages = []) {
}
if (msg.constructor === MESSAGETYPES.MatchOver) {
if (msg.endStatus.noSaved) {
- // uni.showToast({
- // title: "本场比赛无人射箭,已取消",
- // icon: "none",
- // });
+ currentRound.value += 1;
currentBluePoint.value = 0;
currentRedPoint.value = 0;
+ showRoundTip.value = true;
setTimeout(() => {
uni.navigateBack();
- }, 1500);
+ }, 3000);
} else {
isEnded.value = true;
uni.setStorageSync("last-battle", msg.endStatus);