import EventManager from "../Event/EventManager"; import { EventName } from "../Event/EventName"; import Tool from "../Tool/Tool"; import BasicObject from "./BasicObject"; /** * 基础视窗 - 表现层 */ export default abstract class BasicView extends BasicObject { /**资源路径 */ public static readonly resPath: string; /**fgui节点 */ public fgui: fgui.GComponent; /**初始化视窗 */ public initView (fgui: fgui.GComponent, data: any): void { this.fgui = fgui; this.customData = data; this.resize(); this._initView(); EventManager.onEvent(EventName.Time.Time_Pause, this, this.pauseView); EventManager.onEvent(EventName.Time.Time_Resume, this, this.resumeView); } /**刷新视窗,创建时不会调佣 */ public refreshView (): void{ this._refreshView(); } /**清理视窗 */ public clearView (): void{ this._clearView(); } /**初始化视窗 */ protected abstract _initView (): void; /**刷新视窗,创建时不会调佣 */ protected abstract _refreshView (): void; /**清理视窗 */ protected abstract _clearView (): void; /**暂停窗口 */ protected pauseView (): void { } /**恢复窗口 */ protected resumeView (): void { } /**适配窗口 */ protected resize () { } _destroy (): void { Tool.Tool2D.Button.removeEvent(null, this.fgui.id); super._destroy(); this.node.destroy(); } }