import { _decorator, Component, Label, Node } from 'cc'; import { rootMgr } from '../../scene/RootMgr'; import { FMSType } from '../../GameContorl/fms/FMSGameInit'; import { aa } from 'db://assets/scripts/aa'; import { UI_Setting } from '../UIDialog/setting/UI_Setting'; import { UI_Rank } from '../UIDialog/rank/UI_Rank'; import { UI_AddCollect } from '../UIDialog/addCollect/UI_AddCollect'; import { UI_NeedCoin } from '../UIDialog/needCoin/UI_NeedCoin'; import { UI_NeedLife } from '../UIDialog/needLife/UI_NeedLife'; import { UI_Collect } from '../UIDialog/collect/UI_Collect'; import { toggleBreath } from '../../util/Customize_Ani'; import { Stage } from '../../data/stage/Stage'; const { ccclass, property } = _decorator; @ccclass('HomeLayout') export class HomeLayout extends Component { @property(Node) settingBtn: Node @property(Node) rankBtn: Node @property(Node) mycollectBtn: Node @property(Node) addCollectBtn: Node @property(Node) startGameBtn: Node @property(Node) addCoinBtn: Node @property(Node) addLifeBtn: Node @property(Label) levelLabel: Label protected start(): void { toggleBreath(this.startGameBtn, 0.8) this.settingBtn.on(Node.EventType.TOUCH_END, this.showSetting, this) this.rankBtn.on(Node.EventType.TOUCH_END, this.showRank, this) this.mycollectBtn.on(Node.EventType.TOUCH_END, this.showMyCollect, this) this.addCollectBtn.on(Node.EventType.TOUCH_END, this.showaddCollect, this) this.startGameBtn.on(Node.EventType.TOUCH_END, this.startGame, this) this.addCoinBtn.on(Node.EventType.TOUCH_END, this.showAddCoinBtn, this) this.addLifeBtn.on(Node.EventType.TOUCH_END, this.showAddLifeBtn, this) let stage = rootMgr.dataControl.getCompent(Stage) this.levelLabel.string = "关卡 " + stage.index } startGame() { rootMgr.game.Change(FMSType.Start) } showSetting() { aa.uIMgr.showUI(UI_Setting) } showRank() { aa.uIMgr.showUI(UI_Rank) } showMyCollect() { aa.uIMgr.showUI(UI_Collect) } showaddCollect() { aa.uIMgr.showUI(UI_AddCollect) } showAddLifeBtn() { aa.uIMgr.showUI(UI_NeedLife) } showAddCoinBtn() { aa.uIMgr.showUI(UI_NeedCoin) } }