|
|
@@ -1,12 +1,14 @@
|
|
|
+
|
|
|
+const { ccclass, property } = cc._decorator;
|
|
|
+@ccclass
|
|
|
/**
|
|
|
* UI管理类
|
|
|
* @author 冯聪
|
|
|
*/
|
|
|
-export default class UISystem {
|
|
|
+export default class UISystem extends cc.Component {
|
|
|
|
|
|
/** panel父节点 */
|
|
|
- public panelParent: cc.Node = null;
|
|
|
-
|
|
|
+ private panelParent: cc.Node = null;
|
|
|
/** 界面预制体路径 */
|
|
|
private panelPrefanbUrl: string = './prefab/uiPanel/'
|
|
|
/** 是否正在打开界面 */
|
|
|
@@ -18,6 +20,14 @@ export default class UISystem {
|
|
|
/** 上一个打开的界面名称 */
|
|
|
private lastOpenPanelName: string = "";
|
|
|
|
|
|
+ /** start */
|
|
|
+ start() {
|
|
|
+ //自己赋节点
|
|
|
+ if (!this.panelParent) {
|
|
|
+ this.panelParent = this.node;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 打开panel界面
|
|
|
* @param panelName 界面名称
|
|
|
@@ -42,7 +52,7 @@ export default class UISystem {
|
|
|
|
|
|
//如果父节点不存在,就默认把该节点定为panel的父节点
|
|
|
if (!this.panelParent) {
|
|
|
- console.error("[UISystem] UI的父节点panelParent为null,需指定UI打开的父节点");
|
|
|
+ console.error("[UISystem] UI的父节点panelParent为null,请检查脚本挂载情况");
|
|
|
return;
|
|
|
}
|
|
|
|