import { IGameUI, UIComponent } from './shared'; export class GameUI implements IGameUI { static list: Map> = new Map(); constructor( public readonly name: string, public readonly component: C ) {} /** * 根据 ui 名称获取 ui 实例 * @param id ui 的名称 */ static get(id: string): GameUI | null { const ui = this.list.get(id) as GameUI; return ui ?? null; } }