细节完善

This commit is contained in:
kron
2026-02-10 14:48:07 +08:00
parent b0bf1880e4
commit 88f1ef5d95
8 changed files with 31 additions and 22 deletions

View File

@@ -49,16 +49,16 @@ const props = defineProps({
<view class="desc">
<text>{{ arrows.length }}</text>
<text>支箭</text>
<text>{{ arrows.reduce((a, b) => a + b.ring, 0) }}</text>
<text>{{ arrows.reduce((a, b) => a + (b.ring || 0), 0) }}</text>
<text></text>
</view>
<ScorePanel
:completeEffect="false"
:rowCount="arrows.length === 12 ? 6 : 9"
:rowCount="total === 12 ? 6 : 9"
:total="total"
:arrows="arrows"
:margin="arrows.length === 12 ? 4 : 1"
:fontSize="arrows.length === 12 ? 25 : 22"
:margin="total === 12 ? 4 : 1"
:fontSize="total === 12 ? 25 : 22"
/>
</view>
</template>

View File

@@ -55,11 +55,9 @@ async function onReceiveMessage(message) {
totalShot.value = mode === 1 ? 3 : 2;
currentRoundEnded.value = true;
audioManager.play("比赛开始");
}
if (type === MESSAGETYPESV2.BattleEnd) {
} else if (type === MESSAGETYPESV2.BattleEnd) {
audioManager.play("比赛结束");
}
if (type === MESSAGETYPESV2.ShootResult) {
} else if (type === MESSAGETYPESV2.ShootResult) {
if (melee.value && current.playerId !== user.value.id) return;
if (current.playerId === user.value.id) currentShot.value++;
if (message.shootData) {
@@ -73,11 +71,16 @@ async function onReceiveMessage(message) {
key.push(`${getDirectionText(shootData.angle)}调整`);
audioManager.play(key, false);
}
}
if (type === MESSAGETYPESV2.NewRound) {
} else if (type === MESSAGETYPESV2.NewRound) {
currentShot.value = 0;
currentRound.value = current.round;
currentRoundEnded.value = true;
} else if (type === MESSAGETYPESV2.InvalidShot) {
uni.showToast({
title: "距离不足,无效",
icon: "none",
});
audioManager.pLay("射击无效");
}
}

View File

@@ -62,7 +62,7 @@ const getRing = (arrow) => {
};
const arrows = computed(() => {
const data = new Array(props.total).fill({});
const data = new Array(props.total).fill({ ring: 0 });
(props.result.details || []).forEach((arrow, index) => {
data[index] = arrow;
});
@@ -78,8 +78,8 @@ const validArrows = computed(() => arrows.value.filter((a) => !!a.ring).length);
<image :src="tipSrc" mode="widthFix" />
<image src="../static/finish-frame.png" mode="widthFix" />
<text
>完成<text class="gold-text">{{ validArrows.length }}</text
>获得<text class="gold-text">{{ validArrows.length }}</text
>完成<text class="gold-text">{{ validArrows }}</text
>获得<text class="gold-text">{{ validArrows }}</text
>点经验</text
>
</view>
@@ -165,7 +165,7 @@ const validArrows = computed(() => arrows.value.filter((a) => !!a.ring).length);
</ScreenHint>
<BowData
:total="arrows.length"
:arrows="arrows"
:arrows="result.details"
:show="showBowData"
:onClose="() => (showBowData = false)"
/>

View File

@@ -143,6 +143,12 @@ async function onReceiveMessage(msg) {
} else if (msg.type === MESSAGETYPESV2.HalfRest) {
halfTime.value = true;
audioManager.play("中场休息");
} else if (type === MESSAGETYPESV2.InvalidShot) {
uni.showToast({
title: "距离不足,无效",
icon: "none",
});
audioManager.pLay("射击无效");
}
}

View File

@@ -40,6 +40,7 @@ export const MESSAGETYPESV2 = {
HalfRest: 7,
TestDistance: 8,
MatchSuccess: 9,
InvalidShot: 10,
};
export const topThreeColors = ["#FFD947", "#D2D2D2", "#FFA515"];

View File

@@ -129,7 +129,7 @@ const nextStep = async () => {
btnDisabled.value = true;
step.value = 2;
title.value = "-感知距离";
const result = await createPractiseAPI(total, 360);
const result = await createPractiseAPI(total, 120);
if (result) practiseId.value = result.id;
} else if (step.value === 2) {
showGuide.value = false;
@@ -166,7 +166,7 @@ const onClose = async () => {
start.value = false;
scores.value = [];
step.value = 3;
const result = await createPractiseAPI(total, 360);
const result = await createPractiseAPI(total, 120);
if (result) practiseId.value = result.id;
}
};

View File

@@ -14,11 +14,10 @@ const arrows = ref([]);
const total = ref(0);
onLoad(async (options) => {
if (options.id) {
const result = await getPractiseAPI(options.id);
if (!options.id) return;
const result = await getPractiseAPI(options.id || 176);
arrows.value = result.details;
total.value = result.details.length;
}
});
</script>

View File

@@ -70,7 +70,7 @@ async function onComplete() {
start.value = false;
scores.value = [];
currentRound.value = 0;
const result = await createPractiseAPI(total, 360);
const result = await createPractiseAPI(total, 120);
if (result) practiseId.value = result.id;
}
}