靶子组件优化

This commit is contained in:
kron
2025-07-16 09:33:33 +08:00
parent 9db88fb945
commit d5bc1a6a89
13 changed files with 38 additions and 108 deletions

View File

@@ -321,8 +321,6 @@ async function onReceiveMessage(messages = []) {
if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
if (room.value.battleType === 1) {
if (currentShooterId.value !== msg.userId) {
scores.value = [];
blueScores.value = [];
seq.value += 1;
currentShooterId.value = msg.userId;
if (redTeam.value[0].id === currentShooterId.value) {
@@ -341,8 +339,8 @@ async function onReceiveMessage(messages = []) {
if (msg.constructor === MESSAGETYPES.ShootResult) {
if (room.value.battleType === 1) {
const isRed = redTeam.value.find((item) => item.id === msg.userId);
if (isRed) scores.value = [msg.target];
else blueScores.value = [msg.target];
if (isRed) scores.value.push(msg.target);
else blueScores.value.push(msg.target);
if (roundResults.value[currentRound.value - 1]) {
if (isRed && roundResults.value[currentRound.value - 1].redArrows) {
roundResults.value[currentRound.value - 1].redArrows.push(
@@ -551,7 +549,6 @@ onUnmounted(() => {
/>
<BowTarget
:mode="room.battleType ? 'team' : 'solo'"
:showE="start && user.id === currentShooterId"
:power="start ? power : 0"
:currentRound="currentRound"
:totalRound="totalRounds"

View File

@@ -239,7 +239,6 @@ const onClose = () => {
</view>
<BowTarget
v-if="step === 4"
:start="start"
:currentRound="step === 4 ? scores.length : 0"
:totalRound="step === 4 ? total : 0"
:scores="scores"

View File

@@ -54,7 +54,7 @@ onLoad(async (options) => {
</view>
</view>
<view :style="{ marginTop: '10px' }">
<BowTarget :scores="scores" :showLatestArrow="false" />
<BowTarget :scores="scores" />
</view>
<view class="score-text"
><text :style="{ color: '#fed847' }">{{ scores.length }}</text

View File

@@ -207,7 +207,6 @@ onUnmounted(() => {
</view>
<BowTarget
v-if="start"
:showE="start"
:currentRound="scores.length"
:totalRound="start ? 12 : 0"
:scores="scores"

View File

@@ -33,7 +33,7 @@ onLoad(async (options) => {
</view>
</view> -->
<view :style="{ marginBottom: '20px' }">
<BowTarget :scores="arrows" :showLatestArrow="false" />
<BowTarget :scores="arrows" />
</view>
<view class="desc">
<text>{{ arrows.length }}</text>

View File

@@ -123,7 +123,6 @@ onUnmounted(() => {
<BowPower :power="power" />
</view>
<BowTarget
:start="start"
:totalRound="start ? total / 4 : 0"
:currentRound="currentRound"
:scores="scores"

View File

@@ -117,7 +117,6 @@ onUnmounted(() => {
<BowPower :power="power" />
</view>
<BowTarget
:start="start"
:currentRound="scores.length"
:totalRound="start ? total : 0"
:scores="scores"

View File

@@ -98,11 +98,7 @@ const onClickTab = (index) => {
</view>
</view>
<view :style="{ margin: '20px 0' }">
<BowTarget
:scores="redScores"
:blueScores="blueScores"
:showLatestArrow="false"
/>
<BowTarget :scores="redScores" :blueScores="blueScores" />
</view>
<view class="score-row" v-for="(player, index) in players" :key="index">
<Avatar

View File

@@ -140,8 +140,6 @@ async function onReceiveMessage(messages = []) {
}
if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
if (currentShooterId.value !== msg.userId) {
scores.value = [];
blueScores.value = [];
seq.value += 1;
currentShooterId.value = msg.userId;
if (redTeam.value[0].id === currentShooterId.value) {
@@ -158,8 +156,8 @@ async function onReceiveMessage(messages = []) {
}
if (msg.constructor === MESSAGETYPES.ShootResult) {
const isRed = redTeam.value.find((item) => item.id === msg.userId);
if (isRed) scores.value = [msg.target];
else blueScores.value = [msg.target];
if (isRed) scores.value.push(msg.target);
else blueScores.value.push(msg.target);
if (roundResults.value[currentRound.value - 1]) {
if (isRed && roundResults.value[currentRound.value - 1].redArrows) {
roundResults.value[currentRound.value - 1].redArrows.push(msg.target);
@@ -266,7 +264,6 @@ onUnmounted(() => {
<BowTarget
v-if="start"
mode="team"
:showE="start && user.id === currentShooterId"
:power="start ? power : 0"
:currentRound="currentRound"
:totalRound="totalRounds"