排位房间内容完善

This commit is contained in:
kron
2025-06-06 00:34:54 +08:00
parent 79ef6d978d
commit d1dc839e70
6 changed files with 48 additions and 47 deletions

View File

@@ -6,14 +6,10 @@ import BowTarget from "@/components/BowTarget.vue";
import ShootProgress from "@/components/ShootProgress.vue";
import PlayersRow from "@/components/PlayersRow.vue";
import Timer from "@/components/Timer.vue";
import PlayerScore from "@/components/PlayerScore.vue";
import BattleFooter from "@/components/BattleFooter.vue";
import SButton from "@/components/SButton.vue";
import { matchGameAPI, readyGameAPI } from "@/apis";
import { MESSAGETYPES, roundsName } from "@/constants";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
const gameType = ref(0);
const teamSize = ref(0);
const matching = ref(false);
@@ -29,6 +25,12 @@ const currentShooterId = ref(0);
const tips = ref("即将开始...");
const seq = ref(0);
const timerSeq = ref(0);
const roundResults = ref([
// {
// blueArrows: [{ ring: 2 }, { ring: 2 }],
// redArrows: [{ ring: 2 }, { ring: 3 }],
// },
]);
onLoad((options) => {
gameType.value = options.gameType;
@@ -91,14 +93,13 @@ async function onReceiveMessage(content) {
scores.value = [msg.target];
}
if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
const result = msg.preRoundResult;
scores.value = [];
currentShooterId.value = 0;
if (
msg.preRoundResult.currentRound > 0 &&
msg.preRoundResult.currentRound < totalRounds.value
) {
if (result.currentRound > 0 && result.currentRound < totalRounds.value) {
// 开始下一轮;
currentRound.value = msg.preRoundResult.currentRound + 1;
roundResults.value = result.roundResults;
currentRound.value = result.currentRound + 1;
}
}
if (msg.constructor === MESSAGETYPES.MatchOver) {
@@ -136,19 +137,16 @@ onUnmounted(() => {
:totalRound="totalRounds"
:scores="scores"
/>
<!-- <PlayerScore
name="某某选手"
avatar="../static/avatar.png"
:scores="[1, 4, 7, 4, 2, 2, 4, 4, 5, 8]"
/> -->
<BattleFooter
v-if="roundResults.length > 0"
:roundResults="roundResults"
/>
<Timer :seq="timerSeq" :callBack="readyToGo" />
</view>
<view class="footer">
<SButton v-if="!battleId" :onClick="matching ? stopMatch : startMatch">{{
matching ? "取消匹配" : "开始匹配"
}}</SButton>
<SButton v-if="battleId && !start" :onClick="readyToGo">准备完毕</SButton>
</view>
<SButton v-if="!battleId" :onClick="matching ? stopMatch : startMatch">{{
matching ? "取消匹配" : "开始匹配"
}}</SButton>
<SButton v-if="battleId && !start" :onClick="readyToGo">准备完毕</SButton>
</Container>
</template>
@@ -156,7 +154,4 @@ onUnmounted(() => {
.container {
width: 100%;
}
.footer {
margin: 25px 0;
}
</style>