Commit e6e80c1d authored by wildfirecode's avatar wildfirecode

1

parent 3668f72b
No preview for this file type
import { getResPath } from "../new_tc/utils";
import { check_webp_feature } from "../tc/util/GFun";
import { DataManager } from "../tw/manager/DataManager";
import { NetManager } from "../tw/manager/NetManager";
import AssetAdapter from "./adapter/AssetAdapter";
import ThemeAdapter from "./adapter/ThemeAdapter";
import layers from "./views/layers";
import Alert from "./components/Alert";
import HTMLRulePanel from "./components/HTMLRulePanel";
import Loading from "./components/Loading";
import OptionsPanel from "./components/OptionsPanel";
import PlaySceneBase from "./components/PlaySceneBase";
import PrizePanel from "./components/PrizePanel";
import RulePanel from "./components/RulePanel";
import StartSceneBase from "./components/StartSceneBase";
import PanelCtrl from "./ctrls/panelCtrl";
import SceneCtrl from "./ctrls/sceneCtrl";
import showAlertPanel from "./ctrls/showAlertPanel";
import { ModuleTypes } from "./types/sceneTypes";
import layers from "./views/layers";
import RankPanel from "./components/RankPanel";
export default class MainBase extends eui.UILayer {
constructor() {
......@@ -14,6 +25,40 @@ export default class MainBase extends eui.UILayer {
check_webp_feature();
}
protected registerModules() {
const panels = [
[ModuleTypes.ALERT_PANEL, { cls: Alert }],
[ModuleTypes.RULE_PANEL, { cls: RulePanel }],
[ModuleTypes.HTML_RULE_PANEL, { cls: HTMLRulePanel }],
[ModuleTypes.OPTIONS_PANEL, { cls: OptionsPanel }],
[ModuleTypes.PRIZE_PANEL, { cls: PrizePanel }],
[ModuleTypes.RANK_PANEL, { cls: RankPanel }],
];
const scenes = [
[ModuleTypes.START_SCENE, this.startSceneConfig],
[ModuleTypes.PALY_SCENE, this.playSceneConfig]
];
panels.forEach(item => PanelCtrl.instance.registerPanel(item[0], item[1]));
scenes.forEach(item => SceneCtrl.instance.registerScene(item[0], item[1]));
NetManager.ins.onNotSuccess = (msg) => {
showAlertPanel(msg)
}
}
protected get startSceneConfig() {
return { cls: StartSceneBase }
}
protected get playSceneConfig() {
return { cls: PlaySceneBase }
}
protected getData() {
NetManager.ins.getInfo();
}
protected createChildren(): void {
super.createChildren();
egret.lifecycle.addLifecycleListener((context) => {
......@@ -61,12 +106,6 @@ export default class MainBase extends eui.UILayer {
})
}
protected getData() {
}
protected registerModules() { }
private async runGame() {
await this.loadResource()
this.createGameScene();
......@@ -100,6 +139,6 @@ export default class MainBase extends eui.UILayer {
* Create scene interface
*/
protected createGameScene() {
SceneCtrl.instance.change(ModuleTypes.START_SCENE);
}
}
\ No newline at end of file
import Scene from "../views/Scene";
export default class PlaySceneBase extends Scene {
protected get skinKey() { return 'Play' }
}
\ No newline at end of file
import { getSkinPath } from "../../new_tc/utils";
export default class RankItem extends eui.ItemRenderer {
constructor() {
super();
this.skinName = getSkinPath('RankItem');
}
}
\ No newline at end of file
import Panel from "../views/Panel";
import { DataManager } from "../../tw/manager/DataManager";
import { NetManager } from "../../tw/manager/NetManager";
import RankItem from "./RankItem";
export default class RankPanel extends Panel {
public ruleBg:eui.Image;
public closeBtn:eui.Button;
public scroller:eui.Scroller;
public group:eui.Group;
public list:eui.List;
public title:eui.Image;
public dog:eui.Image;
public rankNum:eui.Label;
public userIdtxt:eui.Label;
public scoretxt:eui.Label;
public userItemBg:eui.Image;
public userRankNum:eui.Label;
public userId:eui.Label;
public userScore:eui.Label;
public num3:eui.Image;
public num2:eui.Image;
public num1:eui.Image;
async start() {
if (!DataManager.ins.realTimeRankData)
NetManager.ins.realtimerank((success:boolean) => {
if(success){
this.updatePanel();
}
},0);
else
this.updatePanel();
}
updatePanel() {
if(DataManager.ins.realTimeRankData && DataManager.ins.realTimeRankData.myUserData){
if(DataManager.ins.realTimeRankData.myUserData.rank == 1){
this.num1.visible = true;
}else if(DataManager.ins.realTimeRankData.myUserData.rank == 2){
this.num2.visible = true;
}else if(DataManager.ins.realTimeRankData.myUserData.rank == 3){
this.num3.visible = true;
}
this.userId.text = `我`;
this.userRankNum.text = DataManager.ins.realTimeRankData.myUserData && DataManager.ins.realTimeRankData.myUserData.rank ? `${DataManager.ins.realTimeRankData.myUserData.rank}` : '未上榜';
this.userScore.text = DataManager.ins.realTimeRankData.myUserData && DataManager.ins.realTimeRankData.myUserData.maxScore ? `${DataManager.ins.realTimeRankData.myUserData.maxScore}` : '暂无分数';
this.list.useVirtualLayout = false;
this.list.itemRenderer = RankItem;
const ac = new eui.ArrayCollection(DataManager.ins.realTimeRankData.userList);
this.list.dataProvider = ac;
// console.log(this.list.$children)
setTimeout(()=>{
this.list.$children.forEach((rankItem)=>{
if(rankItem['userRankNum'].text == 1){
rankItem['num1'].visible = true;
}else if(rankItem['userRankNum'].text == 2){
rankItem['num2'].visible = true;
}else if(rankItem['userRankNum'].text == 3){
rankItem['num3'].visible = true;
}
})
},50)
}else{
this.userId.text = `我`;
this.userRankNum.text = `未上榜`;
this.userScore.text = `暂无分数`;
if(DataManager.ins.realTimeRankData.userList){
this.list.useVirtualLayout = false;
this.list.itemRenderer = RankItem;
const ac = new eui.ArrayCollection(DataManager.ins.realTimeRankData.userList);
this.list.dataProvider = ac;
// console.log(this.list.$children)
setTimeout(()=>{
this.list.$children.forEach((rankItem)=>{
if(rankItem['userRankNum'].text == 1){
rankItem['num1'].visible = true;
}else if(rankItem['userRankNum'].text == 2){
rankItem['num2'].visible = true;
}else if(rankItem['userRankNum'].text == 3){
rankItem['num3'].visible = true;
}
})
},50)
}
}
}
protected get skinKey() { return 'Rank' }
}
\ No newline at end of file
import Scene from "../views/Scene";
import { DataManager } from "../../tw/manager/DataManager";
import getStartBtnEnable from "../../new_tw/datas/getStartBtnEnable";
import getCountTxt from "../../new_tw/datas/getCountTxt";
import getIsIOS from "../../new_tc/getIsIOS";
import PanelCtrl from "../ctrls/panelCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import doStart from "../../new_tw/ctrls/doStart";
import SceneCtrl from "../ctrls/sceneCtrl";
export default class StartSceneBase extends Scene {
ruleBtn: eui.Button;
htmlRuleBtn: eui.Button;
optionBtn: eui.Button;
recordBtn: eui.Button;
startBtn: eui.Button;
rankBtn: eui.Button;
countTxt: eui.Label;
exemptionTxt: eui.Label;
async start(data?) {
this.updateGetInfoView();
this.updateExemptionTxt();
}
private updateGetInfoView() {
if (DataManager.ins.getInfoData) {
this.updateStartBtnStatus();
this.updateCountTxt();
} else {
DataManager.ins.once('dataUpdate', this.updateGetInfoView, this);
}
}
updateStartBtnStatus() {
if (this.startBtn)
this.startBtn.enabled = getStartBtnEnable();
}
updateCountTxt() {
if (this.countTxt)
this.countTxt.text = getCountTxt();
}
updateExemptionTxt() {
if (this.exemptionTxt) {
if (getIsIOS()) {
this.exemptionTxt.visible = true;
} else {
this.exemptionTxt.visible = false;
}
}
}
initEvents() {
if (this.ruleBtn)
this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
if (this.htmlRuleBtn)
this.htmlRuleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_htmlRuleBtn, this);
if (this.optionBtn)
this.optionBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_optionBtn, this);
if (this.recordBtn)
this.recordBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_recordBtn, this);
if (this.startBtn)
this.startBtn.once(egret.TouchEvent.TOUCH_TAP, this.onTap_startBtn, this);
if (this.rankBtn)
this.rankBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_rankBtn, this);
}
onTap_ruleBtn(e: egret.Event) {
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
onTap_htmlRuleBtn(e: egret.Event) {
PanelCtrl.instance.show(ModuleTypes.HTML_RULE_PANEL);
}
onTap_optionBtn(e: egret.Event) {
PanelCtrl.instance.show(ModuleTypes.OPTIONS_PANEL);
}
onTap_recordBtn(e: egret.Event) {
}
onTap_startBtn(e: egret.Event) {
doStart();
SceneCtrl.instance.change(ModuleTypes.PALY_SCENE);
}
onTap_rankBtn(e: egret.Event) {
PanelCtrl.instance.show(ModuleTypes.RANK_PANEL);
}
protected get skinKey() { return 'Start' }
}
\ No newline at end of file
......@@ -62,9 +62,9 @@ export default class PanelCtrl {
}
private _panelClassMap: any;
registerPanelClass(name, definition) {
registerPanel(name, config) {
this._panelClassMap = this._panelClassMap || {};
this._panelClassMap[name] = definition;
this._panelClassMap[name] = config.cls;
}
......
......@@ -29,8 +29,8 @@ export default class SceneCtrl {
}
private _sceneClassMap: any;
registerSceneClass(name, definition) {
registerScene(name, config) {
this._sceneClassMap = this._sceneClassMap || {};
this._sceneClassMap[name] = definition;
this._sceneClassMap[name] = config.cls;
}
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ export enum ModuleTypes {
ALERT_PANEL,
RULE_PANEL,
HTML_RULE_PANEL,
OPTIONS_PANEL,
PRIZE_PANEL
PRIZE_PANEL,
RANK_PANEL
}
\ No newline at end of file
{
"type": "activity",
"name": "fishing"
"name": "game"
}
\ No newline at end of file
......@@ -5,7 +5,7 @@
"name": "rule"
},
{
"keys": "ruleBtn_png,optionBtn_png,bg1_jpg,recordbtn_png",
"keys": "ruleBtn_png,optionBtn_png,recordbtn_png",
"name": "startscene"
},
{
......@@ -22,7 +22,7 @@
},
{
"name": "preload",
"keys": "bg2_jpg,guide1_png,guide2_png,发弹雾气_png,大炮板子_png,大炮的头_png,火_png,火箭_png,轮子1_png,音乐关闭_png,音乐开启_png"
"keys": "bg2_jpg,guide1_png,guide2_png,发弹雾气_png,大炮板子_png,大炮的头_png,火_png,火箭_png,轮子1_png,音乐关闭_png,音乐开启_png,bg_jpg,rankBtn_png,bottomLine_png,commonPanelBg_png,num1_png,num2_png,num3_png,rankTitle_png,userItemBg_png,closeBtn_png,dog_png"
}
],
"resources": [
......@@ -86,11 +86,6 @@
"type": "image",
"name": "prizePanelUseBtn_png"
},
{
"url": "assets/startScene/bg1.jpg",
"type": "image",
"name": "bg1_jpg"
},
{
"url": "assets/startScene/start_btn_gray.png",
"type": "image",
......@@ -160,6 +155,61 @@
"name": "音乐开启_png",
"type": "image",
"url": "assets/playscene/音乐开启.png"
},
{
"name": "bg_jpg",
"type": "image",
"url": "assets/startScene/bg.jpg"
},
{
"name": "rankBtn_png",
"type": "image",
"url": "assets/startScene/rankBtn.png"
},
{
"name": "bottomLine_png",
"type": "image",
"url": "assets/rank/bottomLine.png"
},
{
"name": "commonPanelBg_png",
"type": "image",
"url": "assets/rank/commonPanelBg.png"
},
{
"name": "num1_png",
"type": "image",
"url": "assets/rank/num1.png"
},
{
"name": "num2_png",
"type": "image",
"url": "assets/rank/num2.png"
},
{
"name": "num3_png",
"type": "image",
"url": "assets/rank/num3.png"
},
{
"name": "rankTitle_png",
"type": "image",
"url": "assets/rank/rankTitle.png"
},
{
"name": "userItemBg_png",
"type": "image",
"url": "assets/rank/userItemBg.png"
},
{
"name": "closeBtn_png",
"type": "image",
"url": "assets/rank/closeBtn.png"
},
{
"name": "dog_png",
"type": "image",
"url": "assets/rank/dog.png"
}
]
}
\ No newline at end of file
......@@ -8,6 +8,8 @@
"resource/skins/PrizeSkin.exml",
"resource/skins/RuleSkin.exml",
"resource/skins/StartSkin.exml",
"resource/skins/RankItemSkin.exml",
"resource/skins/RankSkin.exml",
"resource/skins/VScrollBarSkin.exml"
],
"path": "resource/default.thm.json"
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="RankItemSkin" width="506" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" height="72">
<e:Label id="userRankNum" text="{data.rank}" x="10" y="16" textColor="0x000000" anchorOffsetX="0" width="142" textAlign="center"/>
<e:Label id="userId" text="{data.cid}" y="16" textColor="0x000000" anchorOffsetX="0" width="195" textAlign="center" x="157"/>
<e:Label id="userScore" text="{data.maxScore}" y="16" textColor="0x000000" anchorOffsetX="0" width="149" textAlign="center" horizontalCenter="177.5"/>
<e:Image id="bottomLine" source="bottomLine_png" y="64.67" height="2" x="10"/>
<e:Image id="num3" source="num3_png" x="60" y="5" visible="false"/>
<e:Image id="num2" source="num2_png" x="60" y="5" visible="false"/>
<e:Image id="num1" source="num1_png" x="60" y="5" visible="false"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="RankSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="ruleBg" source="commonPanelBg_png" horizontalCenter="0.5" verticalCenter="-231"/>
<e:Button id="closeBtn" label="" horizontalCenter="256.5" verticalCenter="-600.5">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeBtn_png" source.down="closeBtn_png" source.disabled="closeBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Scroller id="scroller" width="528" x="112" height="450" y="510">
<e:Group id="group" width="100%" anchorOffsetY="0" height="450" y="0.67">
<e:List id="list" width="527" x="221" y="5" anchorOffsetX="0"/>
<e:layout>
<e:VerticalLayout/>
</e:layout>
</e:Group>
</e:Scroller>
<e:Image id="title" y="268.69" horizontalCenter="1.5" source="rankTitle_png"/>
<e:Image id="dog" source="dog_png" x="440" y="169"/>
<e:Label id="rankNum" text="排名" x="112" y="375" textColor="0x000000" bold="true" fontFamily="Microsoft YaHei" anchorOffsetX="0" width="162" textAlign="center"/>
<e:Label id="userIdtxt" text="用户" x="274" y="375" textColor="0x000000" bold="true" fontFamily="Microsoft YaHei" anchorOffsetX="0" width="200" textAlign="center"/>
<e:Label id="scoretxt" text="分数" x="474" y="375" textColor="0x000000" bold="true" fontFamily="Microsoft YaHei" anchorOffsetX="0" width="164" textAlign="center"/>
<e:Image id="userItemBg" source="userItemBg_png" x="112" y="424.88" anchorOffsetX="0" width="527.34"/>
<e:Label id="userRankNum" text="12000" x="122" y="448.38" textColor="0x000000" anchorOffsetX="0" width="142" textAlign="center"/>
<e:Label id="userId" text="1564421315" y="448.38" textColor="0x000000" anchorOffsetX="0" width="195" textAlign="center" horizontalCenter="0"/>
<e:Label id="userScore" text="156" y="448.38" textColor="0x000000" anchorOffsetX="0" width="149" textAlign="center" horizontalCenter="177.5"/>
<e:Image id="num3" source="num3_png" x="171.5" y="434" visible="false"/>
<e:Image id="num2" source="num2_png" x="171.5" y="434" visible="false"/>
<e:Image id="num1" source="num1_png" x="171.5" y="434" visible="false"/>
</e:Skin>
\ No newline at end of file
<?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:Image source="bg1_jpg" scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="0"/>
<e:Image scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="0" source="bg_jpg"/>
<e:Button id="startBtn" label="" scaleX="1" scaleY="1" y="780" horizontalCenter="0">
<e:skinName>
<e:Skin states="up,down,disabled">
......@@ -11,30 +11,44 @@
</e:Button>
<e:Label id="countTxt" text="Label" width="100%" verticalAlign="middle" textAlign="center" y="901" horizontalCenter="0"/>
<e:Label id="exemptionTxt" text="*兑换项与活动均与设备制造商Apple Inc.公司无关*" width="100%" horizontalCenter="0" bottom="5" verticalAlign="middle" textAlign="center" textColor="0x333333" size="18"/>
<e:Group x="0" y="17">
<e:Button id="recordBtn" label="" x="611" y="0">
<e:skinName>
<e:Button id="recordBtn" label="奖品记录" y="16" scaleX="1" scaleY="1" right="23">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="recordbtn_png" source.down="recordbtn_png" source.disabled="recordbtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0" size="26"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="optionBtn" label="奖品预览" y="16" scaleX="1" scaleY="1" horizontalCenter="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="recordbtn_png" source.down="recordbtn_png" source.disabled="recordbtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
<e:Image width="100%" height="100%" source="optionBtn_png" source.down="optionBtn_png" source.disabled="optionBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0" size="26"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="ruleBtn" label="" x="10" y="0">
<e:skinName>
</e:skinName>
</e:Button>
<e:Button id="ruleBtn" label="规则" y="16" scaleX="1" scaleY="1" left="30">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="ruleBtn_png" source.down="ruleBtn_png" source.disabled="ruleBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
<e:Image width="100%" height="100%" source="ruleBtn_png" source.down="ruleBtn_png" source.disabled="ruleBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0" size="26"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="optionBtn" label="" x="329" y="0">
<e:skinName>
</e:skinName>
</e:Button>
<e:Button id="rankBtn" label="排行榜" y="126" scaleX="1" scaleY="1" left="26">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="optionBtn_png" source.down="optionBtn_png" source.disabled="optionBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
<e:Image width="100%" height="100%" source="rankBtn_png" source.down="rankBtn_png" source.disabled="rankBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0" size="26"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Group>
</e:skinName>
</e:Button>
<e:Button id="htmlRuleBtn" label="HTML规则" y="126" scaleX="1" scaleY="1" horizontalCenter="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="ruleBtn_png" source.down="ruleBtn_png" source.disabled="ruleBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0" size="26"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Skin>
\ No newline at end of file
import Alert from "../libs/new_tl/components/Alert";
import OptionsPanel from "../libs/new_tl/components/OptionsPanel";
import PrizePanel from "../libs/new_tl/components/PrizePanel";
import RulePanel from "../libs/new_tl/components/RulePanel";
import PanelCtrl from "../libs/new_tl/ctrls/panelCtrl";
import SceneCtrl from "../libs/new_tl/ctrls/sceneCtrl";
import showAlertPanel from "../libs/new_tl/ctrls/showAlertPanel";
import MainBase from "../libs/new_tl/MainBase";
import { ModuleTypes } from "../libs/new_tl/types/sceneTypes";
import { NetManager } from "../libs/tw/manager/NetManager";
import StartScene from "./startScene/StartScene";
import PlayScene from "./playScene/PlayScene";
class Main extends MainBase {
protected registerModules() {
PanelCtrl.instance.registerPanelClass(ModuleTypes.ALERT_PANEL, Alert);
PanelCtrl.instance.registerPanelClass(ModuleTypes.RULE_PANEL, RulePanel);
PanelCtrl.instance.registerPanelClass(ModuleTypes.OPTIONS_PANEL, OptionsPanel);
PanelCtrl.instance.registerPanelClass(ModuleTypes.PRIZE_PANEL, PrizePanel);
SceneCtrl.instance.registerSceneClass(ModuleTypes.START_SCENE, StartScene);
SceneCtrl.instance.registerSceneClass(ModuleTypes.PALY_SCENE, PlayScene);
NetManager.ins.onNotSuccess = (msg) => {
showAlertPanel(msg)
}
}
protected getData() {
super.getData();
NetManager.ins.getInfo();
}
protected async createGameScene() {
SceneCtrl.instance.change(ModuleTypes.START_SCENE);
}
}
window['Main'] = Main;
egret.runEgret({
......
import Scene from "../../libs/new_tl/views/Scene";
export default class PlayScene extends Scene {
async start(data?) {
}
initEvents() {
}
protected get skinKey() { return 'Play' }
}
\ No newline at end of file
import PanelCtrl from "../../libs/new_tl/ctrls/panelCtrl";
import { ModuleTypes } from "../../libs/new_tl/types/sceneTypes";
import Scene from "../../libs/new_tl/views/Scene";
import doStart from "../../libs/new_tw/ctrls/doStart";
import SceneCtrl from "../../libs/new_tl/ctrls/sceneCtrl";
import { DataManager } from "../../libs/tw/manager/DataManager";
import getStartBtnEnable from "../../libs/new_tw/datas/getStartBtnEnable";
import getCountTxt from "../../libs/new_tw/datas/getCountTxt";
import getIsIOS from "../../libs/new_tc/getIsIOS";
import StartSceneBase from "../../libs/new_tl/components/StartSceneBase";
export default class StartScene extends StartSceneBase {
export default class StartScene extends Scene {
ruleBtn: eui.Button;
optionBtn: eui.Button;
recordBtn: eui.Button;
startBtn: eui.Button;
countTxt: eui.Label;
exemptionTxt: eui.Label;
async start(data?) {
this.updateGetInfoView();
this.updateExemptionTxt();
}
private updateGetInfoView() {
if (DataManager.ins.getInfoData) {
this.updateStartBtnStatus();
this.updateCountTxt();
} else {
DataManager.ins.once('dataUpdate', this.updateGetInfoView, this);
}
}
updateStartBtnStatus() {
if (!this.startBtn) return;
this.startBtn.visible = true;
this.startBtn.enabled = getStartBtnEnable();
egret.Tween.get(this.startBtn).set({ horizontalCenter: 750 }).to({ horizontalCenter: 0 }, 400, egret.Ease.elasticOut);
}
updateCountTxt() {
if (!this.countTxt) return;
this.countTxt.visible = true;
this.countTxt.text = getCountTxt();
egret.Tween.get(this.countTxt).set({ horizontalCenter: 750 }).wait(400).to({ horizontalCenter: 0 }, 300, egret.Ease.backOut);
}
updateExemptionTxt() {
if (this.exemptionTxt) {
if (getIsIOS()) {
this.exemptionTxt.visible = true;
} else {
this.exemptionTxt.visible = false;
}
}
}
initEvents() {
this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.optionBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_optionBtn, this);
this.recordBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_recordBtn, this);
this.startBtn.once(egret.TouchEvent.TOUCH_TAP, this.onTap_startBtn, this);
}
onTap_ruleBtn(e: egret.Event) {
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
onTap_optionBtn(e: egret.Event) {
PanelCtrl.instance.show(ModuleTypes.OPTIONS_PANEL);
}
onTap_recordBtn(e: egret.Event) {
}
onTap_startBtn(e: egret.Event) {
doStart();
SceneCtrl.instance.change(ModuleTypes.PALY_SCENE);
}
protected get skinKey() { return 'Start' }
}
\ 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