Commit e8a701b6 authored by huoshizhe's avatar huoshizhe

feat: storyBox的退出按钮

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