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

26 lines
727 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";
const { ccclass, property } = _decorator;
//主界面场景
@ccclass('MainScene')
export class MainScene extends Component {
@property(Node)
UIRoot: Node = null
@property(Node)
UILayerMod: Node = null
@property(Camera)
MainCamera: Camera = null
start() {
//每个场景必须添加的
let gameRootUI = this.node.getComponent(GameRootUI)
if (!gameRootUI){
gameRootUI = this.node.addComponent(GameRootUI)
2025-07-30 21:52:26 +08:00
gameRootUI.InitByCreate(this.UIRoot, this.UILayerMod, "ThemePanel");
2025-07-17 17:18:21 +08:00
}
GameRootUI.MainCamera = this.MainCamera
}
}