update:优化个人练习
This commit is contained in:
@@ -16,6 +16,7 @@ import audioManager from "@/audioManager";
|
||||
import {
|
||||
createPractiseAPI,
|
||||
getPractiseAPI,
|
||||
startPractiseAPI,
|
||||
laserAimAPI,
|
||||
laserCloseAPI,
|
||||
} from "@/apis";
|
||||
@@ -134,6 +135,18 @@ const onOver = async (message) => {
|
||||
start.value = false;
|
||||
};
|
||||
|
||||
const beginPractise = async () => {
|
||||
if (!practiseId.value) {
|
||||
uni.showToast({
|
||||
title: "练习未创建,请重试",
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
}
|
||||
await startPractiseAPI(practiseId.value);
|
||||
return true;
|
||||
};
|
||||
|
||||
async function onReceiveMessage(msg) {
|
||||
if (msg.type === MESSAGETYPESV2.ShootResult) {
|
||||
isSvip.value = msg.sVip === true;
|
||||
@@ -229,6 +242,8 @@ const nextStep = async () => {
|
||||
title.value = "-小试牛刀";
|
||||
} else if (step.value === 4) {
|
||||
title.value = "小试牛刀";
|
||||
const result = await beginPractise();
|
||||
if (!result) return;
|
||||
scores.value = [];
|
||||
isSvip.value = false;
|
||||
step.value = 5;
|
||||
|
||||
@@ -16,6 +16,7 @@ import audioManager from "@/audioManager";
|
||||
import {
|
||||
createPractiseAPI,
|
||||
getPractiseAPI,
|
||||
startPractiseAPI,
|
||||
} from "@/apis";
|
||||
import { connectMatchWebSocket, closeMatchWebSocket } from "@/matchWebsocket";
|
||||
import { sharePractiseData } from "@/canvas";
|
||||
@@ -71,7 +72,21 @@ const createPractise = async () => {
|
||||
return result;
|
||||
};
|
||||
|
||||
const beginPractise = async () => {
|
||||
if (!practiseId.value) {
|
||||
uni.showToast({
|
||||
title: "练习未创建,请重试",
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
}
|
||||
await startPractiseAPI(practiseId.value);
|
||||
return true;
|
||||
};
|
||||
|
||||
const onReady = async () => {
|
||||
const result = await beginPractise();
|
||||
if (!result) return;
|
||||
scores.value = [];
|
||||
isSvip.value = false;
|
||||
xRingStreak.value = 0; // 新一局开始,重置 X 环连续计数
|
||||
|
||||
@@ -15,6 +15,7 @@ import audioManager from "@/audioManager";
|
||||
import {
|
||||
createPractiseAPI,
|
||||
getPractiseAPI,
|
||||
startPractiseAPI,
|
||||
} from "@/apis";
|
||||
import { connectMatchWebSocket, closeMatchWebSocket } from "@/matchWebsocket";
|
||||
import { sharePractiseData } from "@/canvas";
|
||||
@@ -70,7 +71,21 @@ const createPractise = async () => {
|
||||
return result;
|
||||
};
|
||||
|
||||
const beginPractise = async () => {
|
||||
if (!practiseId.value) {
|
||||
uni.showToast({
|
||||
title: "练习未创建,请重试",
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
}
|
||||
await startPractiseAPI(practiseId.value);
|
||||
return true;
|
||||
};
|
||||
|
||||
const onReady = async () => {
|
||||
const result = await beginPractise();
|
||||
if (!result) return;
|
||||
scores.value = [];
|
||||
isSvip.value = false;
|
||||
xRingStreak.value = 0; // 新一局开始,重置 X 环连续计数
|
||||
|
||||
Reference in New Issue
Block a user