diff --git a/src/components/BattleFooter.vue b/src/components/BattleFooter.vue
index 716437a..7927b69 100644
--- a/src/components/BattleFooter.vue
+++ b/src/components/BattleFooter.vue
@@ -57,6 +57,7 @@ defineProps({
.container {
width: 100%;
margin-top: 20px;
+ overflow: hidden;
}
.container > view:first-child {
position: relative;
diff --git a/src/components/BowTarget.vue b/src/components/BowTarget.vue
index 9446174..80d9ed7 100644
--- a/src/components/BowTarget.vue
+++ b/src/components/BowTarget.vue
@@ -49,10 +49,6 @@ const props = defineProps({
type: Boolean,
default: true,
},
- start: {
- type: Boolean,
- default: false,
- },
mode: {
type: String,
default: "solo", // solo 单排,team 双排
@@ -201,7 +197,6 @@ const simulShoot = async () => {
.container {
width: calc(100% - 30px);
padding: 15px;
- /* overflow: hidden; */
position: relative;
}
.target {
diff --git a/src/constants.js b/src/constants.js
index 05b3e7d..8e79a5e 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -10,6 +10,7 @@ export const MESSAGETYPES = {
SomeGuyIsReady: parseInt("0xAEE8C236"), // 2934489654
MatchOver: parseInt("0xB7815EEF"), // 3078708975
StartCount: parseInt("0xD7B0DD2F"), // 3618692399
+ FinalShoot: parseInt("0x5953C8A1"), // 1498663073
RoundPoint: 4061248646,
UserEnterRoom: 2133805521,
UserExitRoom: 3896523333,
diff --git a/src/pages/battle-room.vue b/src/pages/battle-room.vue
index 9085b71..b47245c 100644
--- a/src/pages/battle-room.vue
+++ b/src/pages/battle-room.vue
@@ -35,8 +35,10 @@ const players = ref([]);
const currentRound = ref(1);
const totalRounds = ref(0);
const start = ref(false);
+const startCount = ref(false);
const power = ref(0);
const scores = ref([]);
+const blueScores = ref([]);
const tips = ref("即将开始...");
const roundResults = ref([]);
const redPoints = ref(0);
@@ -46,6 +48,9 @@ const currentBluePoint = ref(0);
const showRoundTip = ref(false);
const playersScores = ref({});
const showModal = ref(false);
+const halfTimeTip = ref(false);
+const total = ref(90);
+
onLoad(async (options) => {
if (options.roomNumber) {
roomNumber.value = options.roomNumber;
@@ -63,6 +68,7 @@ onLoad(async (options) => {
return false;
});
if (result.battleType === 1) {
+ total.value = 15;
if (user.value.id !== owner.value.id) {
opponent.value = {
id: user.value.id,
@@ -159,7 +165,7 @@ async function onReceiveMessage(messages = []) {
players.value = players.value.filter((p) => p.id !== msg.userId);
}
}
- if (msg.constructor === MESSAGETYPES.RoomDestroy) {
+ if (msg.constructor === MESSAGETYPES.RoomDestroy && !battleId.value) {
uni.showToast({
title: "房间已解散",
icon: "none",
@@ -182,12 +188,21 @@ async function onReceiveMessage(messages = []) {
seq.value += 1;
}
}
+ if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
+ start.value = true;
+ startCount.value = true;
+ seq.value += 1;
+ timerSeq.value = 0;
+ tips.value = "请连续射出6支箭";
+ scores.value = [];
+ }
if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
if (room.value.battleType === 1) {
scores.value = [];
+ blueScores.value = [];
seq.value += 1;
currentShooterId.value = msg.userId;
- if (owner.id !== currentShooterId.value) {
+ if (redTeam.value[0].id === currentShooterId.value) {
tips.value = `请红队射箭-第${roundsName[currentRound.value]}轮`;
} else {
tips.value = `请蓝队射箭-第${roundsName[currentRound.value]}轮`;
@@ -196,7 +211,12 @@ async function onReceiveMessage(messages = []) {
}
if (msg.constructor === MESSAGETYPES.ShootResult) {
if (room.value.battleType === 1) {
- 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 (room.value.battleType === 2) {
scores.value.push(msg.target);
@@ -205,26 +225,32 @@ async function onReceiveMessage(messages = []) {
if (playersScores.value[msg.userId])
playersScores.value[msg.userId].push(msg.target);
}
- if (msg.constructor === MESSAGETYPES.RoundPoint) {
- bluePoints.value += msg.blueScore;
- redPoints.value += msg.redScore;
- }
if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
- const result = msg.preRoundResult;
- scores.value = [];
- currentShooterId.value = 0;
- currentBluePoint.value = result.blueScore;
- currentRedPoint.value = result.redScore;
- showRoundTip.value = true;
- if (
- result.currentRound > 0 &&
- result.currentRound < totalRounds.value
- ) {
- // 开始下一轮;
- roundResults.value = result.roundResults;
- currentRound.value = result.currentRound + 1;
+ if (room.value.battleType === 1) {
+ const result = msg.preRoundResult;
+ scores.value = [];
+ blueScores.value = [];
+ currentShooterId.value = 0;
+ currentBluePoint.value = result.blueScore;
+ currentRedPoint.value = result.redScore;
+ bluePoints.value += result.blueScore;
+ redPoints.value += result.redScore;
+ showRoundTip.value = true;
+ if (
+ result.currentRound > 0 &&
+ result.currentRound < totalRounds.value
+ ) {
+ // 开始下一轮;
+ roundResults.value = result.roundResults;
+ currentRound.value = result.currentRound + 1;
+ }
}
}
+ if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
+ startCount.value = false;
+ halfTimeTip.value = true;
+ tips.value = "准备下半场";
+ }
if (msg.constructor === MESSAGETYPES.MatchOver) {
uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}&winner=${msg.endStatus.winner}`,
@@ -341,7 +367,12 @@ onUnmounted(() => {
/>
-
+
{
:currentShooterId="currentShooterId"
/>
{
+
+
+ 上半场结束,休息一下吧:)
+ 20秒后开始下半场
+
+
diff --git a/src/pages/melee-match.vue b/src/pages/melee-match.vue
index eb1c089..3d81f93 100644
--- a/src/pages/melee-match.vue
+++ b/src/pages/melee-match.vue
@@ -151,15 +151,17 @@ onUnmounted(() => {
:totalRound="start ? 12 : 0"
:scores="scores"
/>
-
+
+
+