是否不支持 Cocos Creator 2.3.0

我尝试了以下代码:
@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.jpg
已邀请:

PtBTWc

赞同来自:

已解决,背景颜色问题

要回复问题请先登录注册