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