Commit 08228071 authored by wildfirecode's avatar wildfirecode

1

parent e2a614d7
......@@ -24,6 +24,9 @@ export default class MainBase extends eui.UILayer {
super();
check_webp_feature();
Loading.instace.loadImage();
DataManager.ins.gameCfgData = window['CFG'];
DataManager.ins.gameCfgData.gameInfo.gameId = window["gameId"];
this.getData();
}
protected registerModules() {
......@@ -82,9 +85,6 @@ export default class MainBase extends eui.UILayer {
egret.ImageLoader.crossOrigin = "anonymous";
DataManager.ins.gameCfgData = window['CFG'];
DataManager.ins.gameCfgData.gameInfo.gameId = window["gameId"];
layers.init(this);
Loading.init(layers.topLayer);
Loading.instace.show();
......@@ -98,7 +98,7 @@ export default class MainBase extends eui.UILayer {
this.loadFirstScreen();
Loading.instace.show();
this.getData();
RES.setMaxLoadingThread(10);
this.runGame().catch(e => {
console.log(e);
......
......@@ -16,16 +16,37 @@ export default class StartSceneBase extends Scene {
recordBtn: eui.Button;
startBtn: eui.Button;
rankBtn: eui.Button;
countdownTxt: eui.Label;
countTxt: eui.Label;
exemptionTxt: eui.Label;
bg: eui.Image;
_timer: egret.Timer;
async start(data?) {
this.startBtn.visible = false;
this.updateGetInfoView();
this.updateExemptionTxt();
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() {
......@@ -105,7 +126,8 @@ export default class StartSceneBase extends Scene {
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.get(this.startBtn).to({ horizontalCenter: 750 }, 200);
egret.Tween.get(this.countTxt).to({ horizontalCenter: -750 }, 200);
......@@ -113,6 +135,11 @@ export default class StartSceneBase extends Scene {
await wait(200);
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) {
PanelCtrl.instance.show(ModuleTypes.RANK_PANEL);
}
......
......@@ -10,6 +10,7 @@
</e:skinName>
</e:Button>
<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:Button id="recordBtn" label="奖品记录" y="16" scaleX="1" scaleY="1" right="23">
<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