import GameModel from "./core/GameModel"; import FGUtil from "./gear_2.3.4/fgui/FGUtil"; import SKDataUtil from "./gear_2.3.4/util/SKDataUtil"; import SKUIUtil from "./gear_2.3.4/util/SKUIUtil"; const { ccclass, property } = cc._decorator; export default class PlayMethod extends cc.Component { static Instance: PlayMethod = new PlayMethod(); mainPanel: fgui.GComponent = null; static showPlayMethod(id: string) { if (!id) return; if (!SKDataUtil.isString(id)) { id = String(id); } var info; if (GameModel.conf_playing_method[id]) { info = GameModel.conf_playing_method[id]; } this.Instance.showPlayMethod(info); } showPlayMethod(info) { FGUtil.dispose(this.mainPanel) this.mainPanel = FGUtil.create("main_ui", "play_info_panel"); FGUtil.root().addChild(this.mainPanel); this.mainPanel.makeFullScreen(); FGUtil.getButton(this.mainPanel, "alert/close").onClick(this.closePanel, this); FGUtil.getComponent(this.mainPanel, "mask").onClick(this.closePanel, this); let rT = FGUtil.getRichTextField(this.mainPanel, "alert/info/title"); let str = ""; if (info && SKDataUtil.hasProperty(info, "content")) { str = info.content; } rT.text = str; if (info && SKDataUtil.hasProperty(info, "bg")) { FGUtil.getControl(this.mainPanel, "alert/bg").selectedIndex = info.bg; } } closePanel() { FGUtil.dispose(this.mainPanel) } }