流程完善

This commit is contained in:
kron
2025-07-15 17:10:41 +08:00
parent 95426ffd07
commit 0edf259fb0
7 changed files with 76 additions and 31 deletions

View File

@@ -42,6 +42,7 @@ defineProps({
>
<Avatar
:src="player.avatar"
:rankLvl="player.rankLvl"
:size="40"
:rank="showRank ? index + 1 : 0"
/>

View File

@@ -17,14 +17,16 @@ const seats = new Array(props.total).fill(1);
<view v-for="(_, index) in seats" :key="index">
<image src="../static/player-bg.png" mode="widthFix" />
<image
v-if="players[index]"
v-if="players[index] && players[index].name"
:src="players[index].avatar || '../static/user-icon.png'"
mode="widthFix"
/>
<view v-else class="player-unknow">
<image src="../static/question-mark.png" mode="widthFix" />
</view>
<text v-if="players[index]">{{ players[index].name }}</text>
<text v-if="players[index] && players[index].name">{{
players[index].name
}}</text>
<text v-else :style="{ color: '#fff9' }">虚位以待</text>
<view v-if="index === 0" class="founder">创建者</view>
<image

View File

@@ -2,6 +2,10 @@
import { ref, watch, onMounted, onUnmounted } from "vue";
import audioManager from "@/audioManager";
import { MESSAGETYPES } from "@/constants";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
const props = defineProps({
start: {
type: Boolean,
@@ -27,6 +31,10 @@ const props = defineProps({
type: String,
default: "",
},
melee: {
type: Boolean,
default: false,
},
});
const barColor = ref("#fed847");
@@ -36,6 +44,7 @@ const sound = ref(true);
const currentSound = ref("");
const currentRound = ref(props.currentRound);
const currentRoundEnded = ref(!props.battleId);
const halfTimeTip = ref(false);
watch(
() => props.tips,
@@ -125,6 +134,7 @@ async function onReceiveMessage(messages = []) {
(props.battleId && msg.constructor === MESSAGETYPES.ShootResult) ||
(!props.battleId && msg.constructor === MESSAGETYPES.ShootSyncMeArrowID)
) {
if (props.melee && msg.userId !== user.value.id) return;
if (msg.target) {
currentSound.value = msg.target.ring
? `${msg.target.ring}`
@@ -134,10 +144,11 @@ async function onReceiveMessage(messages = []) {
} else if (msg.constructor === MESSAGETYPES.AllReady) {
audioManager.play("比赛开始");
} else if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
audioManager.play("比赛开始");
if (!halfTimeTip.value) audioManager.play("比赛开始");
} else if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
currentRoundEnded.value = true;
} else if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
halfTimeTip.value = true;
audioManager.play("中场休息");
} else if (msg.constructor === MESSAGETYPES.MatchOver) {
audioManager.play("比赛结束");