Commit 08228071 authored by wildfirecode's avatar wildfirecode

1

parent e2a614d7
...@@ -24,6 +24,9 @@ export default class MainBase extends eui.UILayer { ...@@ -24,6 +24,9 @@ export default class MainBase extends eui.UILayer {
super(); super();
check_webp_feature(); check_webp_feature();
Loading.instace.loadImage(); Loading.instace.loadImage();
DataManager.ins.gameCfgData = window['CFG'];
DataManager.ins.gameCfgData.gameInfo.gameId = window["gameId"];
this.getData();
} }
protected registerModules() { protected registerModules() {
...@@ -82,9 +85,6 @@ export default class MainBase extends eui.UILayer { ...@@ -82,9 +85,6 @@ export default class MainBase extends eui.UILayer {
egret.ImageLoader.crossOrigin = "anonymous"; egret.ImageLoader.crossOrigin = "anonymous";
DataManager.ins.gameCfgData = window['CFG'];
DataManager.ins.gameCfgData.gameInfo.gameId = window["gameId"];
layers.init(this); layers.init(this);
Loading.init(layers.topLayer); Loading.init(layers.topLayer);
Loading.instace.show(); Loading.instace.show();
...@@ -98,7 +98,7 @@ export default class MainBase extends eui.UILayer { ...@@ -98,7 +98,7 @@ export default class MainBase extends eui.UILayer {
this.loadFirstScreen(); this.loadFirstScreen();
Loading.instace.show(); Loading.instace.show();
this.getData();
RES.setMaxLoadingThread(10); RES.setMaxLoadingThread(10);
this.runGame().catch(e => { this.runGame().catch(e => {
console.log(e); console.log(e);
......
...@@ -16,16 +16,37 @@ export default class StartSceneBase extends Scene { ...@@ -16,16 +16,37 @@ export default class StartSceneBase extends Scene {
recordBtn: eui.Button; recordBtn: eui.Button;
startBtn: eui.Button; startBtn: eui.Button;
rankBtn: eui.Button; rankBtn: eui.Button;
countdownTxt: eui.Label;
countTxt: eui.Label; countTxt: eui.Label;
exemptionTxt: eui.Label; exemptionTxt: eui.Label;
bg: eui.Image; bg: eui.Image;
_timer: egret.Timer;
async start(data?) { async start(data?) {
this.startBtn.visible = false; this.startBtn.visible = false;
this.updateGetInfoView(); this.updateGetInfoView();
this.updateExemptionTxt(); this.updateExemptionTxt();
this.showElements(); this.showElements();
this.autoStart();
}
autoStart() {
const n = 15;
const timer = new egret.Timer(1000, n);
timer.addEventListener(egret.TimerEvent.TIMER, () => {
this.updateCountdownTxt(n - timer.currentCount);
}, this);
timer.once(egret.TimerEvent.TIMER_COMPLETE, () => {
this.onTap_startBtn();
}, this);
timer.start();
this.updateCountdownTxt(n);
this._timer = timer;
}
updateCountdownTxt(n) {
this.countdownTxt.text = `生活不容易,(${n})秒后帮您自动开始游戏`
} }
showElements() { showElements() {
...@@ -105,7 +126,8 @@ export default class StartSceneBase extends Scene { ...@@ -105,7 +126,8 @@ export default class StartSceneBase extends Scene {
onTap_recordBtn(e: egret.Event) { onTap_recordBtn(e: egret.Event) {
} }
async onTap_startBtn(e: egret.Event) { async onTap_startBtn(e?: egret.Event) {
this.stopTimer();
egret.Tween.removeTweens(this.startBtn); egret.Tween.removeTweens(this.startBtn);
egret.Tween.get(this.startBtn).to({ horizontalCenter: 750 }, 200); egret.Tween.get(this.startBtn).to({ horizontalCenter: 750 }, 200);
egret.Tween.get(this.countTxt).to({ horizontalCenter: -750 }, 200); egret.Tween.get(this.countTxt).to({ horizontalCenter: -750 }, 200);
...@@ -113,6 +135,11 @@ export default class StartSceneBase extends Scene { ...@@ -113,6 +135,11 @@ export default class StartSceneBase extends Scene {
await wait(200); await wait(200);
SceneCtrl.instance.change(ModuleTypes.PALY_SCENE); SceneCtrl.instance.change(ModuleTypes.PALY_SCENE);
} }
private stopTimer() {
this._timer.stop();
egret.Tween.get(this.countdownTxt).to({ alpha:0 }, 200);
}
onTap_rankBtn(e: egret.Event) { onTap_rankBtn(e: egret.Event) {
PanelCtrl.instance.show(ModuleTypes.RANK_PANEL); PanelCtrl.instance.show(ModuleTypes.RANK_PANEL);
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Label id="countTxt" text="Label" width="100%" verticalAlign="middle" textAlign="center" y="901" horizontalCenter="0"/> <e:Label id="countTxt" text="Label" width="100%" verticalAlign="middle" textAlign="center" y="901" horizontalCenter="0"/>
<e:Label id="countdownTxt" text="" width="100%" verticalAlign="middle" textAlign="center" y="729" horizontalCenter="0"/>
<e:Label id="exemptionTxt" text="*兑换项与活动均与设备制造商Apple Inc.公司无关*" width="100%" horizontalCenter="0" bottom="5" verticalAlign="middle" textAlign="center" textColor="0x333333" size="18"/> <e:Label id="exemptionTxt" text="*兑换项与活动均与设备制造商Apple Inc.公司无关*" width="100%" horizontalCenter="0" bottom="5" verticalAlign="middle" textAlign="center" textColor="0x333333" size="18"/>
<e:Button id="recordBtn" label="奖品记录" y="16" scaleX="1" scaleY="1" right="23"> <e:Button id="recordBtn" label="奖品记录" y="16" scaleX="1" scaleY="1" right="23">
<e:skinName> <e:skinName>
......
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