123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { _decorator, Component, Enum, Node } from 'cc';
- import { Mode, ModeName } from '../enum/Mode';
- import { GameMgr } from '../manager/GameMgr';
- import { TransMgr } from '../manager/TransMgr';
- import { UIMgr } from '../manager/UIMgr';
- import { UI } from '../enum/UI';
- const { ccclass, property } = _decorator;
- @ccclass('UIItem/MainItem')
- export class MainItem extends Component {
- @property(Node)
- private tip: Node = null
- @property({ type: Enum(Mode) })
- public mode: Mode = Mode.ls
- private btnStart: Node = null
- private btnUnlock: Node = null
- protected onLoad(): void {
- this.btnStart = this.node.getChildByName('BtnStart')
- this.btnUnlock = this.node.getChildByName('BtnUnlock')
- }
- protected start(): void {
- this.updateState()
- }
- private updateState(): void {
- this.tip.active = false
- this.btnUnlock.active = false
- }
- protected async onBtnStartClick() {
- await TransMgr.Inst.fadeIn()
- TransMgr.Inst.fadeOut()
- UIMgr.close(UI.Main)
- GameMgr.mode = this.mode
- GameMgr.mode = Mode.ls
- GameMgr.startGame()
- }
- protected onBtnUnlockClick(): void {
- GameMgr.unlockMode(this.mode)
- this.updateState()
- }
- }
|