是否不支持 Cocos Creator 2.3.0
我尝试了以下代码:
并不能把UI内容显示出来。
这是 Scene 的内容,我将 LoginEntry 挂在了 NodeMgr 节点上
@ccclass
export default class LoginEntry extends cc.Component {
private _view: fgui.GComponent;
// LIFE-CYCLE CALLBACKS:
onLoad() {
fgui.addLoadHandler();
// 创建 fgui 的根节点
fgui.GRoot.create();
this.addComponent(Login);
}
start() {}
// update (dt) {}
}
@ccclass
export default class Login extends cc.Component {
private _view: fgui.GComponent;
// LIFE-CYCLE CALLBACKS:
onLoad() {
fgui.UIPackage.loadPackage('UI/Login', this.onUILoaded.bind(this));
}
onUILoaded(err) {
console.log(fgui.UIPackage.getByName('Login'));
this._view = fgui.UIPackage.createObject('Login', 'Main').asCom;
fgui.GRoot.inst.addChild(this._view);
}
start() {}
// update (dt) {}
}
并不能把UI内容显示出来。
这是 Scene 的内容,我将 LoginEntry 挂在了 NodeMgr 节点上
没有找到相关结果
已邀请:
1 个回复
PtBTWc
赞同来自: