50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import SKUIUtil from "./gear_2.3.4/util/SKUIUtil";
|
|
import FGUtil from "./gear_2.3.4/fgui/FGUtil";
|
|
import MsgAlert from "./game/msg/MsgAlert";
|
|
import GameModel from "./core/GameModel";
|
|
import Contact from "./contact/Contact";
|
|
const { ccclass, property } = cc._decorator;
|
|
@ccclass
|
|
export default class Friends extends cc.Component {
|
|
/**
|
|
* 單例實例
|
|
*/
|
|
public static Instance: Friends = null;
|
|
|
|
/**
|
|
* 主面板
|
|
*/
|
|
mainPanel: fgui.GComponent = null;
|
|
|
|
onLoad() {
|
|
if (Friends.Instance === null) {
|
|
Friends.Instance = this;
|
|
} else {
|
|
this.destroy();
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
openShopMainPanel() {
|
|
if (!SKUIUtil.isFGUIValid(this.mainPanel)) {
|
|
this.mainPanel = FGUtil.create("main_ui", "friend_panel");
|
|
FGUtil.root().addChild(this.mainPanel);
|
|
this.mainPanel.makeFullScreen();
|
|
}
|
|
|
|
FGUtil.getComponent(this.mainPanel, "mask").onClick(this.closeAll, this);
|
|
FGUtil.getButton(this.mainPanel, "alert/close").onClick(this.closeAll, this);
|
|
}
|
|
|
|
closeAll() {
|
|
if (SKUIUtil.isFGUIValid(this.mainPanel)) {
|
|
FGUtil.dispose(this.mainPanel)
|
|
this.mainPanel = null
|
|
}
|
|
if (SKUIUtil.isFGUIValid(Contact.Instance.contactPanel)) {
|
|
FGUtil.dispose(Contact.Instance.contactPanel)
|
|
Contact.Instance.contactPanel == null
|
|
}
|
|
}
|
|
} |