|
|
@@ -19,6 +19,12 @@ export default class UISystem extends cc.Component {
|
|
|
private curOnPanelDic: { [key: string]: cc.Node } = {};
|
|
|
/** 上一个打开的界面名称 */
|
|
|
private lastOpenPanelName: string = "";
|
|
|
+
|
|
|
+ /** onLoad */
|
|
|
+ onLoad() {
|
|
|
+ //自行赋值
|
|
|
+ mk.ui = this;
|
|
|
+ }
|
|
|
|
|
|
/** start */
|
|
|
start() {
|
|
|
@@ -51,16 +57,16 @@ export default class UISystem extends cc.Component {
|
|
|
let node_panel = cc.instantiate(prefab);
|
|
|
self.curOnPanelDic[panelName] = node_panel;
|
|
|
|
|
|
+ if (self.panelParent) {
|
|
|
+ self.panelParent = self.node;
|
|
|
+ }
|
|
|
+
|
|
|
//如果父节点不存在,就默认把该节点定为panel的父节点
|
|
|
if (!self.panelParent) {
|
|
|
console.error("[UISystem] UI的父节点panelParent为null,请检查脚本挂载情况");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (self.panelParent) {
|
|
|
- self.panelParent = self.node;
|
|
|
- }
|
|
|
-
|
|
|
self.panelParent.addChild(node_panel);
|
|
|
|
|
|
switch (openAction) {
|