Files
18xchat/assets/Scripts/Sub/MainScene.ts
T

30 lines
834 B
TypeScript
Raw Normal View History

2025-07-17 17:18:21 +08:00
import { _decorator, Camera, Component, Node } from "cc";
import GameRootUI from "../Main/Common/GameRootUI";
import { MainController } from "../chat18x/core/MainController";
2025-09-21 19:49:08 +08:00
import { logger } from "db://assets/Scripts/Main/Common/Logger";
2025-07-17 17:18:21 +08:00
const { ccclass, property } = _decorator;
//主界面场景
2025-09-11 12:31:10 +08:00
@ccclass("MainScene")
2025-07-17 17:18:21 +08:00
export class MainScene extends Component {
2025-09-11 12:31:10 +08:00
@property(Node)
UIRoot: Node = null;
@property(Node)
UILayerMod: Node = null;
@property(Camera)
MainCamera: Camera = null;
2025-07-17 17:18:21 +08:00
2025-09-20 18:41:10 +08:00
start() {}
init() {
2025-09-11 12:31:10 +08:00
//每个场景必须添加的
let gameRootUI = this.node.getComponent(GameRootUI);
if (!gameRootUI) {
gameRootUI = this.node.addComponent(GameRootUI);
gameRootUI.InitByCreate(this.UIRoot, this.UILayerMod, "NavigationPanel");
2025-07-17 17:18:21 +08:00
}
2025-09-11 12:31:10 +08:00
GameRootUI.MainCamera = this.MainCamera;
}
}