Commit a1aa324b authored by limingzhe's avatar limingzhe

fix: 拖拽异常

parent 81415e7d
{"ver":"1.1.2","uuid":"1689616d-6621-4fdf-87ec-126ceba30dc8","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}} {
\ No newline at end of file "ver": "1.1.2",
"uuid": "1689616d-6621-4fdf-87ec-126ceba30dc8",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
...@@ -5,9 +5,9 @@ function RemoteResourceCounter(count, cb) { ...@@ -5,9 +5,9 @@ function RemoteResourceCounter(count, cb) {
this.currentLoadedResourceCount = 0; this.currentLoadedResourceCount = 0;
this.finishCallback = cb; this.finishCallback = cb;
} }
RemoteResourceCounter.prototype.load = function(num) { RemoteResourceCounter.prototype.load = function (num) {
this.currentLoadedResourceCount += num; this.currentLoadedResourceCount += num;
console.log('RemoteResourceCounter', this.remoteResourceCount , this.currentLoadedResourceCount); console.log('RemoteResourceCounter', this.remoteResourceCount, this.currentLoadedResourceCount);
if (this.remoteResourceCount <= this.currentLoadedResourceCount) { if (this.remoteResourceCount <= this.currentLoadedResourceCount) {
this.finishCallback && this.finishCallback(); this.finishCallback && this.finishCallback();
} }
...@@ -115,9 +115,9 @@ cc.Class({ ...@@ -115,9 +115,9 @@ cc.Class({
}, },
onDestroy() { onDestroy() {
this.isPlayMusicAnimation = false; this.isPlayMusicAnimation = false;
cc.audioEngine.stop(this.beginAudioID ); cc.audioEngine.stop(this.beginAudioID);
cc.audioEngine.stop(this.finishAudioID ); cc.audioEngine.stop(this.finishAudioID);
cc.audioEngine.stop(this.hintAudioID ); cc.audioEngine.stop(this.hintAudioID);
this.isDestroy = true; this.isDestroy = true;
if (this.hideControlId) { if (this.hideControlId) {
clearTimeout(this.hideControlId); clearTimeout(this.hideControlId);
...@@ -233,7 +233,7 @@ cc.Class({ ...@@ -233,7 +233,7 @@ cc.Class({
} }
}, },
playMusicAnimation(){ playMusicAnimation() {
this.isPlayMusicAnimation = true; this.isPlayMusicAnimation = true;
const op1 = this.m1.node.position const op1 = this.m1.node.position
const op2 = this.m2.node.position const op2 = this.m2.node.position
...@@ -259,7 +259,7 @@ cc.Class({ ...@@ -259,7 +259,7 @@ cc.Class({
fn(this.m1.node, op1); fn(this.m1.node, op1);
fn(this.m2.node, op2); fn(this.m2.node, op2);
}, },
stopMusicAnimation(){ stopMusicAnimation() {
this.isPlayMusicAnimation = false; this.isPlayMusicAnimation = false;
}, },
randRange(a, b) { randRange(a, b) {
...@@ -273,7 +273,7 @@ cc.Class({ ...@@ -273,7 +273,7 @@ cc.Class({
getRandomPosInRect(target, r) { getRandomPosInRect(target, r) {
const x = this.randRange(target.x - r, target.x + r); const x = this.randRange(target.x - r, target.x + r);
const y = this.randRange(target.y - r, target.y + r); const y = this.randRange(target.y - r, target.y + r);
return {x, y} return { x, y }
}, },
...@@ -316,6 +316,8 @@ cc.Class({ ...@@ -316,6 +316,8 @@ cc.Class({
sy = frameSize.height / this._designSize.height; sy = frameSize.height / this._designSize.height;
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale; this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale; this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
this.canvas = cc.find("Canvas");
}, },
...@@ -335,14 +337,14 @@ cc.Class({ ...@@ -335,14 +337,14 @@ cc.Class({
this.data = JSON.parse(JSON.stringify(this.data)) this.data = JSON.parse(JSON.stringify(this.data))
this.preloadItem() this.preloadItem()
}); });
this.qupeiyinBtn.node.on(cc.Node.EventType.TOUCH_START, function() { this.qupeiyinBtn.node.on(cc.Node.EventType.TOUCH_START, function () {
console.log(123123); console.log(123123);
if (window.courseware && window.courseware.nextPage) { if (window.courseware && window.courseware.nextPage) {
window.courseware.nextPage(); window.courseware.nextPage();
} }
}, this); }, this);
this.toggleButton.on(cc.Node.EventType.TOUCH_START, function() { this.toggleButton.on(cc.Node.EventType.TOUCH_START, function () {
this.hideWolf(); this.hideWolf();
this.delayHideControl(); this.delayHideControl();
...@@ -365,9 +367,9 @@ cc.Class({ ...@@ -365,9 +367,9 @@ cc.Class({
}, this); }, this);
this.hintBtn.node.on('click', function() { this.hintBtn.node.on('click', function () {
console.log('play hint', (!cc.audioEngine.isMusicPlaying() && !this.videoplayer.isPlaying())); console.log('play hint', (!cc.audioEngine.isMusicPlaying() && !this.videoplayer.isPlaying()));
if (!cc.audioEngine.isMusicPlaying() && !this.videoplayer.isPlaying()){ if (!cc.audioEngine.isMusicPlaying() && !this.videoplayer.isPlaying()) {
this.hintAudioID = cc.audioEngine.playMusic(this.hintAudioClip, false, 1); this.hintAudioID = cc.audioEngine.playMusic(this.hintAudioClip, false, 1);
this._armatureDisPlay.playAnimation('begin', 0); this._armatureDisPlay.playAnimation('begin', 0);
cc.audioEngine.setFinishCallback(this.hintAudioID, () => { cc.audioEngine.setFinishCallback(this.hintAudioID, () => {
...@@ -384,13 +386,13 @@ cc.Class({ ...@@ -384,13 +386,13 @@ cc.Class({
.start(); .start();
// 覆盖Air中的dialogStatus方法 用于监测视频加载状态 // 覆盖Air中的dialogStatus方法 用于监测视频加载状态
if(window['air']) { if (window['air']) {
window["air"].dialogStatus = (statusCode) => { window["air"].dialogStatus = (statusCode) => {
console.log("缓冲", statusCode) console.log("缓冲", statusCode)
if(statusCode == 701) { if (statusCode == 701) {
// 缓冲中 // 缓冲中
this.loadingSprite.active = true; this.loadingSprite.active = true;
} else if(statusCode == 702) { } else if (statusCode == 702) {
// 缓冲结束 // 缓冲结束
this.loadingSprite.active = false; this.loadingSprite.active = false;
} }
...@@ -426,7 +428,7 @@ cc.Class({ ...@@ -426,7 +428,7 @@ cc.Class({
// this.userDragStart = true; // this.userDragStart = true;
}); });
this.barTag.off(cc.Node.EventType.TOUCH_MOVE); this.barTag.off(cc.Node.EventType.TOUCH_MOVE);
this.barTag.on(cc.Node.EventType.TOUCH_MOVE,(e) => { this.barTag.on(cc.Node.EventType.TOUCH_MOVE, (e) => {
this.delayHideControl(); this.delayHideControl();
...@@ -435,8 +437,17 @@ cc.Class({ ...@@ -435,8 +437,17 @@ cc.Class({
// return; // return;
// } // }
// console.log("TOUCH_MOVE"); // console.log("TOUCH_MOVE");
var delta = e.getDelta();
let newX = this.barTag.x+delta.x; const worldPos = e.getLocation();
const localPos = this.barTag.parent.convertToNodeSpaceAR(worldPos);
let newX = localPos.x;
// var delta = e.getDelta();
// let newX = this.barTag.x + delta.x;
newX = Math.min(maxX, Math.max(newX, minX)); newX = Math.min(maxX, Math.max(newX, minX));
this.barTag.x = newX; this.barTag.x = newX;
...@@ -444,7 +455,7 @@ cc.Class({ ...@@ -444,7 +455,7 @@ cc.Class({
const dur = this.videoplayer.getDuration(); const dur = this.videoplayer.getDuration();
this.currentTimeLabel.string = this.formatTime(percent * dur ); this.currentTimeLabel.string = this.formatTime(percent * dur);
// console.log(percent * dur); // console.log(percent * dur);
this.videoplayer.currentTime = percent * dur; this.videoplayer.currentTime = percent * dur;
}); });
...@@ -556,7 +567,7 @@ cc.Class({ ...@@ -556,7 +567,7 @@ cc.Class({
preload() { preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList); const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
console.log('preloadArr: ', JSON.stringify( preloadArr) ); console.log('preloadArr: ', JSON.stringify(preloadArr));
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => { cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
this.videoplayer.remoteURL = this.data.video_url; this.videoplayer.remoteURL = this.data.video_url;
...@@ -586,8 +597,8 @@ cc.Class({ ...@@ -586,8 +597,8 @@ cc.Class({
addPreloadAudio(callback) { addPreloadAudio(callback) {
this._audioResList.push({url: this.data.finish_audio_url || ''}); this._audioResList.push({ url: this.data.finish_audio_url || '' });
this._audioResList.push({url: this.data.hint_audio_url || ''}); this._audioResList.push({ url: this.data.hint_audio_url || '' });
const url1 = this.data.video_url; const url1 = this.data.video_url;
if (!url1) { if (!url1) {
...@@ -718,7 +729,7 @@ cc.Class({ ...@@ -718,7 +729,7 @@ cc.Class({
if (this.toggleButton.status == TOGGLE_BUTTON_STATUS.PLAY) { if (this.toggleButton.status == TOGGLE_BUTTON_STATUS.PLAY) {
return; return;
} }
this.toggleButtonSpriteNode.spriteFrame= this.pauseStatus; this.toggleButtonSpriteNode.spriteFrame = this.pauseStatus;
this.toggleButton.status = TOGGLE_BUTTON_STATUS.PLAY; this.toggleButton.status = TOGGLE_BUTTON_STATUS.PLAY;
this.videoplayer.play(); this.videoplayer.play();
this.playMusicAnimation(); this.playMusicAnimation();
...@@ -726,7 +737,7 @@ cc.Class({ ...@@ -726,7 +737,7 @@ cc.Class({
if (this.toggleButton.status == TOGGLE_BUTTON_STATUS.PAUSE) { if (this.toggleButton.status == TOGGLE_BUTTON_STATUS.PAUSE) {
return; return;
} }
this.toggleButtonSpriteNode.spriteFrame= this.playStatus ; this.toggleButtonSpriteNode.spriteFrame = this.playStatus;
this.toggleButton.status = TOGGLE_BUTTON_STATUS.PAUSE; this.toggleButton.status = TOGGLE_BUTTON_STATUS.PAUSE;
this.videoplayer.pause(); this.videoplayer.pause();
this.stopMusicAnimation(); this.stopMusicAnimation();
...@@ -746,10 +757,10 @@ cc.Class({ ...@@ -746,10 +757,10 @@ cc.Class({
} }
this.ProgressBar.progress = percent; this.ProgressBar.progress = percent;
const dur = this.videoplayer.getDuration(); const dur = this.videoplayer.getDuration();
console.log('updateBarByPos',percent * dur); console.log('updateBarByPos', percent * dur);
this.videoplayer.currentTime = percent * dur this.videoplayer.currentTime = percent * dur
}, },
updateBarByTime(ct){ updateBarByTime(ct) {
this.currentTimeLabel.string = this.formatTime(ct); this.currentTimeLabel.string = this.formatTime(ct);
const dur = this.videoplayer.getDuration(); const dur = this.videoplayer.getDuration();
...@@ -782,7 +793,7 @@ cc.Class({ ...@@ -782,7 +793,7 @@ cc.Class({
return `${hh}${mm}:${ss}`; return `${hh}${mm}:${ss}`;
}, },
update (dt) { update(dt) {
if (this.toggleButtonSpriteNode) { if (this.toggleButtonSpriteNode) {
// console.log(this.userDragStart); // console.log(this.userDragStart);
const ct = this.videoplayer.currentTime; const ct = this.videoplayer.currentTime;
......
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