Commit e8a701b6 authored by huoshizhe's avatar huoshizhe

feat: storyBox的退出按钮

parent 284a85a2
...@@ -139,14 +139,10 @@ cc.Class({ ...@@ -139,14 +139,10 @@ cc.Class({
return; return;
} }
if (cc.sys.isNative && cc.sys.os == cc.sys.OS_IOS) { this.loadBundleByConf(defaultBondle.children[0].conf, () => {
this.loadBundle(defaultBondle.children[0].conf.ios); const ExitBtn = cc.find('middleLayer/storyBox/ExitBtn');
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_ANDROID) { ExitBtn.active = true;
this.loadBundle(defaultBondle.children[0].conf.android); });
} else {
this.loadBundle(defaultBondle.children[0].conf.web_desktop);
console.error('非源生环境');
}
const videoMenuItemData = data.rows.find(row => row.name == 'Video'); const videoMenuItemData = data.rows.find(row => row.name == 'Video');
const songMenuItemData = data.rows.find(row => row.name == 'Song'); const songMenuItemData = data.rows.find(row => row.name == 'Song');
...@@ -261,15 +257,14 @@ cc.Class({ ...@@ -261,15 +257,14 @@ cc.Class({
label.getComponent(cc.Label).string = menuData.name; label.getComponent(cc.Label).string = menuData.name;
optionNode.on('click', () => { optionNode.on('click', () => {
this.hideMenu(); cc.tween(optionNode)
if (cc.sys.isNative && cc.sys.os == cc.sys.OS_IOS) { .to(0.1, { scale: 1.05 })
this.loadBundle(menuData.children[0].conf.ios); .to(0.1, { scale: 1.00 })
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_ANDROID) { .call(() => {
this.loadBundle(menuData.children[0].conf.android); this.hideMenu();
} else { this.loadBundleByConf(menuData.children[0].conf);
this.loadBundle(menuData.children[0].conf.web_desktop); })
console.error('非源生环境'); .start();
}
}); });
}); });
} }
...@@ -316,10 +311,7 @@ cc.Class({ ...@@ -316,10 +311,7 @@ cc.Class({
.to(0.1, { scaleX: 1.1, scaleY: 0.9 }) .to(0.1, { scaleX: 1.1, scaleY: 0.9 })
.to(0.1, { scaleX: 1, scaleY: 1 }) .to(0.1, { scaleX: 1, scaleY: 1 })
.call(() => { .call(() => {
cc.game.removePersistRootNode(this.node); this.exit();
cc.director.loadScene("emptyScene", () => {
this.callNativeFunction({ name: 'exit', value: '' });
});
}) })
.start(); .start();
}); });
...@@ -449,10 +441,7 @@ cc.Class({ ...@@ -449,10 +441,7 @@ cc.Class({
.to(0.1, { scaleX: 1.1, scaleY: 0.9 }) .to(0.1, { scaleX: 1.1, scaleY: 0.9 })
.to(0.1, { scaleX: 1, scaleY: 1 }) .to(0.1, { scaleX: 1, scaleY: 1 })
.call(() => { .call(() => {
cc.game.removePersistRootNode(this.node); this.exit();
cc.director.loadScene("emptyScene", () => {
this.callNativeFunction({ name: 'exit', value: '' });
});
}) })
.start(); .start();
}); });
...@@ -551,7 +540,7 @@ cc.Class({ ...@@ -551,7 +540,7 @@ cc.Class({
}, 1000); }, 1000);
}, },
loadBundle(conf) { loadBundle(conf, callback) {
cc.assetManager.loadBundle(conf.bondleUrl, { version: conf.version }, async (err, bundle) => { cc.assetManager.loadBundle(conf.bondleUrl, { version: conf.version }, async (err, bundle) => {
if (err) { if (err) {
return this.asyncDelayLog(err); return this.asyncDelayLog(err);
...@@ -561,11 +550,23 @@ cc.Class({ ...@@ -561,11 +550,23 @@ cc.Class({
this.asyncDelayLog('err: ', err); this.asyncDelayLog('err: ', err);
} }
this.hideWaitingLetters(); this.hideWaitingLetters();
callback && callback();
cc.director.runScene(scene); cc.director.runScene(scene);
}); });
}); });
}, },
loadBundleByConf(conf, callback) {
if (cc.sys.isNative && cc.sys.os == cc.sys.OS_IOS) {
this.loadBundle(conf.ios, callback);
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_ANDROID) {
this.loadBundle(conf.android, callback);
} else {
this.loadBundle(conf.web_desktop, callback);
console.error('非源生环境');
}
},
exit() { exit() {
cc.game.removePersistRootNode(this.node); cc.game.removePersistRootNode(this.node);
cc.director.loadScene("emptyScene", () => { cc.director.loadScene("emptyScene", () => {
......
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