细节完善
This commit is contained in:
@@ -49,16 +49,16 @@ const props = defineProps({
|
|||||||
<view class="desc">
|
<view class="desc">
|
||||||
<text>{{ arrows.length }}</text>
|
<text>{{ arrows.length }}</text>
|
||||||
<text>支箭,共</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>
|
<text>环</text>
|
||||||
</view>
|
</view>
|
||||||
<ScorePanel
|
<ScorePanel
|
||||||
:completeEffect="false"
|
:completeEffect="false"
|
||||||
:rowCount="arrows.length === 12 ? 6 : 9"
|
:rowCount="total === 12 ? 6 : 9"
|
||||||
:total="total"
|
:total="total"
|
||||||
:arrows="arrows"
|
:arrows="arrows"
|
||||||
:margin="arrows.length === 12 ? 4 : 1"
|
:margin="total === 12 ? 4 : 1"
|
||||||
:fontSize="arrows.length === 12 ? 25 : 22"
|
:fontSize="total === 12 ? 25 : 22"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -55,11 +55,9 @@ async function onReceiveMessage(message) {
|
|||||||
totalShot.value = mode === 1 ? 3 : 2;
|
totalShot.value = mode === 1 ? 3 : 2;
|
||||||
currentRoundEnded.value = true;
|
currentRoundEnded.value = true;
|
||||||
audioManager.play("比赛开始");
|
audioManager.play("比赛开始");
|
||||||
}
|
} else if (type === MESSAGETYPESV2.BattleEnd) {
|
||||||
if (type === MESSAGETYPESV2.BattleEnd) {
|
|
||||||
audioManager.play("比赛结束");
|
audioManager.play("比赛结束");
|
||||||
}
|
} else if (type === MESSAGETYPESV2.ShootResult) {
|
||||||
if (type === MESSAGETYPESV2.ShootResult) {
|
|
||||||
if (melee.value && current.playerId !== user.value.id) return;
|
if (melee.value && current.playerId !== user.value.id) return;
|
||||||
if (current.playerId === user.value.id) currentShot.value++;
|
if (current.playerId === user.value.id) currentShot.value++;
|
||||||
if (message.shootData) {
|
if (message.shootData) {
|
||||||
@@ -73,11 +71,16 @@ async function onReceiveMessage(message) {
|
|||||||
key.push(`向${getDirectionText(shootData.angle)}调整`);
|
key.push(`向${getDirectionText(shootData.angle)}调整`);
|
||||||
audioManager.play(key, false);
|
audioManager.play(key, false);
|
||||||
}
|
}
|
||||||
}
|
} else if (type === MESSAGETYPESV2.NewRound) {
|
||||||
if (type === MESSAGETYPESV2.NewRound) {
|
|
||||||
currentShot.value = 0;
|
currentShot.value = 0;
|
||||||
currentRound.value = current.round;
|
currentRound.value = current.round;
|
||||||
currentRoundEnded.value = true;
|
currentRoundEnded.value = true;
|
||||||
|
} else if (type === MESSAGETYPESV2.InvalidShot) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "距离不足,无效",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
audioManager.pLay("射击无效");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ const getRing = (arrow) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const arrows = computed(() => {
|
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) => {
|
(props.result.details || []).forEach((arrow, index) => {
|
||||||
data[index] = arrow;
|
data[index] = arrow;
|
||||||
});
|
});
|
||||||
@@ -78,8 +78,8 @@ const validArrows = computed(() => arrows.value.filter((a) => !!a.ring).length);
|
|||||||
<image :src="tipSrc" mode="widthFix" />
|
<image :src="tipSrc" mode="widthFix" />
|
||||||
<image src="../static/finish-frame.png" mode="widthFix" />
|
<image src="../static/finish-frame.png" mode="widthFix" />
|
||||||
<text
|
<text
|
||||||
>完成<text class="gold-text">{{ validArrows.length }}</text
|
>完成<text class="gold-text">{{ validArrows }}</text
|
||||||
>箭,获得<text class="gold-text">{{ validArrows.length }}</text
|
>箭,获得<text class="gold-text">{{ validArrows }}</text
|
||||||
>点经验</text
|
>点经验</text
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
@@ -165,7 +165,7 @@ const validArrows = computed(() => arrows.value.filter((a) => !!a.ring).length);
|
|||||||
</ScreenHint>
|
</ScreenHint>
|
||||||
<BowData
|
<BowData
|
||||||
:total="arrows.length"
|
:total="arrows.length"
|
||||||
:arrows="arrows"
|
:arrows="result.details"
|
||||||
:show="showBowData"
|
:show="showBowData"
|
||||||
:onClose="() => (showBowData = false)"
|
:onClose="() => (showBowData = false)"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -143,6 +143,12 @@ async function onReceiveMessage(msg) {
|
|||||||
} else if (msg.type === MESSAGETYPESV2.HalfRest) {
|
} else if (msg.type === MESSAGETYPESV2.HalfRest) {
|
||||||
halfTime.value = true;
|
halfTime.value = true;
|
||||||
audioManager.play("中场休息");
|
audioManager.play("中场休息");
|
||||||
|
} else if (type === MESSAGETYPESV2.InvalidShot) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "距离不足,无效",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
audioManager.pLay("射击无效");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export const MESSAGETYPESV2 = {
|
|||||||
HalfRest: 7,
|
HalfRest: 7,
|
||||||
TestDistance: 8,
|
TestDistance: 8,
|
||||||
MatchSuccess: 9,
|
MatchSuccess: 9,
|
||||||
|
InvalidShot: 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const topThreeColors = ["#FFD947", "#D2D2D2", "#FFA515"];
|
export const topThreeColors = ["#FFD947", "#D2D2D2", "#FFA515"];
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ const nextStep = async () => {
|
|||||||
btnDisabled.value = true;
|
btnDisabled.value = true;
|
||||||
step.value = 2;
|
step.value = 2;
|
||||||
title.value = "-感知距离";
|
title.value = "-感知距离";
|
||||||
const result = await createPractiseAPI(total, 360);
|
const result = await createPractiseAPI(total, 120);
|
||||||
if (result) practiseId.value = result.id;
|
if (result) practiseId.value = result.id;
|
||||||
} else if (step.value === 2) {
|
} else if (step.value === 2) {
|
||||||
showGuide.value = false;
|
showGuide.value = false;
|
||||||
@@ -166,7 +166,7 @@ const onClose = async () => {
|
|||||||
start.value = false;
|
start.value = false;
|
||||||
scores.value = [];
|
scores.value = [];
|
||||||
step.value = 3;
|
step.value = 3;
|
||||||
const result = await createPractiseAPI(total, 360);
|
const result = await createPractiseAPI(total, 120);
|
||||||
if (result) practiseId.value = result.id;
|
if (result) practiseId.value = result.id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,11 +14,10 @@ const arrows = ref([]);
|
|||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
|
|
||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
if (options.id) {
|
if (!options.id) return;
|
||||||
const result = await getPractiseAPI(options.id);
|
const result = await getPractiseAPI(options.id || 176);
|
||||||
arrows.value = result.details;
|
arrows.value = result.details;
|
||||||
total.value = result.details.length;
|
total.value = result.details.length;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ async function onComplete() {
|
|||||||
start.value = false;
|
start.value = false;
|
||||||
scores.value = [];
|
scores.value = [];
|
||||||
currentRound.value = 0;
|
currentRound.value = 0;
|
||||||
const result = await createPractiseAPI(total, 360);
|
const result = await createPractiseAPI(total, 120);
|
||||||
if (result) practiseId.value = result.id;
|
if (result) practiseId.value = result.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user