diff --git a/src/components/BattleFooter.vue b/src/components/BattleFooter.vue
index 51d6de3..134f7b6 100644
--- a/src/components/BattleFooter.vue
+++ b/src/components/BattleFooter.vue
@@ -1,8 +1,9 @@
=
@@ -43,15 +48,9 @@ defineProps({
-
+
@@ -84,15 +83,9 @@ defineProps({
-
+
@@ -148,7 +141,7 @@ defineProps({
.container > view:nth-child(2) > text {
z-index: 1;
margin-top: 2px;
- color: #8A323E;
+ color: #8a323e;
font-weight: 500;
}
.container > view:nth-child(2) > text:nth-child(2) {
diff --git a/src/components/RoundEndTip.vue b/src/components/RoundEndTip.vue
index fbd6859..5857fe2 100644
--- a/src/components/RoundEndTip.vue
+++ b/src/components/RoundEndTip.vue
@@ -117,10 +117,10 @@ onBeforeUnmount(() => {
display: flex;
flex-direction: column;
align-items: center;
- font-size: 16px;
+ font-size: 32rpx;
}
.round-end-tip > text:first-child {
- font-size: 18px;
+ font-size: 36rpx;
color: #fff;
}
.point-view1 {
@@ -137,7 +137,7 @@ onBeforeUnmount(() => {
}
.point-view2 {
margin: 12px 0;
- font-size: 24px;
+ font-size: 48rpx;
display: flex;
align-items: center;
justify-content: center;
@@ -155,7 +155,7 @@ onBeforeUnmount(() => {
align-items: center;
justify-content: center;
margin-top: 10px;
- font-size: 14px;
+ font-size: 28rpx;
}
.final-shoot > text:nth-child(1) {
width: 20px;
@@ -163,7 +163,7 @@ onBeforeUnmount(() => {
}
.final-shoot > text:nth-child(1),
.final-shoot > text:nth-child(3) {
- font-size: 18px;
+ font-size: 32rpx;
color: #fed847;
margin-left: 10px;
margin-right: 5px;
diff --git a/src/components/ShootProgress2.vue b/src/components/ShootProgress2.vue
index 261609d..5d512a9 100644
--- a/src/components/ShootProgress2.vue
+++ b/src/components/ShootProgress2.vue
@@ -83,7 +83,8 @@ onBeforeUnmount(() => {
margin-bottom: 12vw;
}
.container > image {
- width: 100%;
+ width: 360rpx;
+ height: 80rpx;
transform: translateY(7px);
}
.container > view:last-child {
diff --git a/src/pages/team-battle.vue b/src/pages/team-battle.vue
index bece66f..e5b99ec 100644
--- a/src/pages/team-battle.vue
+++ b/src/pages/team-battle.vue
@@ -28,7 +28,6 @@ const currentRound = ref(1);
const goldenRound = ref(0);
const currentRedPoint = ref(0);
const currentBluePoint = ref(0);
-const totalRounds = ref(0);
const scores = ref([]);
const blueScores = ref([]);
const redTeam = ref([]);
@@ -63,8 +62,8 @@ function recoverData(battleInfo) {
bluePoints.value = 0;
redPoints.value = 0;
currentRound.value = battleInfo.currentRound;
- totalRounds.value = battleInfo.maxRound;
roundResults.value = [...battleInfo.roundResults];
+ // 算得分
battleInfo.roundResults.forEach((round) => {
const blueTotal = round.blueArrows.reduce(
(last, next) => last + next.ring,
@@ -83,50 +82,64 @@ function recoverData(battleInfo) {
redPoints.value += 2;
}
});
- const hasCurrentRoundData =
- battleInfo.redTeam.some(
- (item) => !!item.shotHistory[battleInfo.currentRound]
- ) ||
- battleInfo.blueTeam.some(
- (item) => !!item.shotHistory[battleInfo.currentRound]
- );
- if (
- battleInfo.currentRound > battleInfo.roundResults.length &&
- hasCurrentRoundData
- ) {
- const blueArrows = [];
- const redArrows = [];
- battleInfo.redTeam.forEach((item) =>
- item.shotHistory[battleInfo.currentRound]
- .filter((item) => !!item.playerId)
- .forEach((item) => redArrows.push(item))
- );
- battleInfo.blueTeam.forEach((item) =>
- item.shotHistory[battleInfo.currentRound]
- .filter((item) => !!item.playerId)
- .forEach((item) => blueArrows.push(item))
- );
- roundResults.value.push({
- redArrows,
- blueArrows,
- });
- }
- if (battleInfo.goldenRound) {
- const { ShotCount, RedRecords, BlueRecords } = battleInfo.goldenRound;
- currentRound.value += ShotCount;
- goldenRound.value += ShotCount;
+ if (battleInfo.goldenRoundNumber) {
+ currentRound.value += battleInfo.goldenRoundNumber;
+ goldenRound.value = battleInfo.goldenRoundNumber;
isFinalShoot.value = true;
- for (let i = 0; i < ShotCount; i++) {
- const roundData = {
- redArrows:
- RedRecords && RedRecords[i] ? RedRecords[i].Arrows || [] : [],
- blueArrows:
- BlueRecords && BlueRecords[i] ? BlueRecords[i].Arrows || [] : [],
- gold: true,
- };
- roundResults.value.push(roundData);
+ for (let i = 1; i <= battleInfo.goldenRoundNumber; i++) {
+ const redArrows = [];
+ battleInfo.redTeam.forEach((item) => {
+ if (item.shotHistory[roundResults.value.length + 1]) {
+ item.shotHistory[roundResults.value.length + 1]
+ .filter((item) => !!item.playerId)
+ .forEach((item) => redArrows.push(item));
+ }
+ });
+ const blueArrows = [];
+ battleInfo.blueTeam.forEach((item) => {
+ if (item.shotHistory[roundResults.value.length + 1]) {
+ item.shotHistory[roundResults.value.length + 1]
+ .filter((item) => !!item.playerId)
+ .forEach((item) => blueArrows.push(item));
+ }
+ });
+ roundResults.value.push({
+ number: roundResults.value.length + 1,
+ blueArrows,
+ redArrows,
+ blueTotal: blueArrows.reduce((last, next) => last + next.ring, 0),
+ redTotal: redArrows.reduce((last, next) => last + next.ring, 0),
+ });
}
} else {
+ const hasCurrentRoundData =
+ battleInfo.redTeam.some(
+ (item) => !!item.shotHistory[battleInfo.currentRound]
+ ) ||
+ battleInfo.blueTeam.some(
+ (item) => !!item.shotHistory[battleInfo.currentRound]
+ );
+ if (
+ battleInfo.currentRound > battleInfo.roundResults.length &&
+ hasCurrentRoundData
+ ) {
+ const blueArrows = [];
+ const redArrows = [];
+ battleInfo.redTeam.forEach((item) =>
+ item.shotHistory[battleInfo.currentRound]
+ .filter((item) => !!item.playerId)
+ .forEach((item) => redArrows.push(item))
+ );
+ battleInfo.blueTeam.forEach((item) =>
+ item.shotHistory[battleInfo.currentRound]
+ .filter((item) => !!item.playerId)
+ .forEach((item) => blueArrows.push(item))
+ );
+ roundResults.value.push({
+ redArrows,
+ blueArrows,
+ });
+ }
[...battleInfo.redTeam, ...battleInfo.blueTeam].some((p) => {
if (p.id === user.value.id) {
const roundArrows = Object.values(p.shotHistory);
@@ -144,9 +157,13 @@ function recoverData(battleInfo) {
const lastIndex = roundResults.value.length - 1;
if (roundResults.value[lastIndex]) {
const redArrows = roundResults.value[lastIndex].redArrows;
- scores.value = [...redArrows].filter((item) => !!item.playerId);
+ scores.value = [...redArrows]
+ .filter((item) => !!item.playerId)
+ .sort((a, b) => a.shotTimeUnix - b.shotTimeUnix);
const blueArrows = roundResults.value[lastIndex].blueArrows;
- blueScores.value = [...blueArrows].filter((item) => !!item.playerId);
+ blueScores.value = [...blueArrows]
+ .filter((item) => !!item.playerId)
+ .sort((a, b) => a.shotTimeUnix - b.shotTimeUnix);
}
// if (battleInfo.status !== 11) return;
if (battleInfo.firePlayerIndex) {
@@ -174,7 +191,6 @@ async function onReceiveMessage(messages = []) {
messages.forEach((msg) => {
if (msg.constructor === MESSAGETYPES.AllReady) {
start.value = true;
- totalRounds.value = msg.groupUserStatus.config.maxRounds;
}
if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
if (currentShooterId.value !== msg.userId) {
@@ -193,7 +209,7 @@ async function onReceiveMessage(messages = []) {
}
}
if (msg.constructor === MESSAGETYPES.ShootResult) {
- if (currentShooterId.value !== msg.userId) return;
+ // if (currentShooterId.value !== msg.userId) return;
// const isRed = redTeam.value.find((item) => item.id === msg.userId);
// if (isRed) scores.value.push({ ...msg.target });
// else blueScores.value.push({ ...msg.target });
@@ -208,7 +224,12 @@ async function onReceiveMessage(messages = []) {
// roundResults.value[currentRound.value - 1][
// isRed ? "redArrows" : "blueArrows"
// ].push({ ...msg.target });
- if (msg.battleInfo) recoverData(msg.battleInfo);
+ if (msg.battleInfo) {
+ recoverData(msg.battleInfo);
+ // if (isFinalShoot.value) {
+ // uni.setStorageSync(`current-battle-${Date.now()}`, msg.battleInfo);
+ // }
+ }
}
if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
const result = msg.preRoundResult;
@@ -219,19 +240,12 @@ async function onReceiveMessage(messages = []) {
currentRedPoint.value = result.redScore;
bluePoints.value += result.blueScore;
redPoints.value += result.redScore;
- currentRound.value = result.currentRound + 1;
if (!result.goldenRound) {
showRoundTip.value = true;
}
}
if (msg.constructor === MESSAGETYPES.FinalShoot) {
currentShooterId.value = 0;
- currentRound.value = msg.groupUserStatus.currentRound + 1;
- goldenRound.value += 1;
- roundResults.value.push({
- redArrows: [],
- blueArrows: [],
- });
currentBluePoint.value = bluePoints.value;
currentRedPoint.value = redPoints.value;
if (!isFinalShoot.value) {
@@ -242,7 +256,6 @@ async function onReceiveMessage(messages = []) {
}
if (msg.constructor === MESSAGETYPES.MatchOver) {
if (msg.endStatus.noSaved) {
- currentRound.value += 1;
currentBluePoint.value = 0;
currentRedPoint.value = 0;
showRoundTip.value = true;
@@ -356,7 +369,7 @@ onHide(() => {