import { EP } from "./enmu"; import { gameManager, stageManager, windows, residentList } from "./Game"; // @ts-ignore const t = import.meta.globEager("./stages/**/page_*.ts"); // 场景切换监听 stageManager.watchStageChange((stage, lastStage) => { if (lastStage && lastStage.type === EP.Normal) { let lastWindow = windows[lastStage.name]; lastWindow.onUnLoad && lastWindow.onUnLoad(); } if (stage && stage.type === EP.Normal) { let curWindow = windows[stage.name]; curWindow.onLoad && curWindow.onLoad(); } }); gameManager.ticker.add((dt: number) => { let curWindow = windows[stageManager.curStage.name]; residentList.forEach(v=>v.update&&v.update(dt, v.stage.name)) stageManager.curStage && curWindow && curWindow.update && curWindow.update(dt, curWindow.stage.name); gameManager.render(); stageManager.curStage && curWindow && curWindow.lateUpdate && curWindow.lateUpdate(dt, curWindow.stage.name); residentList.forEach(v=>v.lateUpdate&&v.lateUpdate(dt, v.stage.name)) }); stageManager.initStage("welcome");