layabox
onAwake(): void {
Laya.loader.load(
//先加载本场景要用的
["resources/UI/image.png", "resources/UI/progress.png", "resources/UI/progress$bar.png","resources/UI/images/dsgame/banner2.jpg"]
).then(() => {
let resArr: Array<any> = [
{ url: "resources/UI/images/dsgame/bgImage2.jpg", type: Laya.Loader.IMAGE },
{ url: "resources/UI/images/dsgame/index_bg.jpg", type: Laya.Loader.IMAGE },
{ url: "resources/UI/images/dsgame/say_right2.png", type: Laya.Loader.IMAGE },
{ url: "resources/UI/images/dsgame/dsGame.jpg", type: Laya.Loader.IMAGE },
{ url: "resources/UI/images/comp.atlas", type: Laya.Loader.ATLAS },
{ url: "resources/UI/role/atlasAni2/139x.atlas", type: Laya.Loader.ATLAS },
{ url: "scenes/Index.ls", type: Laya.Loader.HIERARCHY },
{ url: "scenes/DsGameMain.ls", type: Laya.Loader.HIERARCHY },
{ url: "prefab/closeBtn.lh", type: Laya.Loader.HIERARCHY },
{ url: "prefab/defaultButton.lh", type: Laya.Loader.HIERARCHY },
{ url: "prefab/defaultLabel.lh", type: Laya.Loader.HIERARCHY },
{ url: "dialog/helpDialog.lh", type: Laya.Loader.HIERARCHY },
{ url: "dialog/infoDialog.lh", type: Laya.Loader.HIERARCHY },
{ url: "resources/sound/dh/boy1.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/boy2.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/boy3.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/boy4.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/boy5.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/dchz1.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/gril1.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/gril2.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/gril3.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/hld1.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/hld2.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/hld3.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/hld4.wav", type: Laya.Loader.SOUND },
{ url: "resources/sound/dh/hld5.wav", type: Laya.Loader.SOUND }
];
//3.0的load,同时可以加载2D,3D资源
Laya.loader.load(resArr, null, Laya.Handler.create(this, this.onLoading, null, false)).then(() => {
// 加载完成后,处理逻辑
this.progress.value = 0.98;
console.log("加载结束", this.progress.value);
Laya.Scene.open("scenes/Index.ls"); //不要使用Laya.Scene.open("./Scenes/Index.ls");
});
// 侦听加载失败
Laya.loader.on(Laya.Event.ERROR, this, this.onError);
});
}