123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { _decorator, Component, Node, Prefab, director, instantiate } from 'cc';
- import { GameNode } from './GameNode';
- import { GameUI } from './GameUI';
- import { HallUI } from './HallUI';
- import WindowManager from '../core/manager/WindowManager';
- import platformSystem from '../platform/platformSystem';
- import { bundleMgr } from '../core/manager/BundleManager';
- import { GameConst } from '../core/common/GameConst';
- import { audioMgr } from '../core/manager/AudioManager';
- import { settingData } from '../user/SettingData';
- import BasePanel from '../core/component/BasePanel';
- import Data from '../core/manager/Data';
- const { ccclass, property } = _decorator;
- @ccclass('Main')
- export class Main extends BasePanel {
- @property({type:Node,tooltip:"资源加载lable"})
- public start_bg: Node;
- public static I: Main;
- _HallUI: HallUI = null;
- _GameUI: GameUI = null;
- _GameNode: GameNode = null;
- start(){
- if(settingData.data.bgMusic){
- audioMgr.play(GameConst.audios.bg_music,true);
- }
- Main.I = this;
- WindowManager.ins.register(this.node)
- WindowManager.ins.open("HallUI").then(panle => {
- this._HallUI = panle
- })
- WindowManager.ins.open("GameUI").then(async panle => {
- this._GameUI = panle;
- this._GameUI.node.active = false;
- let res: any = await bundleMgr.loadAsset(GameConst.bundleName.resources,"prefabs/GameNode",Prefab)
- this._GameNode = instantiate(res).getComponent(GameNode);
- director.getScene().addChild(this._GameNode.node);
- })
- }
- play() {
- this.start_bg.active = false;
- 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.start_bg.active = true;
- this._GameNode.node.active = false;
- this._HallUI.node.active = true;
- this._GameUI.node.active = false;
- }
- }
|