Commit 74df49d4 authored by 范雪寒's avatar 范雪寒

feat: reloadBundle

parent 6783530d
...@@ -95,12 +95,12 @@ cc.Class({ ...@@ -95,12 +95,12 @@ cc.Class({
} else if (cc.sys.os == cc.sys.OS_ANDROID) { } else if (cc.sys.os == cc.sys.OS_ANDROID) {
platform = "android"; platform = "android";
} }
this.callNetworkApiGet(`http://staging-teach.ireadabc.com`, `/api/syllabus/v1/allbundles`, { orgid: 507, platform }, (datastr) => { this.callNetworkApiGet(`http://staging-teach.ireadabc.com`, `/api/syllabus/v1/allbundles`, { orgid: 483, platform }, (datastr) => {
const data = JSON.parse(datastr); const data = JSON.parse(datastr);
if (data.rows && data.rows.length > 0) { if (data.rows && data.rows.length > 0) {
this.preloadCount += data.rows.length; this.preloadCount += data.rows.length;
} }
this.callNetworkApiGet(`http://staging-teach.ireadabc.com`, `/api/syllabus/v1/allresources`, { orgid: 507 }, (datastr1) => { this.callNetworkApiGet(`http://staging-teach.ireadabc.com`, `/api/syllabus/v1/allresources`, { orgid: 483 }, (datastr1) => {
const data1 = JSON.parse(datastr1); const data1 = JSON.parse(datastr1);
if (data1.rows && data1.rows.length > 0) { if (data1.rows && data1.rows.length > 0) {
this.preloadCount += data1.rows.length; this.preloadCount += data1.rows.length;
...@@ -434,6 +434,7 @@ cc.Class({ ...@@ -434,6 +434,7 @@ cc.Class({
this.loadBundle(sceneName, version, bondleUrl); this.loadBundle(sceneName, version, bondleUrl);
}, },
loadBundle(sceneName, version, bondleUrl) { loadBundle(sceneName, version, bondleUrl) {
this.currentBundleInfo = { sceneName, version, bondleUrl };
this.showMask(); this.showMask();
this.showWaitingLetters(); this.showWaitingLetters();
cc.assetManager.loadBundle(bondleUrl, { version: version }, async (err, bundle) => { cc.assetManager.loadBundle(bondleUrl, { version: version }, async (err, bundle) => {
...@@ -460,6 +461,12 @@ cc.Class({ ...@@ -460,6 +461,12 @@ cc.Class({
}); });
}, },
reloadBundle() {
const { sceneName, version, bondleUrl } = this.currentBundleInfo;
this.loadBundle(sceneName, version, bondleUrl);
},
showMask() { showMask() {
const mask = cc.find('middleLayer/mask'); const mask = cc.find('middleLayer/mask');
mask.active = true; mask.active = true;
......
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