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