update:优化新手教程

This commit is contained in:
2026-08-27 17:24:25 +08:00
parent b9bbaba77f
commit 469487ba73
12 changed files with 106 additions and 14 deletions
+13 -2
View File
@@ -51,6 +51,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
targetType: {
type: [Number, String],
default: 40,
},
targetRadius: {
type: Number,
default: 20,
@@ -426,12 +430,19 @@ function getExperienceTipStyle(shot) {
);
}
const simulShoot = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
if (device.value.deviceId) {
await simulShootAPI(
device.value.deviceId,
undefined,
undefined,
props.targetType
);
}
};
const simulShoot2 = async () => {
if (device.value.deviceId) {
const r1 = Math.random() > 0.5 ? 0.01 : 0.02;
await simulShootAPI(device.value.deviceId, r1, r1);
await simulShootAPI(device.value.deviceId, r1, r1, props.targetType);
}
};
+12 -1
View File
@@ -29,6 +29,10 @@ const props = defineProps({
type: Number,
default: 15,
},
targetType: {
type: [Number, String],
default: 40,
},
autoStart: {
type: Boolean,
default: false,
@@ -105,7 +109,14 @@ async function onReceiveMessage(msg) {
}
const simulShoot = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
if (device.value.deviceId) {
await simulShootAPI(
device.value.deviceId,
undefined,
undefined,
props.targetType
);
}
};
onMounted(() => {
+4 -2
View File
@@ -114,7 +114,7 @@ const createPractise = async (arrows) => {
const result = await createPractiseAPI(
arrows,
120,
1,
2,
device.value.deviceId
);
if (result) practiseId.value = result.id;
@@ -384,7 +384,7 @@ const getResultTipSrc = (result = {}) => {
<text>请完成以上步骤校准智能弓</text>
</view>
<ShootProgress v-if="step === 5" tips="请开始连续射箭" :start="start" />
<TestDistance v-if="step === 3" :guide="false" />
<TestDistance v-if="step === 3" :guide="false" :targetType="40" />
<view
class="user-row"
v-if="step === 5"
@@ -399,6 +399,8 @@ const getResultTipSrc = (result = {}) => {
:totalRound="step === 5 ? total : 0"
:scores="scores"
:isSvip="isSvip"
:targetType="40"
stable-shot-effect
/>
<ScorePanel
v-if="step === 5"
+6
View File
@@ -29,6 +29,7 @@ const { user, online } = storeToRefs(store);
const title = ref("");
const start = ref(null);
const battleId = ref("");
const targetType = ref(20);
/** 对战模式:1=好友约战 2=排位赛,用于结算页跳转判断 */
const way = ref(0);
const currentRound = ref(1);
@@ -254,6 +255,8 @@ watch(online, (newVal, oldVal) => {
function recoverData(battleInfo, { force = false } = {}) {
battleInfo = normalizeBattleInfo(battleInfo);
if (!battleInfo) return;
const nextTargetType = Number(battleInfo.targetType ?? battleInfo.target_type);
if ([20, 40].includes(nextTargetType)) targetType.value = nextTargetType;
if (battleInfo.status !== undefined) {
battleEnded = [2, 4].includes(Number(battleInfo.status));
}
@@ -374,6 +377,7 @@ function onMatchSocketState(event) {
}
onLoad(async (options) => {
targetType.value = 20;
const returnSnapshot = options.fromReturn ? takeMatchReturnSnapshot() : null;
skipNextRestoreOnShow = false;
if (returnSnapshot?.matchId) battleId.value = returnSnapshot.matchId;
@@ -468,6 +472,7 @@ onShow(() => {
:guide="false"
:isBattle="true"
:count="readyTime"
:targetType="targetType"
/>
<ShootProgress
:show="start"
@@ -490,6 +495,7 @@ onShow(() => {
:totalRound="12"
:scores="playersScores.map((r) => r[user.id]).flat()"
:isSvip="isCurrentUserSvip"
:targetType="targetType"
:stop="halfRest"
stable-shot-effect
/>
+6 -1
View File
@@ -1,5 +1,5 @@
<script setup>
import { ref, nextTick, onMounted, onBeforeUnmount } from "vue";
import { computed, ref, nextTick, onMounted, onBeforeUnmount } from "vue";
import { onHide, onLoad, onShow } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import ShootProgress from "@/components/ShootProgress.vue";
@@ -47,6 +47,9 @@ const serverAddr = ref("");
const showGuide = ref(false);
const tips = ref("");
const targetType = ref(1);
const simulatorTargetType = computed(() =>
[2, 40].includes(Number(targetType.value)) ? 40 : 20
);
const sharing = ref(false);
const exiting = ref(false);
const hiddenWhileActive = ref(false);
@@ -447,6 +450,7 @@ onBeforeUnmount(() => {
<view>
<TestDistance
v-if="!start && !practiseResult.id"
:targetType="simulatorTargetType"
:autoStart="true"
@passed="onReady"
/>
@@ -477,6 +481,7 @@ onBeforeUnmount(() => {
:currentRound="scores.length % 3"
:scores="scores"
:isSvip="isSvip"
:targetType="simulatorTargetType"
stable-shot-effect
/>
<ScorePanel2 :arrows="scores" />
+6 -1
View File
@@ -1,5 +1,5 @@
<script setup>
import { ref, nextTick, onMounted, onBeforeUnmount } from "vue";
import { computed, ref, nextTick, onMounted, onBeforeUnmount } from "vue";
import { onHide, onLoad, onShow } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import ShootProgress from "@/components/ShootProgress.vue";
@@ -46,6 +46,9 @@ const practiseId = ref("");
const serverAddr = ref("");
const showGuide = ref(false);
const targetType = ref(1);
const simulatorTargetType = computed(() =>
[2, 40].includes(Number(targetType.value)) ? 40 : 20
);
const sharing = ref(false);
const exiting = ref(false);
const hiddenWhileActive = ref(false);
@@ -461,6 +464,7 @@ onBeforeUnmount(() => {
<view>
<TestDistance
v-if="!start && !practiseResult.id"
:targetType="simulatorTargetType"
:autoStart="true"
@passed="onReady"
/>
@@ -486,6 +490,7 @@ onBeforeUnmount(() => {
:totalRound="start ? total : 0"
:scores="scores"
:isSvip="isSvip"
:targetType="simulatorTargetType"
/>
<ScorePanel
v-if="start"
+13 -2
View File
@@ -55,6 +55,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
targetType: {
type: [Number, String],
default: 20,
},
targetRadius: {
type: Number,
default: 20,
@@ -422,12 +426,19 @@ function getExperienceTipStyle(shot) {
);
}
const simulShoot = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
if (device.value.deviceId) {
await simulShootAPI(
device.value.deviceId,
undefined,
undefined,
props.targetType
);
}
};
const simulShoot2 = async () => {
if (device.value.deviceId) {
const r1 = Math.random() > 0.5 ? 0.01 : 0.02;
await simulShootAPI(device.value.deviceId, r1, r1);
await simulShootAPI(device.value.deviceId, r1, r1, props.targetType);
}
};
@@ -24,6 +24,10 @@ const props = defineProps({
type: Number,
default: 15,
},
targetType: {
type: [Number, String],
default: 20,
},
});
const arrow = ref({});
const distance = ref(0);
@@ -63,7 +67,14 @@ async function onReceiveMessage(msg) {
}
const simulShoot = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
if (device.value.deviceId) {
await simulShootAPI(
device.value.deviceId,
undefined,
undefined,
props.targetType
);
}
};
onMounted(() => {
+6
View File
@@ -67,6 +67,7 @@ const COUNTDOWN_READY_EVENT = "team-battle-countdown-ready";
const start = ref(null);
const tips = ref("");
const battleId = ref("");
const targetType = ref(20);
const currentRound = ref(0);
const roundTipRound = ref(0);
const goldenRound = ref(0);
@@ -654,6 +655,8 @@ function applyBattleBase(battleInfo) {
battleInfo = normalizeBattleInfo(battleInfo);
if (!battleInfo) return;
if (battleInfo.matchId) battleId.value = battleInfo.matchId;
const nextTargetType = Number(battleInfo.targetType ?? battleInfo.target_type);
if ([20, 40].includes(nextTargetType)) targetType.value = nextTargetType;
if (battleInfo.status !== undefined) {
start.value = battleInfo.status !== 0;
matchStatus.value = battleInfo.status;
@@ -1265,6 +1268,7 @@ onLoad((options) => {
start.value = null;
tips.value = "";
battleId.value = returnSnapshot?.matchId || options.battleId || "";
targetType.value = 20;
currentRound.value = 0;
roundTipRound.value = 0;
goldenRound.value = 0;
@@ -1398,6 +1402,7 @@ onShow(() => {
:guide="false"
:isBattle="true"
:count="readyTime"
:targetType="targetType"
/>
<!-- 比赛进行中显示左右队伍进度条靶面和底部比分 -->
<view v-if="start" class="players-row">
@@ -1423,6 +1428,7 @@ onShow(() => {
:latestShotFlash="latestShotFlash"
:redTeam="redTeam"
:blueTeam="blueTeam"
:targetType="targetType"
stable-shot-effect
/>
<BattleFooter
+13 -2
View File
@@ -56,6 +56,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
targetType: {
type: [Number, String],
default: 40,
},
coordinateRadius: {
type: Number,
default: 20,
@@ -433,12 +437,19 @@ watch(
);
const simulShoot = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
if (device.value.deviceId) {
await simulShootAPI(
device.value.deviceId,
undefined,
undefined,
props.targetType
);
}
};
const simulShoot2 = async () => {
if (device.value.deviceId) {
const r1 = Math.random() > 0.5 ? 0.01 : 0.02;
await simulShootAPI(device.value.deviceId, r1, r1);
await simulShootAPI(device.value.deviceId, r1, r1, props.targetType);
}
};
@@ -109,7 +109,14 @@ async function onReceiveMessage(msg) {
}
const simulShoot = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
if (device.value.deviceId) {
await simulShootAPI(
device.value.deviceId,
undefined,
undefined,
props.targetType
);
}
};
onMounted(() => {
+7 -1
View File
@@ -91,6 +91,11 @@ const tips = ref("");
const targetType = ref(defaultTargetType);
const trainingParams = ref({});
const practiceInfo = ref({});
const simulatorTargetType = computed(() => {
const currentTargetType = Number(practiceInfo.value.targetType);
if ([20, 40].includes(currentTargetType)) return currentTargetType;
return [2, 40].includes(Number(targetType.value)) ? 40 : 20;
});
const rhythmServerTimestamp = ref(0);
const rhythmFallbackWindowStart = ref(0);
const rhythmFallbackTimestamp = ref(0);
@@ -1768,7 +1773,7 @@ onBeforeUnmount(() => {
<view class="practise-content">
<TestDistance
v-if="isDistanceStage"
:targetType="practiceInfo.targetType"
:targetType="simulatorTargetType"
:autoStart="true"
@passed="onReady"
/>
@@ -1809,6 +1814,7 @@ onBeforeUnmount(() => {
:currentRound="scores.length % 3"
:scores="scores"
:isSvip="isSvip"
:targetType="simulatorTargetType"
:shotEffectToken="shotEffectToken"
:showCrosshair="false"
:sectorCount="precisionBlocks"