Commit 918a03fc authored by wildfirecode's avatar wildfirecode

1

parent e8d3d60c
...@@ -137,7 +137,7 @@ export default class MainBase extends eui.UILayer { ...@@ -137,7 +137,7 @@ export default class MainBase extends eui.UILayer {
} }
const imageLoader = new egret.ImageLoader(); const imageLoader = new egret.ImageLoader();
imageLoader.once(egret.Event.COMPLETE, onImageLoaded, this); imageLoader.once(egret.Event.COMPLETE, onImageLoaded, this);
const url = getResPath() + "resource/assets/startScene/bg.jpg" const url = getResPath() + "resource/assets/startScene/startscenebg.jpg"
imageLoader.load(url); imageLoader.load(url);
} }
......
...@@ -19,15 +19,32 @@ export default class SceneCtrl { ...@@ -19,15 +19,32 @@ export default class SceneCtrl {
const scene: Scene = new cls(); const scene: Scene = new cls();
if (!window['development']) { if (!window['development']) {
Loading.instace.show(); Loading.instace.show();
RES.getResByUrl(`${scene.skinKey.toLowerCase()}_json`, (sheet: egret.SpriteSheet) => { this.loadAtlasAndBg(scene, () => {
Loading.instace.hide(); Loading.instace.hide();
this.showAfterLoadAtlas(scene, data, onComplete); this.showAfterLoadAtlas(scene, data, onComplete);
}, this, RES.ResourceItem.TYPE_SHEET); });
} else { } else {
this.showAfterLoadAtlas(scene, data, onComplete); this.showAfterLoadAtlas(scene, data, onComplete);
} }
} }
loadAtlasAndBg(scene, callback) {
let counter = 2;
const check = () => {
if (counter == 0) {
callback && callback();
}
}
RES.getResAsync(`${scene.skinKey.toLowerCase()}_json`, (sheet: egret.SpriteSheet) => {
counter--;
check();
}, this);
RES.getResAsync(`${scene.skinKey.toLowerCase()}scenebg_jpg`, () => {
counter--;
check();
}, this);
}
showAfterLoadAtlas(scene: Scene, data, onComplete: Function) { showAfterLoadAtlas(scene: Scene, data, onComplete: Function) {
if (this._currentScene) { if (this._currentScene) {
const oldScene = this._currentScene; const oldScene = this._currentScene;
......
{ {
"groups": [ "groups": [
{ {
"keys": "bg_jpg,optionBtn_png,rankBtn_png,recordbtn_png,ruleBtn_png,start_btn_gray_png,start_btn_png", "keys": "optionBtn_png,rankBtn_png,recordbtn_png,ruleBtn_png,start_btn_gray_png,start_btn_png",
"name": "start" "name": "start"
}, },
{ {
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"name": "prize" "name": "prize"
}, },
{ {
"keys": "testbtn_png,bg2_jpg,音乐开启_png,音乐关闭_png,轮子1_png,火箭_png,火_png,发弹雾气_png,大炮的头_png,大炮板子_png", "keys": "testbtn_png,音乐开启_png,音乐关闭_png,轮子1_png,火箭_png,火_png,发弹雾气_png,大炮的头_png,大炮板子_png",
"name": "play" "name": "play"
}, },
{ {
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
{ {
"keys": "bg_png,progress_png", "keys": "bg_png,progress_png",
"name": "loading" "name": "loading"
},
{
"name": "preload",
"keys": "playscenebg_jpg,startscenebg_jpg"
} }
], ],
"resources": [ "resources": [
...@@ -109,11 +113,6 @@ ...@@ -109,11 +113,6 @@
"type": "image", "type": "image",
"name": "recordbtn_png" "name": "recordbtn_png"
}, },
{
"url": "assets/playscene/bg2.jpg",
"type": "image",
"name": "bg2_jpg"
},
{ {
"url": "assets/playscene/发弹雾气.png", "url": "assets/playscene/发弹雾气.png",
"type": "image", "type": "image",
...@@ -154,11 +153,6 @@ ...@@ -154,11 +153,6 @@
"type": "image", "type": "image",
"name": "音乐开启_png" "name": "音乐开启_png"
}, },
{
"url": "assets/startScene/bg.jpg",
"type": "image",
"name": "bg_jpg"
},
{ {
"url": "assets/startScene/rankBtn.png", "url": "assets/startScene/rankBtn.png",
"type": "image", "type": "image",
...@@ -223,6 +217,16 @@ ...@@ -223,6 +217,16 @@
"url": "assets/loading/progress.png", "url": "assets/loading/progress.png",
"type": "image", "type": "image",
"name": "progress_png" "name": "progress_png"
},
{
"name": "playscenebg_jpg",
"type": "image",
"url": "assets/playscene/playscenebg.jpg"
},
{
"name": "startscenebg_jpg",
"type": "image",
"url": "assets/startScene/startscenebg.jpg"
} }
] ]
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e:Skin class="PlaySkin" width="750" height="1663" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing"> <e:Skin class="PlaySkin" width="750" height="1663" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image horizontalCenter="0" source="bg2_jpg" top="0"/> <e:Image horizontalCenter="0" top="0" source="playscenebg_jpg"/>
<e:Button id="testBtn" label="点击出奖" y="409" scaleX="1" scaleY="1" horizontalCenter="18.5"> <e:Button id="testBtn" label="点击出奖" y="409" scaleX="1" scaleY="1" horizontalCenter="18.5">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e:Skin class="StartSkin" width="750" height="1594" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing"> <e:Skin class="StartSkin" width="750" height="1594" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="bg" scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="0" source="bg_jpg"/> <e:Image id="bg" scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="0" source="startscenebg_jpg"/>
<e:Button id="startBtn" label="" scaleX="1" scaleY="1" y="780" horizontalCenter="0"> <e:Button id="startBtn" label="" scaleX="1" scaleY="1" y="780" horizontalCenter="0">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
......
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