import { BgmController } from './audio/bgm'; import { SoundController } from './audio/sound'; import { EventEmitter } from './common/eventEmitter'; import { loading, readyAllResource } from './loader/load'; import { ResourceStore, ResourceType } from './loader/resource'; import { UiController } from './main/custom/ui'; import { GameEvent, hook } from './main/game'; import { fixedUi, mainUi } from './main/init/ui'; import { GameStorage } from './main/storage'; import { resolvePlugin } from './plugin'; import './main/init/'; import './main/custom/toolbar'; interface AncTePlugin { pop: ReturnType; use: ReturnType; animate: ReturnType; utils: ReturnType; status: ReturnType; fly: ReturnType; chase: ReturnType; webglUtils: ReturnType; shadow: ReturnType; gameShadow: ReturnType< typeof import('../plugin/shadow/gameShadow').default >; achievement: ReturnType; completion: ReturnType; path: ReturnType; gameCanvas: ReturnType; noise: ReturnType; smooth: ReturnType; frag: ReturnType; } export interface Mota { sound: SoundController; /** 游戏资源 */ resource: ResourceStore>; zipResource: ResourceStore<'zip'>; bgm: BgmController; plugin: AncTePlugin; game: { hook: EventEmitter; storage: typeof GameStorage; }; ui: { main: UiController; fixed: UiController; }; } function ready() { window.mota = { bgm: new BgmController(), resource: new ResourceStore(), zipResource: new ResourceStore(), sound: new SoundController(), // @ts-ignore plugin: {}, game: { hook, storage: GameStorage }, ui: { main: mainUi, fixed: fixedUi } }; readyAllResource(); loading.once('coreInit', resolvePlugin); } ready();