Commit 42cd5d46 authored by wildfirecode's avatar wildfirecode

1

parent 639f1b82
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"alert_2","version":5,"files":["../assets/alert/Bitmap-4.png","../assets/alert/Bitmap-2.png","../assets/alert/Bitmap-1.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"guide_4","version":5,"files":["../assets/startScene/guide/guide_tips.png","../assets/startScene/guide/guide_hand.png","../assets/startScene/guide/guide_dialog.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"loading_1","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":"msg_0","version":5,"files":["../assets/msg/msgBg.png","../assets/msg/x.png","../assets/msg/sureBtn.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"preload_5","version":5,"files":["../assets/ProgressBar/thumb_pb.png","../assets/ProgressBar/track_pb.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"rule_3","version":5,"files":["../assets/rule/ruleBg.png","../assets/rule/X.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"startscene_5","version":5,"files":["../assets/startScene/ruleBtn.png","../assets/startScene/optionBtn.png"]}
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"skins": {}, "skins": {},
"autoGenerateExmlsList": true, "autoGenerateExmlsList": true,
"exmls": [ "exmls": [
"resource/skins/RuleSkin.exml",
"resource/skins/StartSkin.exml" "resource/skins/StartSkin.exml"
], ],
"path": "resource/default.thm.json" "path": "resource/default.thm.json"
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="RuleSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="ruleBg" source="ruleBg_png" horizontalCenter="0.5" verticalCenter="-231"/>
<e:Button id="closeBtn" label="" horizontalCenter="296.5" verticalCenter="-561">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="X_png" source.down="X_png" source.disabled="X_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Skin>
\ No newline at end of file
...@@ -2,8 +2,7 @@ import { ModuleTypes } from "../types/sceneTypes"; ...@@ -2,8 +2,7 @@ import { ModuleTypes } from "../types/sceneTypes";
import Panel from "../views/Panel"; import Panel from "../views/Panel";
export default class PanelCtrl { export default class PanelCtrl {
private _parent: egret.Sprite; private _parent: egret.Sprite;
private _mask: egret.Shape; private _mask: egret.Sprite;
static _instance: PanelCtrl; static _instance: PanelCtrl;
static get instance() { static get instance() {
return PanelCtrl._instance || (PanelCtrl._instance = new PanelCtrl()) return PanelCtrl._instance || (PanelCtrl._instance = new PanelCtrl())
...@@ -14,11 +13,31 @@ export default class PanelCtrl { ...@@ -14,11 +13,31 @@ 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._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));
}
addMask() {
if (!this._mask) {
this._mask = new egret.Sprite();
this._mask.touchEnabled = true;
this._mask.graphics.beginFill(0, .7);
this._mask.graphics.drawRect(0, 0, 750, 1624);
this._mask.graphics.endFill();
}
this._mask.alpha=1;
this._parent.addChild(this._mask);
}
removeMask() {
if (this._mask) {
egret.Tween.get(this._mask).to({ alpha: 0 }, 200).call(
() => this._parent.removeChild(this._mask), this);
}
} }
private add(panel: Panel) { private add(panel: Panel) {
...@@ -27,7 +46,12 @@ export default class PanelCtrl { ...@@ -27,7 +46,12 @@ export default class PanelCtrl {
} }
private remove(panel: Panel) { private remove(panel: Panel) {
this._parent.removeChild(panel); const tw = egret.Tween.get(panel);
tw.to({ y: 1624 }, 400, egret.Ease.getBackIn(2))
.call(() => {
this._parent.removeChild(panel);
this.removeMask();
}, this);
} }
private onPanelHide(e: egret.Event) { private onPanelHide(e: egret.Event) {
......
export default class Guide extends egret.Shape { export default class Guide extends egret.Sprite {
destroy(): any { destroy(): any {
this.parent.removeChild(this); this.parent.removeChild(this);
} }
constructor(parent: egret.Sprite) { constructor(parent: egret.Sprite) {
super(); super();
this.touchEnabled=true;
this.graphics.beginFill(0, .7); this.graphics.beginFill(0, .7);
this.graphics.drawRect(0, 0, parent.stage.stageWidth, parent.stage.stageHeight); this.graphics.drawRect(0, 0, parent.stage.stageWidth, parent.stage.stageHeight);
this.graphics.endFill(); this.graphics.endFill();
......
...@@ -55,17 +55,19 @@ export default class StartScene extends Scene { ...@@ -55,17 +55,19 @@ export default class StartScene extends Scene {
this.getLayer(LayerTypes.net).addChild(net); this.getLayer(LayerTypes.net).addChild(net);
this._net = net; this._net = net;
this.getLayer(LayerTypes.bg).touchEnabled=true;
if (__debug__) { if (__debug__) {
this._debug = new debug(this.getLayer(LayerTypes.top)); this._debug = new debug(this.getLayer(LayerTypes.top));
} }
} }
addTouchEvent() { addTouchEvent() {
this.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this); this.getLayer(LayerTypes.bg).addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this);
} }
removeTouchEvent() { removeTouchEvent() {
this.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this); this.getLayer(LayerTypes.bg).removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this);
} }
private _catchedBox: Box; private _catchedBox: Box;
...@@ -216,26 +218,24 @@ export default class StartScene extends Scene { ...@@ -216,26 +218,24 @@ export default class StartScene extends Scene {
this['optionBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_optionBtn, this); this['optionBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_optionBtn, this);
} }
onTap_ruleBtn() { onTap_ruleBtn(e:egret.Event) {
// alert('onTap_ruleBtn');
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL); PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
} }
onTap_optionBtn() { onTap_optionBtn(e:egret.Event) {
alert('onTap_optionBtn')
} }
protected get layerKeys() { protected get layerKeys() {
return [ return [
LayerTypes.bg, LayerTypes.bg,
LayerTypes.kids, LayerTypes.kids,
LayerTypes.ui,
LayerTypes.guide, LayerTypes.guide,
LayerTypes.net, LayerTypes.net,
LayerTypes.box, LayerTypes.box,
LayerTypes.monkey, LayerTypes.monkey,
LayerTypes.ui,
LayerTypes.top, LayerTypes.top,
] ]
} }
......
class Layers extends eui.UILayer { class Layers extends eui.UILayer {
private _topLayer: egret.Sprite; private _topLayer: egret.Sprite;
private _popupLayer: egret.Sprite; private _popupLayer: egret.Sprite;
......
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