Commit 9ce49c8a authored by zjz1994's avatar zjz1994

优化性能暂存

parent 89e088d3
......@@ -3,6 +3,7 @@ import Scene from "../components/Scene";
import Loading from "../components/Loading";
import wait from "../../new_tc/wait";
import MainScene from "../../../src/mainScene/MainScene";
import MapScene from "../../../src/mapScene/MapScene";
export default class SceneCtrl {
private _parent: egret.Sprite;
private _currentScene: Scene;
......@@ -11,6 +12,7 @@ export default class SceneCtrl {
static _instance: SceneCtrl;
mainscene:MainScene;
mapscene:MapScene;
static get instance() {
return SceneCtrl._instance || (SceneCtrl._instance = new SceneCtrl())
}
......@@ -24,7 +26,7 @@ export default class SceneCtrl {
}
change(type: ModuleTypes, data?, onComplete?: Function) {
if(type==ModuleTypes.MAIN_SCENE){
if(type==ModuleTypes.MAIN_SCENE){//游戏页
// console.log("游戏界面单例处理");
if(this.mainscene){
// console.log("使用已存在mainscene");
......@@ -44,11 +46,31 @@ export default class SceneCtrl {
this.showAfterLoadAtlas(this.mainscene, data, onComplete);
}
}
}else{
}
// else if(type==ModuleTypes.MAP_SCENE){//mapscene
// if(this.mapscene){
// console.log("单例mapscene");
// this.showAfterLoadAtlas(this.mapscene,data,onComplete);
// }else{
// console.log("新建mapscene");
// this.mapscene = new MapScene();
// if (!window['development']) {
// const promise = Promise.all([
// RES.getResAsync(`${'Map'}_json`),
// RES.getResAsync(`${'Map'}_png`)]);
// promise.then(() => {
// this.showAfterLoadAtlas(this.mapscene, data, onComplete);
// });
// } else {
// this.showAfterLoadAtlas(this.mapscene, data, onComplete);
// }
// }
// }
else{
const cls = this._sceneClassMap[type];
const scene: Scene = new cls();
if (!window['development']) {
if (type != ModuleTypes.MAP_SCENE)
// if (type != ModuleTypes.MAP_SCENE)
Loading.instace.show();
const key = scene.skinKey.toLowerCase();
const promise = Promise.all([
......
......@@ -350,7 +350,7 @@ export default class MapScene extends Scene {
RES.getResAsync(`${key}_png`)]);
} catch (error) {
}
console.log("开始加载一系列资源");
RES.getResAsync('candydis0_json');
RES.getResAsync('candydis1_json');
RES.getResAsync('candydis2_json');
......@@ -393,6 +393,7 @@ export default class MapScene extends Scene {
loadSvga(getResPath() + 'resource/assets/svgas/sand_dis.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/fireworks.svga');
console.log("一系列资源加载完毕");
if (!window['development']) {
RES.getResAsync(`inviterulepanel_json`);
}
......
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