DaFuWeng/assets/Script/UIRoot.ts

35 lines
740 B
TypeScript
Raw Normal View History

2024-03-11 17:37:03 +08:00
import { _decorator, assetManager, Component, instantiate, Node, Prefab, UITransform } from 'cc';
import { StartGameUINode } from './StartGameUINode';
2024-03-09 13:17:48 +08:00
const { ccclass, property } = _decorator;
@ccclass('UIRoot')
export class UIRoot extends Component {
2024-03-11 17:37:03 +08:00
init(){
const startGameUINode = new StartGameUINode();
startGameUINode.addComponent( UITransform).setContentSize(1067,600);
2024-03-09 13:17:48 +08:00
2024-03-11 17:37:03 +08:00
this.node.addChild(startGameUINode);
console.log(this.node.parent.children);
console.log('StartUINode');
2024-03-09 13:17:48 +08:00
2024-03-11 17:37:03 +08:00
}
2024-03-09 13:17:48 +08:00
2024-03-11 17:37:03 +08:00
start() {
this.node.addComponent( UITransform ).setContentSize(1067,600);
this.init();
2024-03-09 13:17:48 +08:00
}
update(deltaTime: number) {
}
}