import { _decorator, AssetManager, assetManager, Component, find, instantiate, Label, Node, Prefab, sys, screen } from 'cc'; import { Config, nav_info } from './NavInfo'; import { UtilsPanel } from './UtilsPanel'; const { ccclass } = _decorator; @ccclass('MainScene') export class MainScene extends Component { private node_tip: Node = null; private lb_tip: Label = null; protected onLoad(): void { // if (sys.isBrowser || sys.isMobile) screen.requestFullScreen() UtilsPanel.getAllNeedCom(this, find("Canvas"), true); nav_info.init(); nav_info.scene = this; Config.init(); this.loadPrefab(); } private loadPrefab(){ assetManager.loadBundle(nav_info.bundle, (err:any, bundle:AssetManager.Bundle)=>{ if(err)return; bundle.load("prefab/" + nav_info.pre, Prefab, (err:any, pre:Prefab)=>{ let new_node = instantiate(pre); new_node.setParent(find("Canvas")); this.node_tip.setSiblingIndex(-1); }) }) } public showTip(str:string){ this.unschedule(this.hideTip); this.node_tip.active = true; this.lb_tip.string = str; this.scheduleOnce(this.hideTip, 2) } private hideTip(){ this.node_tip.active = false; } }