Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Commit

Permalink
add support for binary/misc files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Meltzow committed Oct 10, 2017
1 parent 9598105 commit 9ce33d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/generateAssetsClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ if (!Object.keys(loaderTypes.misc).length) {
shell.ShellString('\n static getName(): string { return \'' + i.split('/').pop() + '\'; }\n').toEnd(assetsClassFile);

for (var t in loaderTypes.misc[i]) {
shell.ShellString('\n static get' + loaderTypes.misc[i][t].toUpperCase() + '(): string { return require(\'assets/' + i + '.' + loaderTypes.misc[i][t] + '\'); }').toEnd(assetsClassFile);
shell.ShellString('\n static getFile(): string { return require(\'assets/' + i + '.' + loaderTypes.misc[i][t] + '\'); }').toEnd(assetsClassFile);
}

shell.ShellString('\n }').toEnd(assetsClassFile);
Expand Down
9 changes: 9 additions & 0 deletions src/utils/assetUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ export class Loader {
}
}

private static loadMisc() {
for (let misc in Assets.Misc) {
if (!this.game.cache.checkBinaryKey(Assets.Misc[misc].getName())) {
this.game.load.binary(Assets.Misc[misc].getName(), Assets.Misc[misc].getFile());
}
}
}

public static loadAllAssets(game: Phaser.Game, onComplete?: Function, onCompleteContext?: any) {
this.game = game;

Expand All @@ -188,6 +196,7 @@ export class Loader {
this.loadText();
this.loadScripts();
this.loadShaders();
this.loadMisc();
}

public static waitForSoundDecoding(onComplete: Function, onCompleteContext?: any) {
Expand Down

0 comments on commit 9ce33d1

Please sign in to comment.