弓箭动画调整

This commit is contained in:
kron
2025-06-17 16:02:29 +08:00
parent a74fd1e744
commit 67825d2b24
7 changed files with 49 additions and 21 deletions

View File

@@ -9,8 +9,9 @@ import BattleHeader from "@/components/BattleHeader.vue";
import Timer from "@/components/Timer.vue";
import PlayerScore from "@/components/PlayerScore.vue";
import SButton from "@/components/SButton.vue";
import Avatar from "@/components/Avatar.vue";
import { matchGameAPI, readyGameAPI } from "@/apis";
import { MESSAGETYPES } from "@/constants";
import { MESSAGETYPES, getMessageTypeName } from "@/constants";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
@@ -62,7 +63,7 @@ async function onReceiveMessage(content) {
(battleId.value && msg.id === battleId.value) ||
msg.constructor === MESSAGETYPES.WaitForAllReady
) {
console.log("收到消息:", msg);
console.log("收到消息:", getMessageTypeName(msg.constructor), msg);
}
if (msg.constructor === MESSAGETYPES.WaitForAllReady) {
// 这里会掉多次;
@@ -82,11 +83,10 @@ async function onReceiveMessage(content) {
}
if (msg.id !== battleId.value) return;
if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
totalRounds.value = msg.groupUserStatus.config.maxRounds;
start.value = true;
seq.value += 1;
timerSeq.value = 0;
tips.value = "请在90秒内射完12支箭";
tips.value = "请连续射出6支箭";
scores.value = [];
}
if (msg.constructor === MESSAGETYPES.ShootResult) {
@@ -98,7 +98,7 @@ async function onReceiveMessage(content) {
}
if (msg.constructor === MESSAGETYPES.MatchOver) {
uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}&winner=${msg.endStatus.winner}&gameType=${gameType.value}`,
url: `/pages/battle-result?battleId=${msg.id}`,
});
}
});
@@ -128,11 +128,13 @@ onUnmounted(() => {
</view>
</Guide>
<ShootProgress v-if="start" :seq="seq" :start="start" :tips="tips" />
<view class="infos">
<Avatar :src="user.avatar" :size="35" />
<BowPower :power="power" />
</view>
<BowTarget
:avatar="user.avatar"
:power="power"
:currentRound="currentRound"
:totalRound="totalRounds"
:currentRound="scores.length"
:totalRound="12"
:scores="scores"
/>
<PlayerScore
@@ -158,4 +160,11 @@ onUnmounted(() => {
.container {
width: 100%;
}
.infos {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 15px;
padding-top: 15px;
}
</style>