Commit 14cec8da authored by 李维's avatar 李维

修复最后一题跳转错误的问题

parent 0503c238
......@@ -1687,6 +1687,8 @@
"__id__": 15
},
"_enabled": true,
"setTimeoutIDs": [],
"setIntervalIDs": [],
"_id": "42XWQfk9tE94NY0efe9K5z"
},
{
......
......@@ -448,10 +448,8 @@ cc.Class({
console.log("preloadArr: ", JSON.stringify(preloadArr));
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
// console.log(' preload data, ', data);
// this.loadEnd();
this.addServerListener();
if (window && window["air"]) {
window["air"].hideAirClassLoading();
}
......@@ -550,10 +548,8 @@ cc.Class({
// return;
console.log(" in getState 1");
callMiddleLayerFunction("PSQS_get_course_info", {}, (data) => {
console.log("PSQS_get_course_info",data.first, data.last, data.playTime, JSON.stringify(data.saveData));
this.isFirst = data.first; //this.checkIsFirst();
this.isLast = data.last // this.checkIsLast();
this.playTimes = data.playTime// this.checkPlayTimes();
......@@ -585,7 +581,7 @@ cc.Class({
},
getJumpData() {
return {step: 1};
return {step: 7};
},
maskSpr: null,
......@@ -655,11 +651,11 @@ cc.Class({
resetQuesIndex(jumpTime) {
this.quesIndex = -1;
for (let i = 0; i < this.data.quesArr.length; i++) {
const startTime = this.data.quesArr[i].ques_start;
const endTime = this.data.quesArr[i].ques_end;
const startTime = this.data.quesArr[i].ques_start;
const endTime = this.data.quesArr[i].ques_end;
if (Number(jumpTime) >= Number(startTime) && Number(jumpTime) < Number(endTime)) {
this.quesIndex = i;
// console.log("重定位题号:",this.quesIndex)
// console.log("重定位题号:",this.quesIndex)
}
}
},
......@@ -694,9 +690,8 @@ cc.Class({
addServerListener() {
console.log(" in addServerListener");
const c = window.courseware;
// this.loadEnd(()=>{});
const c = window.courseware;
if (!c) {
return;
}
......@@ -940,7 +935,7 @@ cc.Class({
this.hideMask();
this.video.pause();
this.videoControlBar.emit("update_video_status", 0);
this.videoControlBar.emit("update_video_status", 0);
this.wrongTimes++;
......@@ -1033,13 +1028,13 @@ cc.Class({
},
getCurrentQuesIndexByTime(curretnTime) {
let qIndex = -1;
for(let i=0; i<this.data.quesArr.length; i++) {
if(curretnTime>=Number(this.data.quesArr[i].ques_end)) {
qIndex = i;
}
}
return qIndex;
let qIndex = -1;
for(let i=0; i<this.data.quesArr.length; i++) {
if(curretnTime>=Number(this.data.quesArr[i].ques_end)) {
qIndex = i;
}
}
return qIndex;
},
checkNextQues() {
......@@ -1053,7 +1048,7 @@ cc.Class({
},
startQuesVideo(currentTime = null) {
console.log(" in startQuesVideo");
console.log("in startQuesVideo", currentTime);
this.wrongTimes = 0;
const video = this.video;
......@@ -1073,16 +1068,21 @@ cc.Class({
}
}
// 如果是最后一题
if(this.isTheEndVideo) {
this.curEndTime = -1;
}
delayCall(0.01, () => {
video.play();
this.videoControlBar.emit("update_video_status", 1);
this.videoControlBar.emit("update_video_status", 1);
});
},
isWaitingUserAction: false,
startWaitVideo() {
console.log(" in startWaitVideo ");
this.isWaitingUserAction = true;
console.log("in startWaitVideo");
this.isWaitingUserAction = true;
this.curQues.hotZoneBg.active = true;
this.hand.active = true;
......@@ -1118,8 +1118,8 @@ cc.Class({
},
hideWaitingVideo() {
console.log(" in hiddeWaitVideo ");
this.isWaitingUserAction = false;
console.log(" in hiddeWaitVideo ");
this.isWaitingUserAction = false;
this.curQues.hotZoneBg.active = false;
this.hand.active = false;
},
......@@ -1137,7 +1137,7 @@ cc.Class({
},
startRightVideo() {
console.log(" in startRightVideo ");
console.log("in startRightVideo");
// const videoNode = this.curQues?.videoObj?.right_video;
// const video = videoNode.getComponent(cc.VideoPlayer);
......@@ -1159,7 +1159,7 @@ cc.Class({
},
startWrongVideo() {
console.log(" in startWrongVideo ");
console.log("in startWrongVideo");
// const videoNode = this.curQues?.videoObj?.wrong_video;
// const video = videoNode.getComponent(cc.VideoPlayer);
......@@ -1187,7 +1187,7 @@ cc.Class({
},
startEndVideo() {
console.log(" in startEndVideo ");
console.log("in startEndVideo");
// const videoNode = this.curQues?.videoObj?.end_video;
// const video = videoNode.getComponent(cc.VideoPlayer);
......@@ -1225,12 +1225,13 @@ cc.Class({
},
initCurQues() {
if(this.quesIndex >=0) {
this.curQues = this.data.quesArr[this.quesIndex];
console.log("curQues: ", this.curQues);
} else {
console.log('题目序号不能为负数');
}
if(this.quesIndex >= 0) {
this.curQues = this.data.quesArr[this.quesIndex];
console.log("curQues: ", this.curQues);
} else {
this.curQues = this.data.quesArr[this.data.quesArr.length-1];
console.log('题目序号为负 - 跳转到最后一段音频');
}
},
videoDuration: null,
......@@ -1363,6 +1364,7 @@ cc.Class({
this.startQuesVideo(this.jumpTime);
},
isTheEndVideo: false,
setJumpTime() {
let isFind = false;
for (let i = 0; i < this.data.quesArr.length; i++) {
......@@ -1377,8 +1379,10 @@ cc.Class({
}
if (!isFind) {
// 没有找到就是最后一题
const lastQuesData = this.data.quesArr[this.data.quesArr.length - 1];
this.jumpTime = lastQuesData.ques_end;
this.isTheEndVideo = true;
}
},
......@@ -1386,7 +1390,6 @@ cc.Class({
if (this.playTimes == 0) {
return;
}
switch (this.video.node.name) {
case "ques_video":
this.startWaitVideo();
......@@ -1470,18 +1473,18 @@ cc.Class({
},
updateCheckStop() {
// console.log("检查停止时间", this.curEndTime);
// console.log("检查停止时间", this.curEndTime);
if (!this.video || this.curEndTime == -1) {
return;
}
if (this.video.currentTime >= this.curEndTime) {
this.video.pause();
this.videoControlBar.emit("update_video_status", 0);
this.videoControlBar.emit("update_video_status", 0);
this.video.currentTime = this.curEndTime;
this.curEndTime = -1;
this.curVideoPlayEnd();
// this.videoControlBar.active = false;
// this.videoControlBar.active = false;
}
},
......@@ -1490,31 +1493,31 @@ cc.Class({
return;
}
// 更新当前进度条
if(this.videoDuration== null) {
this.videoControlBar.emit("update_video_progress", 0)
} else {
this.videoControlBar.emit("update_video_progress", this.video.currentTime / this.videoDuration)
}
// 更新当前进度条
if(this.videoDuration== null) {
this.videoControlBar.emit("update_video_progress", 0)
} else {
this.videoControlBar.emit("update_video_progress", this.video.currentTime / this.videoDuration)
}
// 如果没有正在拖动中 检查是否为题目停止
if(!this.isDragProgressBar) {
this.updateCheckStop();
}
// 如果没有正在拖动中 检查是否为题目停止
if(!this.isDragProgressBar) {
this.updateCheckStop();
}
},
// 重置题目相关数据 - 在用户拖动进度条完成以后
restQuesData(curretnTime) {
let userDragTime = curretnTime;
this.resetQuesIndex(userDragTime);
this.initCurQues();
if(this.quesIndex >= 0) {
this.curEndTime = Number(this.curQues.ques_end);
} else {
// 如果没有找到题目索引 则把当前截止时间设置为无穷大
this.curEndTime = -1;
}
this.video.currentTime = userDragTime;
let userDragTime = curretnTime;
this.resetQuesIndex(userDragTime);
this.initCurQues();
if(this.quesIndex >= 0) {
this.curEndTime = Number(this.curQues.ques_end);
} else {
// 如果没有找到题目索引 则把当前截止时间设置为无穷大
this.curEndTime = -1;
}
this.video.currentTime = userDragTime;
},
// 是否正在拖动进度条
......@@ -2924,8 +2927,7 @@ cc.Class({
console.log("clicked");
this.video.pause();
this.videoControlBar.emit("update_video_status", 0);
this.videoControlBar.emit("update_video_status", 0);
this.curQues.isRight = isRight;
if (isRight) {
this.startRightVideo();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment