import { _decorator, Component, game, Node} from 'cc'; import { config } from './config'; import { tools } from './tools'; import { uiManager } from './manager/uiManager'; import { home } from './ui/home/home'; import { loading_view } from './ui/loading_view'; import { SdkUtil } from './sdkUtil'; const { ccclass, property } = _decorator; @ccclass('main') export class main extends Component { @property(Node) home_node:Node = null; @property(Node) ui_parent = null; @property(Node) laoding_view_wait = null; @property(Node) send_msg_wait = null; private m_home_view:Node = null protected start(): void { game.frameRate = 61; //修复 iphone 15 抖动问题 // PhysicsSystem2D.instance.fixedTimeStep = 1 / 60; SdkUtil.init() tools.init(this.node) this.home_node.removeAllChildren() uiManager.Instance().init(this.ui_parent,this.laoding_view_wait,this.send_msg_wait) this.preloadHomeView() this.showLoadingView() } private showLoadingView() { uiManager.Instance().showUi(config.UI.loading_view, this.node, (node:Node)=>{ node.getComponent(loading_view).startLoading(()=>{ this.showHomeView() }) }) } private preloadHomeView() { this.home_node.active = false uiManager.Instance().showUi(config.UI.home,this.home_node,(node:Node)=>{ this.m_home_view = node }) } private showHomeView() { this.home_node.active = true setTimeout(()=>{ this.m_home_view.getComponent(home).init() },20) } }