mirror of
https://github.com/motajs/template.git
synced 2026-11-02 15:04:30 +08:00
feat(03-01): add Node-safe core state construction
- isolate legacy loading behind internal dependencies - provide memory saves and remove singleton back-edges
This commit is contained in:
1 parent
51d1796358
commit
a707be4856
9 files changed
+310
-64
No files matched your search
@@ -70,13 +70,18 @@ class GameLoading extends EventEmitter<GameLoadEvent> {
|
||||
}
|
||||
|
||||
export const loading = new GameLoading();
|
||||
main.loading = loading;
|
||||
if (typeof main !== 'undefined') {
|
||||
main.loading = loading;
|
||||
}
|
||||
|
||||
let clientRegistered = false;
|
||||
let dataRegistered = false;
|
||||
|
||||
function checkRegistered() {
|
||||
if (main.replayChecking || main.mode === 'editor') {
|
||||
if (
|
||||
typeof main !== 'undefined' &&
|
||||
(main.replayChecking || main.mode === 'editor')
|
||||
) {
|
||||
clientRegistered = true;
|
||||
}
|
||||
if (clientRegistered && dataRegistered) {
|
||||
@@ -168,8 +173,8 @@ class GameListener extends EventEmitter<ListenerEvent> {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
if (main.replayChecking) return;
|
||||
if (window.core) {
|
||||
if (typeof main === 'undefined' || main.replayChecking) return;
|
||||
if (typeof window !== 'undefined' && window.core) {
|
||||
this.init();
|
||||
} else {
|
||||
loading.once('coreInit', () => {
|
||||
|
||||
@@ -40,7 +40,7 @@ export class HeroMover<T extends IHeroLocation>
|
||||
readonly tile: T,
|
||||
faceHandler: IFaceHandler<FaceDirection>
|
||||
) {
|
||||
super(faceHandler, tile.getCurrentFaceDirection());
|
||||
super(faceHandler, FaceDirection.Unknown);
|
||||
this.state = tile.state;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user