Commit c4520b36 authored by limingzhe's avatar limingzhe

fix: debug

parent e580a2b6
{"ver":"1.1.2","uuid":"65997238-1dce-4fd5-a9a7-ea94159b589f","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": "65997238-1dce-4fd5-a9a7-ea94159b589f",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
...@@ -94,7 +94,7 @@ cc.Class({ ...@@ -94,7 +94,7 @@ cc.Class({
// 生命周期 onLoad // 生命周期 onLoad
onLoad() { onLoad() {
// this.initSceneData(); this.initSceneData();
this.initSize(); this.initSize();
this._armatureDisPlay = this.cat.getComponent(dragonBones.ArmatureDisplay); this._armatureDisPlay = this.cat.getComponent(dragonBones.ArmatureDisplay);
//获取 Armatrue //获取 Armatrue
...@@ -211,16 +211,16 @@ cc.Class({ ...@@ -211,16 +211,16 @@ cc.Class({
}, },
hideRabbit() { hideRabbit() {
console.log('hideRabbit'); // console.log('hideRabbit');
if (window && window["air"]) { // if (window && window["air"]) {
window.air.onCourseInScreen = (next) => { // window.air.onCourseInScreen = (next) => {
this.playGame(); // this.playGame();
next(); // next();
} // }
window["air"].hideAirClassLoading(); // window["air"].hideAirClassLoading();
} else { // } else {
this.playGame(); // this.playGame();
} // }
}, },
playGame() { playGame() {
...@@ -290,14 +290,14 @@ cc.Class({ ...@@ -290,14 +290,14 @@ cc.Class({
// _imageResList: null, _imageResList: null,
// _audioResList: null, _audioResList: null,
// _animaResList: null, _animaResList: null,
// initSceneData() { initSceneData() {
// this._imageResList = []; this._imageResList = [];
// this._audioResList = []; this._audioResList = [];
// this._animaResList = []; this._animaResList = [];
// }, },
_designSize: null, // 设计分辨率 _designSize: null, // 设计分辨率
_frameSize: null, // 屏幕分辨率 _frameSize: null, // 屏幕分辨率
...@@ -505,12 +505,108 @@ cc.Class({ ...@@ -505,12 +505,108 @@ cc.Class({
// const d = this.data.video_url.lastIndexOf('.'); // const d = this.data.video_url.lastIndexOf('.');
// const u = this.data.video_url.substring(0, d) + '_l' + this.data.video_url.substring(d) // const u = this.data.video_url.substring(0, d) + '_l' + this.data.video_url.substring(d)
// console.log('video', u); // console.log('video', u);
this.videoplayer.remoteURL = this.data.video_url;
this.addPreloadAudio(() => {
this.preload();
});
cc.debug.setDisplayStats(false); cc.debug.setDisplayStats(false);
}, },
preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
console.log('preloadArr: ', JSON.stringify( preloadArr) );
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
this.videoplayer.remoteURL = this.data.video_url;
// this.addServerListener();
// if (window && window["air"]) {
// window["air"].hideAirClassLoading();
// }
});
},
addPreloadAudio(callback) {
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) {
callback();
return;
}
this.getVideoUrl((url) => {
console.log('url: ', url);
this.data.video_url = url;
this._audioResList.push({ url: url || '' });
callback();
})
},
getVideoUrl(callback) {
const url1 = this.data.video_url;
const url2 = url1.replace(/.mp4$/g, "_l.mp4");
this.httpHeadCall(url2, (success) => {
if (success) {
console.log('return url2: ', url2);
callback(url2);
} else {
console.log('return url1: ', url1);
callback(url1);
}
})
},
httpHeadCall(requsetUrl, callback) {
let xhr = new XMLHttpRequest();
console.log("Status: Send Post Request to " + requsetUrl);
try {
xhr.onreadystatechange = () => {
try {
console.log('xhr.readyState: ', xhr.readyState);
if (xhr.readyState == 4) {
if ((xhr.status >= 200 && xhr.status < 400)) {
callback(true);
} else {
callback(false);
}
}
} catch (e) {
console.log(e)
}
};
xhr.open("HEAD", requsetUrl, true);
xhr.send();
xhr.timeout = 15000;
xhr.onerror = (e) => {
console.log("汪汪汪 posterror", e);
callback(false);
};
xhr.ontimeout = (e) => {
console.log("汪汪汪 ontimeout", e);
callback(false);
};
} catch (e) {
console.log("Send Get Request error: ", e)
}
},
...@@ -611,20 +707,20 @@ cc.Class({ ...@@ -611,20 +707,20 @@ cc.Class({
this.barTag.x = newX; this.barTag.x = newX;
}, },
formatTime(time) { formatTime(time) {
if (time === undefined) { if (time === undefined) {
return ''; return '';
} }
let hh = Math.floor(time / 60 / 60); let hh = Math.floor(time / 60 / 60);
if (hh > 0) { if (hh > 0) {
hh = `${hh.toString().padStart(2, '0')}:`; hh = `${hh.toString().padStart(2, '0')}:`;
} else { } else {
hh = ''; hh = '';
} }
const mm = Math.floor(time / 60).toString().padStart(2, '0'); const mm = Math.floor(time / 60).toString().padStart(2, '0');
const ss = Math.round(time % 60).toString().padStart(2, '0'); const ss = Math.round(time % 60).toString().padStart(2, '0');
return `${hh}${mm}:${ss}`; return `${hh}${mm}:${ss}`;
}, },
update (dt) { update (dt) {
......
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