import { EventTarget } from 'cc'; /** * 全局事件总线,用于模块间解耦通信。 */ export enum GameEvents { GAME_START = 'GAME_START', GAME_PAUSE = 'GAME_PAUSE', GAME_RESUME = 'GAME_RESUME', GAME_SUCCESS = 'GAME_SUCCESS', GAME_DEFEAT = 'GAME_DEFEAT', SHOP_UPDATED = 'SHOP_UPDATED', BLOCK_SELECTION_OPEN = 'BLOCK_SELECTION_OPEN', BLOCK_SELECTION_CLOSE = 'BLOCK_SELECTION_CLOSE' } export default class EventBus extends EventTarget { private static _instance: EventBus; private constructor() { super(); } public static getInstance(): EventBus { if (!this._instance) { this._instance = new EventBus(); } return this._instance; } }