Commit e30ced12 authored by wildfirecode's avatar wildfirecode

update

parent 2cc81e82
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
<script src="libs/security.js"></script> <script src="libs/security.js"></script>
<script src="libs/downloadApp.js"></script> <script src="libs/downloadApp.js"></script>
<script> <script>
window['development']=true;
var gameId = 1; var gameId = 1;
var CFG = { var CFG = {
appInfo: { appInfo: {
......
...@@ -6,7 +6,7 @@ export default class Alert extends Panel { ...@@ -6,7 +6,7 @@ export default class Alert extends Panel {
this.data.btnTxt = btnTxt || '确定'; this.data.btnTxt = btnTxt || '确定';
} }
protected get skinKey() { return 'Alert' } get skinKey() { return 'Alert' }
protected get closeBtns(): eui.Button[] { protected get closeBtns(): eui.Button[] {
return [this['closeBtn']] return [this['closeBtn']]
......
...@@ -4,6 +4,9 @@ export default class ComponentBase extends eui.Component { ...@@ -4,6 +4,9 @@ export default class ComponentBase extends eui.Component {
constructor() { constructor() {
super(); super();
this.data = {}; this.data = {};
}
loadSkin() {
this.skinName = getSkinPath(this.skinKey); this.skinName = getSkinPath(this.skinKey);
if (this.skin) { if (this.skin) {
this.onSkinComplete(); this.onSkinComplete();
...@@ -20,7 +23,7 @@ export default class ComponentBase extends eui.Component { ...@@ -20,7 +23,7 @@ export default class ComponentBase extends eui.Component {
} }
protected get skinKey() { return null } get skinKey():string { return null }
protected onSkinComplete() { protected onSkinComplete() {
this.initEvents(); this.initEvents();
......
...@@ -53,5 +53,5 @@ export default class HTMLRulePanel extends Panel { ...@@ -53,5 +53,5 @@ export default class HTMLRulePanel extends Panel {
} }
} }
protected get skinKey() { return 'Rule' } get skinKey() { return 'Rule' }
} }
\ No newline at end of file
...@@ -10,6 +10,7 @@ export default class Loading extends ComponentBase { ...@@ -10,6 +10,7 @@ export default class Loading extends ComponentBase {
super(); super();
this.horizontalCenter = 0; this.horizontalCenter = 0;
this.verticalCenter = 0; this.verticalCenter = 0;
this.loadSkin();
} }
show() { show() {
...@@ -38,5 +39,5 @@ export default class Loading extends ComponentBase { ...@@ -38,5 +39,5 @@ export default class Loading extends ComponentBase {
this.data.speed += 5; this.data.speed += 5;
} }
protected get skinKey() { return 'Loading' } get skinKey() { return 'Loading' }
} }
...@@ -33,5 +33,5 @@ export default class OptionsPanel extends Panel { ...@@ -33,5 +33,5 @@ export default class OptionsPanel extends Panel {
return `第${data['scopeOrigin']}名`; return `第${data['scopeOrigin']}名`;
} }
protected get skinKey() { return 'Options' } get skinKey() { return 'Options' }
} }
\ No newline at end of file
...@@ -18,5 +18,5 @@ export default class PlaySceneBase extends Scene { ...@@ -18,5 +18,5 @@ export default class PlaySceneBase extends Scene {
}, this.score) }, this.score)
} }
protected get skinKey() { return 'Play' } get skinKey() { return 'Play' }
} }
\ No newline at end of file
...@@ -53,7 +53,7 @@ export default class PrizePanel extends Panel { ...@@ -53,7 +53,7 @@ export default class PrizePanel extends Panel {
img: eui.Image; img: eui.Image;
useBtn: eui.Button; useBtn: eui.Button;
protected get skinKey() { return 'Prize' } get skinKey() { return 'Prize' }
protected get closeBtns(): eui.Button[] { protected get closeBtns(): eui.Button[] {
return [this['closeBtn']] return [this['closeBtn']]
......
...@@ -91,5 +91,5 @@ export default class RankPanel extends Panel { ...@@ -91,5 +91,5 @@ export default class RankPanel extends Panel {
} }
protected get skinKey() { return 'Rank' } get skinKey() { return 'Rank' }
} }
\ No newline at end of file
...@@ -21,5 +21,5 @@ export default class RulePanel extends Panel { ...@@ -21,5 +21,5 @@ export default class RulePanel extends Panel {
this.labContent.textFlow = (new HtmlTextParser).parser(DataManager.ins.getRuleData.ruleText); this.labContent.textFlow = (new HtmlTextParser).parser(DataManager.ins.getRuleData.ruleText);
} }
protected get skinKey() { return 'Rule' } get skinKey() { return 'Rule' }
} }
\ No newline at end of file
...@@ -93,5 +93,5 @@ export default class StartSceneBase extends Scene { ...@@ -93,5 +93,5 @@ export default class StartSceneBase extends Scene {
PanelCtrl.instance.show(ModuleTypes.RANK_PANEL); PanelCtrl.instance.show(ModuleTypes.RANK_PANEL);
} }
protected get skinKey() { return 'Start' } get skinKey() { return 'Start' }
} }
\ No newline at end of file
const loadAtlas = (name: string) => {
return new Promise((resolve, reject) => {
RES.getResByUrl(`resource/TextureMerger/${name}.json`, (sheet: egret.SpriteSheet) => {
resolve(this);
}, this, RES.ResourceItem.TYPE_SHEET);
});
}
// const loadAtlas = (name: string) => {
// return new Promise((resolve, reject) => {
// RES.getResByUrl(`resource/TextureMerger/${name}.json`, (sheet: egret.SpriteSheet) => {
// resolve(this);
// }, this, RES.ResourceItem.TYPE_SHEET);
// });
// }
\ No newline at end of file
import { ModuleTypes } from "../types/sceneTypes"; import { ModuleTypes } from "../types/sceneTypes";
import Panel from "../components/Panel"; import Panel from "../components/Panel";
import Loading from "../components/Loading";
export default class PanelCtrl { export default class PanelCtrl {
private _parent: egret.Sprite; private _parent: egret.Sprite;
private _mask: egret.Sprite; private _mask: egret.Sprite;
...@@ -13,14 +14,27 @@ export default class PanelCtrl { ...@@ -13,14 +14,27 @@ export default class PanelCtrl {
} }
show(type: ModuleTypes, data?) { show(type: ModuleTypes, data?) {
this.addMask();
const cls = this._panelClassMap[type]; const cls = this._panelClassMap[type];
const panel: Panel = new cls(data); const panel: Panel = new cls(data);
this.addMask();
if (!window['development']) {
Loading.instace.show();
RES.getResByUrl(`${panel.skinKey.toLowerCase()}_json`, (sheet: egret.SpriteSheet) => {
Loading.instace.hide();
this.showAfterLoadAtlas(panel, data);
}, this, RES.ResourceItem.TYPE_SHEET);
} else {
this.showAfterLoadAtlas(panel, data);
}
return panel;
}
showAfterLoadAtlas(panel: Panel, data) {
panel.loadSkin();
this._current = panel; this._current = panel;
panel.start(data); panel.start(data);
this.add(panel); this.add(panel);
egret.Tween.get(panel).set({ y: -200 }).to({ y: 0 }, 500, egret.Ease.getBackOut(2)); egret.Tween.get(panel).set({ y: -200 }).to({ y: 0 }, 500, egret.Ease.getBackOut(2));
return panel;
} }
addMask() { addMask() {
...@@ -31,7 +45,7 @@ export default class PanelCtrl { ...@@ -31,7 +45,7 @@ export default class PanelCtrl {
this._mask.graphics.drawRect(0, 0, 750, 1624); this._mask.graphics.drawRect(0, 0, 750, 1624);
this._mask.graphics.endFill(); this._mask.graphics.endFill();
} }
this._mask.alpha=1; this._mask.alpha = 1;
this._parent.addChild(this._mask); this._parent.addChild(this._mask);
} }
removeMask() { removeMask() {
......
...@@ -19,6 +19,7 @@ export default class SceneCtrl { ...@@ -19,6 +19,7 @@ export default class SceneCtrl {
} }
const cls = this._sceneClassMap[type]; const cls = this._sceneClassMap[type];
const scene: Scene = new cls(); const scene: Scene = new cls();
scene.loadSkin();
scene.start(); scene.start();
this.addToStage(scene); this.addToStage(scene);
} }
......
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"loading","version":5,"files":["../assets/loading/bg.png","../assets/loading/progress.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"options","version":5,"files":["../assets/option/line2.png","../assets/option/prizeBg.png","../assets/option/X-1.png","../assets/option/line.png"]}
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
}, },
{ {
"keys": "line2_png,prizeBg_png,X-1_png,line_png", "keys": "line2_png,prizeBg_png,X-1_png,line_png",
"name": "option" "name": "options"
}, },
{ {
"keys": "alertbg_png", "keys": "alertbg_png",
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
{ {
"keys": "X_png,ruleBg_png", "keys": "X_png,ruleBg_png",
"name": "rule" "name": "rule"
},
{
"keys": "bg_png,progress_png",
"name": "loading"
} }
], ],
"resources": [ "resources": [
...@@ -209,6 +213,16 @@ ...@@ -209,6 +213,16 @@
"url": "assets/playscene/testbtn.png", "url": "assets/playscene/testbtn.png",
"type": "image", "type": "image",
"name": "testbtn_png" "name": "testbtn_png"
},
{
"url": "assets/loading/bg.png",
"type": "image",
"name": "bg_png"
},
{
"url": "assets/loading/progress.png",
"type": "image",
"name": "progress_png"
} }
] ]
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"autoGenerateExmlsList": true, "autoGenerateExmlsList": true,
"exmls": [ "exmls": [
"resource/skins/AlertSkin.exml", "resource/skins/AlertSkin.exml",
"resource/skins/LoadingSkin.exml",
"resource/skins/OptionItemSkin.exml", "resource/skins/OptionItemSkin.exml",
"resource/skins/OptionsSkin.exml", "resource/skins/OptionsSkin.exml",
"resource/skins/PlaySkin.exml", "resource/skins/PlaySkin.exml",
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="loadingSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" xmlns:tween="egret.tween.*">
<w:Declarations>
</w:Declarations>
<e:Image y="288" source="bg_png" horizontalCenter="0"/>
<e:Image id="waitImg" source="progress_png" y="380" anchorOffsetX="28" anchorOffsetY="28" horizontalCenter="0" rotation="{data.speed}"/>
</e:Skin>
\ No newline at end of file
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