From 4e04cd7cba76a360df8d437a6974350109538397 Mon Sep 17 00:00:00 2001 From: dgflash Date: Fri, 18 Nov 2022 17:57:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DGUI=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E5=9C=A8=E9=9D=9E=E7=A7=BB=E5=8A=A8=E5=B9=B3=E5=8F=B0=E4=B8=8D?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/core/Root.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/core/Root.ts b/assets/core/Root.ts index 327440e..0ac4ddc 100644 --- a/assets/core/Root.ts +++ b/assets/core/Root.ts @@ -2,7 +2,7 @@ * @Author: dgflash * @Date: 2021-07-03 16:13:17 * @LastEditors: dgflash - * @LastEditTime: 2022-11-01 15:44:57 + * @LastEditTime: 2022-11-18 17:56:04 */ import { Component, director, game, Game, JsonAsset, log, Node, sys, view, _decorator } from "cc"; import { LanguageManager } from "../libs/gui/language/Language"; @@ -26,14 +26,14 @@ export class Root extends Component { type: Node, tooltip: "游戏层" }) - game: Node | null = null; + game: Node = null!; /** 界面层节点 */ @property({ type: Node, tooltip: "界面层" }) - gui: Node | null = null; + gui: Node = null!; onLoad() { console.log(`Oops Framework v${version}`); @@ -79,8 +79,8 @@ export class Root extends Component { oops.language = new LanguageManager(); oops.timer = new TimerManager(this); oops.audio = AudioManager.instance; - oops.game = new GameManager(this.game!); - oops.gui = new LayerManager(this.gui!); + oops.game = new GameManager(this.game); + oops.gui = new LayerManager(this.gui); this.initGui(); this.initEcsSystem(); @@ -107,8 +107,8 @@ export class Root extends Component { }); // 游戏尺寸修改事件 + var c_gui = this.gui.addComponent(GUI)!; if (sys.isMobile == false) { - var c_gui = this.gui?.addComponent(GUI)!; view.setResizeCallback(() => { c_gui.resize(); oops.message.dispatchEvent(EventMessage.GAME_RESIZE);