Commit 3d1d1e94 authored by huoshizhe's avatar huoshizhe

feat:

parent c19c6119
...@@ -10,7 +10,6 @@ cc.Class({ ...@@ -10,7 +10,6 @@ cc.Class({
} }
callBack(this.saveData); callBack(this.saveData);
} else { } else {
console.log('汪汪汪_3')
callBack(JSON.parse(this.courseItem.data)); callBack(JSON.parse(this.courseItem.data));
} }
return; return;
...@@ -28,13 +27,13 @@ cc.Class({ ...@@ -28,13 +27,13 @@ cc.Class({
onHomeworkFinish(callBack) { onHomeworkFinish(callBack) {
if (!this.saveData) { if (!this.saveData) {
console.log('汪汪汪1')
this.saveData = { step: 1 }; this.saveData = { step: 1 };
} else { } else {
console.log('汪汪汪2: ' + this.saveData.step)
this.saveData.step++; this.saveData.step++;
} }
cc.audioEngine.stopAll();
console.log(`this.loadOnlineBundle('PS_000');`); console.log(`this.loadOnlineBundle('PS_000');`);
this.loadOnlineBundle('PS_000'); this.loadOnlineBundle('PS_000');
// this.loadLocalBundle('192.168.1.102', '8081'); // this.loadLocalBundle('192.168.1.102', '8081');
...@@ -206,11 +205,14 @@ cc.Class({ ...@@ -206,11 +205,14 @@ cc.Class({
loadOnlineBundle(bundleName, onSuccess = null) { loadOnlineBundle(bundleName, onSuccess = null) {
this.showWaitingLetters();
if (!this.saveBundleNameMap) { if (!this.saveBundleNameMap) {
this.saveBundleNameMap = {}; this.saveBundleNameMap = {};
} }
if (this.saveBundleNameMap[bundleName]) { if (this.saveBundleNameMap[bundleName]) {
cc.director.loadScene(this.saveBundleNameMap[bundleName]); cc.director.loadScene(this.saveBundleNameMap[bundleName], () => {
this.hideWaitingLetters();
});
return; return;
} }
this.callNetworkApiGet(`http://staging-teach.ireadabc.com`, `/api/template/v1/${bundleName}`, {}, (datastr) => { this.callNetworkApiGet(`http://staging-teach.ireadabc.com`, `/api/template/v1/${bundleName}`, {}, (datastr) => {
...@@ -233,7 +235,8 @@ cc.Class({ ...@@ -233,7 +235,8 @@ cc.Class({
}, },
loadOnlineBundleByCourseId(courseId) { loadOnlineBundleByCourseId(courseId) {
this.showWaitingLetters();
// this.showWaitingLetters();
const baseUrl = `http://staging-teach.ireadabc.com/api/`; const baseUrl = `http://staging-teach.ireadabc.com/api/`;
let api = `courseware/v1/${courseId}/list`; let api = `courseware/v1/${courseId}/list`;
// if (linkFlag === true) { // if (linkFlag === true) {
...@@ -282,6 +285,7 @@ cc.Class({ ...@@ -282,6 +285,7 @@ cc.Class({
loadBundle(sceneName, version, bondleUrl, onSuccess = null) { loadBundle(sceneName, version, bondleUrl, onSuccess = null) {
cc.assetManager.loadBundle(bondleUrl, { version: version }, async (err, bundle) => { cc.assetManager.loadBundle(bondleUrl, { version: version }, async (err, bundle) => {
if (err) { if (err) {
this.hideWaitingLetters();
return this.asyncDelayLog(err); return this.asyncDelayLog(err);
} }
if (!onSuccess) { if (!onSuccess) {
...@@ -293,6 +297,7 @@ cc.Class({ ...@@ -293,6 +297,7 @@ cc.Class({
cc.director.runScene(scene); cc.director.runScene(scene);
}); });
} else { } else {
this.hideWaitingLetters();
await onSuccess(bundle); await onSuccess(bundle);
} }
}); });
...@@ -305,7 +310,6 @@ cc.Class({ ...@@ -305,7 +310,6 @@ cc.Class({
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_ANDROID) { } else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_ANDROID) {
return jsb.reflection.callStaticMethod('com/iplayabc/cocos/AppActivity', 'cocosWithNativeProtocol', '(Ljava/lang/String;)Ljava/lang/String;', paramStr); return jsb.reflection.callStaticMethod('com/iplayabc/cocos/AppActivity', 'cocosWithNativeProtocol', '(Ljava/lang/String;)Ljava/lang/String;', paramStr);
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_WINDOWS) { } else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_WINDOWS) {
console.log('汪汪汪')
} else { } else {
throw ('非源生环境'); throw ('非源生环境');
} }
...@@ -314,7 +318,8 @@ cc.Class({ ...@@ -314,7 +318,8 @@ cc.Class({
showWaitingLetters() { showWaitingLetters() {
const colorList = this.getRainbowColorList(); const colorList = this.getRainbowColorList();
const layout = cc.find('middleLayer/layout'); const layout = cc.find('middleLayer/layout');
// layout.active = true; layout.active = true;
layout.removeAllChildren();
const str = 'Now Loading...'; const str = 'Now Loading...';
str.split('').forEach((word, idx) => { str.split('').forEach((word, idx) => {
const node = new cc.Node(); const node = new cc.Node();
...@@ -384,23 +389,20 @@ cc.Class({ ...@@ -384,23 +389,20 @@ cc.Class({
getRainbowColorList() { getRainbowColorList() {
return [ return [
cc.color(255, 255, 0),
cc.color(128, 255, 0),
cc.color(0, 255, 0), cc.color(0, 255, 0),
cc.color(0, 0, 0),
cc.color(0, 255, 128), cc.color(0, 255, 128),
cc.color(0, 255, 255), cc.color(0, 255, 255),
cc.color(0, 128, 255), cc.color(0, 128, 255),
cc.color(0, 0, 255), cc.color(0, 0, 255),
cc.color(128, 0, 255), cc.color(128, 0, 255),
cc.color(255, 0, 255), cc.color(255, 0, 255),
cc.color(255, 0, 128), cc.color(255, 0, 128),
cc.color(255, 0, 0), cc.color(255, 0, 0),
cc.color(255, 128, 0), cc.color(255, 128, 0),
cc.color(255, 255, 0), cc.color(255, 255, 0),
cc.color(128, 255, 0),
cc.color(0, 255, 0),
cc.color(0, 255, 0),
]; ];
} }
}); });
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