家族模拟器首版:修仙/经营/战斗/外交/叙事全套系统 - Electron + React + TS + MetonaSqlark(aria+OPFS) - 水墨中国风 UI - 引擎种子随机、确定性可回放 - 19 项单元测试、端到端冒烟验证
22 lines
561 B
TypeScript
22 lines
561 B
TypeScript
import { World, WorldEventBus } from '../src/renderer/game/engine/world'
|
|
import { LogItem, ChronicleEntry, BattleLog } from '../src/renderer/game/types/domain'
|
|
|
|
const sinks: Set<WorldEventBus> = new Set()
|
|
|
|
resetSaveBus()
|
|
export function resetSaveBus(): void {
|
|
sinks.clear()
|
|
}
|
|
|
|
export function attachLogSink(w: World): void {
|
|
const bus: WorldEventBus = {
|
|
onLog: () => undefined,
|
|
onChronicle: () => undefined,
|
|
onBattle: () => undefined,
|
|
onPendingEvent: () => undefined,
|
|
onGameOver: () => undefined
|
|
}
|
|
sinks.add(bus)
|
|
w.out.push(bus)
|
|
}
|