Skip to content

Commit 70ff6d2

Browse files
committed
fix(sdk): do not load the spritesheet if it's already in texturecache
1 parent 65a46e8 commit 70ff6d2

File tree

1 file changed

+9
-6
lines changed
  • engine/modules/entities/src/main/resources/view/entity-module

1 file changed

+9
-6
lines changed

engine/modules/entities/src/main/resources/view/entity-module/Command.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,18 @@ export class LoadCommand {
9696
trimmed: false
9797
}
9898
}
99-
100-
this.loader.add('data:text/json;charset=UTF-8,' + JSON.stringify(data), {crossOrigin: true})
99+
if (!PIXI.utils.TextureCache.hasOwnProperty('data:text/json;charset=UTF-8,' + JSON.stringify(data) + '_image')) {
100+
this.loader.add('data:text/json;charset=UTF-8,' + JSON.stringify(data), {crossOrigin: true})
101+
}
101102
}
102103

103104
apply () {
104-
return new Promise((resolve) => {
105-
this.loader.load()
106-
this.loader.on('complete', resolve)
107-
})
105+
if (Object.keys(this.loader.resources).length > 0) {
106+
return new Promise((resolve) => {
107+
this.loader.load()
108+
this.loader.on('complete', resolve)
109+
})
110+
}
108111
}
109112
}
110113

0 commit comments

Comments
 (0)