import { _decorator, Component, Node, Prefab, director, instantiate, AudioSource } from 'cc'; import WindowManager from '../../core/manager/WindowManager'; import Utils from '../../core/utils/Utils'; import { GameNode } from './GameNode'; import { GameUI } from './GameUI'; import { HallUI } from './HallUI'; import platformSystem from 'db://assets/platform/platformSystem'; const { ccclass, property } = _decorator; @ccclass('Main') export class Main extends Component { static _instance: Main = null; public static Instance(): Main { return Main._instance; } _HallUI: HallUI = null; _GameUI: GameUI = null; _GameNode: GameNode = null; start() { Main._instance = this; WindowManager.ins.register(this.node) WindowManager.ins.open("HallUI").then(panle => { this._HallUI = panle }) WindowManager.ins.open("GameUI").then(panle => { this._GameUI = panle; this._GameUI.node.active = false; }) Utils.loadRes("GameNode", "prefabs", Prefab, (err, res) => { this._GameNode = (instantiate(res) as Node).getComponent(GameNode); director.getScene().addChild(this._GameNode.node); }) } play() { this._HallUI.node.active = false; this._GameUI.node.active = true; this._GameUI.restart(); this._GameNode.node.active = true; this._GameNode.restart(); platformSystem.platform.hideBannerAd(); } backHall() { platformSystem.platform.showBannerAd(); this._GameNode.node.active = false; this._HallUI.node.active = true; this._GameUI.node.active = false; } }