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) {
this.currentLoadedResourceCount = 0;
this.finishCallback = cb;
}
RemoteResourceCounter.prototype.load = function(num) {
RemoteResourceCounter.prototype.load = function (num) {
this.currentLoadedResourceCount += num;
console.log('RemoteResourceCounter', this.remoteResourceCount , this.currentLoadedResourceCount);
console.log('RemoteResourceCounter', this.remoteResourceCount, this.currentLoadedResourceCount);
if (this.remoteResourceCount <= this.currentLoadedResourceCount) {
this.finishCallback && this.finishCallback();
}
......@@ -115,9 +115,9 @@ cc.Class({
},
onDestroy() {
this.isPlayMusicAnimation = false;
cc.audioEngine.stop(this.beginAudioID );
cc.audioEngine.stop(this.finishAudioID );
cc.audioEngine.stop(this.hintAudioID );
cc.audioEngine.stop(this.beginAudioID);
cc.audioEngine.stop(this.finishAudioID);
cc.audioEngine.stop(this.hintAudioID);
this.isDestroy = true;
if (this.hideControlId) {
clearTimeout(this.hideControlId);
......@@ -233,7 +233,7 @@ cc.Class({
}
},
playMusicAnimation(){
playMusicAnimation() {
this.isPlayMusicAnimation = true;
const op1 = this.m1.node.position
const op2 = this.m2.node.position
......@@ -259,7 +259,7 @@ cc.Class({
fn(this.m1.node, op1);
fn(this.m2.node, op2);
},
stopMusicAnimation(){
stopMusicAnimation() {
this.isPlayMusicAnimation = false;
},
randRange(a, b) {
......@@ -273,7 +273,7 @@ cc.Class({
getRandomPosInRect(target, r) {
const x = this.randRange(target.x - r, target.x + r);
const y = this.randRange(target.y - r, target.y + r);
return {x, y}
return { x, y }
},
......@@ -316,6 +316,8 @@ cc.Class({
sy = frameSize.height / this._designSize.height;
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
this.canvas = cc.find("Canvas");
},
......@@ -335,14 +337,14 @@ cc.Class({
this.data = JSON.parse(JSON.stringify(this.data))
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);
if (window.courseware && window.courseware.nextPage) {
window.courseware.nextPage();
}
}, this);
this.toggleButton.on(cc.Node.EventType.TOUCH_START, function() {
this.toggleButton.on(cc.Node.EventType.TOUCH_START, function () {
this.hideWolf();
this.delayHideControl();
......@@ -365,9 +367,9 @@ cc.Class({
}, this);
this.hintBtn.node.on('click', function() {
this.hintBtn.node.on('click', function () {
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._armatureDisPlay.playAnimation('begin', 0);
cc.audioEngine.setFinishCallback(this.hintAudioID, () => {
......@@ -384,13 +386,13 @@ cc.Class({
.start();
// 覆盖Air中的dialogStatus方法 用于监测视频加载状态
if(window['air']) {
if (window['air']) {
window["air"].dialogStatus = (statusCode) => {
console.log("缓冲", statusCode)
if(statusCode == 701) {
if (statusCode == 701) {
// 缓冲中
this.loadingSprite.active = true;
} else if(statusCode == 702) {
} else if (statusCode == 702) {
// 缓冲结束
this.loadingSprite.active = false;
}
......@@ -426,7 +428,7 @@ cc.Class({
// this.userDragStart = true;
});
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();
......@@ -435,8 +437,17 @@ cc.Class({
// return;
// }
// 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));
this.barTag.x = newX;
......@@ -444,7 +455,7 @@ cc.Class({
const dur = this.videoplayer.getDuration();
this.currentTimeLabel.string = this.formatTime(percent * dur );
this.currentTimeLabel.string = this.formatTime(percent * dur);
// console.log(percent * dur);
this.videoplayer.currentTime = percent * dur;
});
......@@ -556,7 +567,7 @@ cc.Class({
preload() {
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) => {
this.videoplayer.remoteURL = this.data.video_url;
......@@ -586,8 +597,8 @@ cc.Class({
addPreloadAudio(callback) {
this._audioResList.push({url: this.data.finish_audio_url || ''});
this._audioResList.push({url: this.data.hint_audio_url || ''});
this._audioResList.push({ url: this.data.finish_audio_url || '' });
this._audioResList.push({ url: this.data.hint_audio_url || '' });
const url1 = this.data.video_url;
if (!url1) {
......@@ -718,7 +729,7 @@ cc.Class({
if (this.toggleButton.status == TOGGLE_BUTTON_STATUS.PLAY) {
return;
}
this.toggleButtonSpriteNode.spriteFrame= this.pauseStatus;
this.toggleButtonSpriteNode.spriteFrame = this.pauseStatus;
this.toggleButton.status = TOGGLE_BUTTON_STATUS.PLAY;
this.videoplayer.play();
this.playMusicAnimation();
......@@ -726,7 +737,7 @@ cc.Class({
if (this.toggleButton.status == TOGGLE_BUTTON_STATUS.PAUSE) {
return;
}
this.toggleButtonSpriteNode.spriteFrame= this.playStatus ;
this.toggleButtonSpriteNode.spriteFrame = this.playStatus;
this.toggleButton.status = TOGGLE_BUTTON_STATUS.PAUSE;
this.videoplayer.pause();
this.stopMusicAnimation();
......@@ -746,10 +757,10 @@ cc.Class({
}
this.ProgressBar.progress = percent;
const dur = this.videoplayer.getDuration();
console.log('updateBarByPos',percent * dur);
console.log('updateBarByPos', percent * dur);
this.videoplayer.currentTime = percent * dur
},
updateBarByTime(ct){
updateBarByTime(ct) {
this.currentTimeLabel.string = this.formatTime(ct);
const dur = this.videoplayer.getDuration();
......@@ -782,7 +793,7 @@ cc.Class({
return `${hh}${mm}:${ss}`;
},
update (dt) {
update(dt) {
if (this.toggleButtonSpriteNode) {
// console.log(this.userDragStart);
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