diff --git a/src/apis.js b/src/apis.js
index c15c594..d0eb2fb 100644
--- a/src/apis.js
+++ b/src/apis.js
@@ -152,8 +152,6 @@ export const getGameAPI = async (battleId) => {
};
if (battleStats.mode === 1) {
data.winner = battleStats.winner;
- data.redTotal = battleStats.redTotal;
- data.blueTotal = battleStats.blueTotal;
data.roundsData = {};
data.redPlayers = {};
data.bluePlayers = {};
diff --git a/src/components/BowTarget.vue b/src/components/BowTarget.vue
index 7982223..9446174 100644
--- a/src/components/BowTarget.vue
+++ b/src/components/BowTarget.vue
@@ -53,6 +53,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
+ mode: {
+ type: String,
+ default: "solo", // solo 单排,team 双排
+ },
});
const showRoundTips = ref(false);
@@ -89,6 +93,23 @@ watch(
}
);
+watch(
+ () => props.blueScores,
+ (newVal) => {
+ if (newVal.length - prevLength.value === 1) {
+ if (timer.value) clearTimeout(timer.value);
+ showRoundTips.value = true;
+ timer.value = setTimeout(() => {
+ showRoundTips.value = false;
+ }, 1000);
+ }
+ prevLength.value = newVal.length;
+ },
+ {
+ deep: true,
+ }
+);
+
function calcRealX(num) {
const len = 20 + num;
return `calc(${(len / 40) * 100}% - 10px)`;
@@ -124,16 +145,24 @@ const simulShoot = async () => {
class="round-tip fade-in"
>{{ scores[scores.length - 1].ring }}环
+ {{ blueScores[blueScores.length - 1].ring }}环
{
v-if="bow.ring > 0"
src="../static/hit-icon-blue.png"
class="hit"
+ :class="`hit ${blueScores.length === 1 ? 'pump-in' : ''}`"
:style="{
left: calcRealX(bow.x),
top: calcRealY(bow.y),
diff --git a/src/components/Matching.vue b/src/components/Matching.vue
index 3ed1ac3..4d67aae 100644
--- a/src/components/Matching.vue
+++ b/src/components/Matching.vue
@@ -75,7 +75,7 @@ watch(
clearInterval(timer.value);
setTimeout(() => {
newVal();
- }, 1000);
+ }, 2000);
} else {
totalTop.value += 0.5;
}
@@ -117,7 +117,7 @@ onUnmounted(() => {
v-for="(name, index) in playerNames"
:key="index"
:style="{
- lineHeight: `${98 / 7}vw`,
+ lineHeight: `${95 / 7}vw`,
...(textStyles[index] || {}),
}"
>
@@ -129,7 +129,7 @@ onUnmounted(() => {
v-for="(name, index) in playerNames"
:key="index"
:style="{
- lineHeight: `${98 / 7}vw`,
+ lineHeight: `${95 / 7}vw`,
...(textStyles[index + 7] || {}),
}"
>
@@ -153,20 +153,19 @@ onUnmounted(() => {
}
.matching > view {
width: 70vw;
- height: 98vw;
+ height: 95vw;
overflow: hidden;
position: relative;
- transform: translateY(3vw);
}
.matching-bg {
position: absolute;
width: 70vw;
height: 102vw;
- top: 30vw;
+ top: 27vw;
}
.matching > button {
width: 55%;
- margin-top: 20vw;
+ margin-top: 15vw;
padding: 18px;
color: #000;
background-color: #fed847;
@@ -175,12 +174,11 @@ onUnmounted(() => {
}
.player-names {
width: 100%;
- height: 98vw;
+ height: 95vw;
display: flex;
flex-direction: column;
position: absolute;
top: 0;
- transform: translateY(3vw);
}
.player-names > text {
width: 100%;
diff --git a/src/pages/battle-result.vue b/src/pages/battle-result.vue
index 9cbeb77..ae9e79c 100644
--- a/src/pages/battle-result.vue
+++ b/src/pages/battle-result.vue
@@ -18,16 +18,16 @@ const totalPoints = ref(0);
onLoad(async (options) => {
battleId.value = options.battleId;
const result = await getGameAPI(
- // options.battleId || "BATTLE-1750688685843436271-553"
- options.battleId || "BATTLE-1750688536849458226-518"
+ options.battleId || "BATTLE-1750867490990424058-718"
+ // options.battleId || "BATTLE-1750688536849458226-518"
);
data.value = result;
if (result.mode === 1 && result.redPlayers[user.value.id]) {
- totalPoints.value = result.redTotal;
+ totalPoints.value = result.redPlayers[user.value.id].totalScore;
ifWin.value = result.winner === 0;
}
if (result.mode === 1 && result.bluePlayers[user.value.id]) {
- totalPoints.value = result.redTotal;
+ totalPoints.value = result.bluePlayers[user.value.id].totalScore;
ifWin.value = result.winner === 1;
}
if (result.mode === 2) {
@@ -72,7 +72,7 @@ const topThreeColors = ["#FFD947 ", "#D2D2D2", "#FFA515"];
- {{ ifWin && data.winner === 1 ? "蓝队" : "红队" }}获胜
+ {{ data.winner === 1 ? "蓝队" : "红队" }}获胜
强势登顶,荣耀加冕
@@ -145,8 +145,12 @@ const topThreeColors = ["#FFD947 ", "#D2D2D2", "#FFA515"];
- 经验 +{{ totalPoints }}
- 积分 +{{ totalPoints }}
+ 经验 {{ totalPoints > 0 ? "+" + totalPoints : totalPoints }}
+ 积分 {{ totalPoints > 0 ? "+" + totalPoints : totalPoints }}
你是朋友中的佼佼者哦
p.id !== msg.userId);
diff --git a/src/pages/team-match.vue b/src/pages/team-match.vue
index b03ae29..766a308 100644
--- a/src/pages/team-match.vue
+++ b/src/pages/team-match.vue
@@ -28,6 +28,7 @@ const currentBluePoint = ref(0);
const totalRounds = ref(0);
const power = ref(0);
const scores = ref([]);
+const blueScores = ref([]);
const redTeam = ref([]);
const blueTeam = ref([]);
const currentShooterId = ref(0);
@@ -89,6 +90,7 @@ async function onReceiveMessage(messages = []) {
}
if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
scores.value = [];
+ blueScores.value = [];
seq.value += 1;
currentShooterId.value = msg.userId;
if (redTeam.value[0].id === currentShooterId.value) {
@@ -98,11 +100,16 @@ async function onReceiveMessage(messages = []) {
}
}
if (msg.constructor === MESSAGETYPES.ShootResult) {
- scores.value = [msg.target];
+ const isRed = redTeam.value.find((item) => item.id === msg.userId);
+ if (isRed) {
+ scores.value = [msg.target];
+ } else {
+ blueScores.value = [msg.target];
+ }
}
if (msg.constructor === MESSAGETYPES.RoundPoint) {
- bluePoints.value += msg.blueScore;
- redPoints.value += msg.redScore;
+ // bluePoints.value += msg.blueScore;
+ // redPoints.value += msg.redScore;
}
if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
const result = msg.preRoundResult;
@@ -110,6 +117,8 @@ async function onReceiveMessage(messages = []) {
currentShooterId.value = 0;
currentBluePoint.value = result.blueScore;
currentRedPoint.value = result.redScore;
+ bluePoints.value += result.blueScore;
+ redPoints.value += result.redScore;
showRoundTip.value = true;
// 开始下一轮;
roundResults.value = result.roundResults;
@@ -159,11 +168,13 @@ onUnmounted(() => {
:redTeam="redTeam"
/>