1
0
Fork 0

Added timestamp to assets URLs to bypass browser cache

This commit is contained in:
Michaël Lemaire 2018-03-08 22:11:14 +01:00
parent b24dd86a66
commit ce2b94fe83
2 changed files with 6 additions and 6 deletions

View file

@ -83,7 +83,7 @@ function pack(stage) {
return { return {
type: "atlasJSONHash", type: "atlasJSONHash",
key: fname, key: fname,
atlasURL: `assets/${fname}.json`, atlasURL: `assets/${fname}.json?t=${Date.now()}`,
textureURL: `assets/${fname}.png`, textureURL: `assets/${fname}.png`,
atlasData: null atlasData: null
} }
@ -97,7 +97,7 @@ function pack(stage) {
return { return {
type: "audio", type: "audio",
key: key, key: key,
urls: [`assets/${key}.${ext}`], urls: [`assets/${key}.${ext}?t=${Date.now()}`],
autoDecode: (ext == 'mp3') autoDecode: (ext == 'mp3')
}; };
}))); })));
@ -111,7 +111,7 @@ function pack(stage) {
return { return {
type: "shader", type: "shader",
key: key, key: key,
url: `assets/${key}.${ext}` url: `assets/${key}.${ext}?t=${Date.now()}`
}; };
}))); })));
}); });

View file

@ -41,7 +41,7 @@ module TK.SpaceTac.UI {
if (this.required >= AssetLoadingRange.MENU && AssetLoading.loaded < AssetLoadingRange.MENU) { if (this.required >= AssetLoadingRange.MENU && AssetLoading.loaded < AssetLoadingRange.MENU) {
console.log("Loading menu assets"); console.log("Loading menu assets");
this.load.pack("stage1", "assets/pack1.json"); this.load.pack("stage1", `assets/pack1.json?t=${Date.now()}`);
// TODO pack // TODO pack
this.loadSheet("common/particles.png", 32); this.loadSheet("common/particles.png", 32);
@ -50,12 +50,12 @@ module TK.SpaceTac.UI {
if (this.required >= AssetLoadingRange.BATTLE && AssetLoading.loaded < AssetLoadingRange.BATTLE) { if (this.required >= AssetLoadingRange.BATTLE && AssetLoading.loaded < AssetLoadingRange.BATTLE) {
console.log("Loading battle assets"); console.log("Loading battle assets");
this.load.pack("stage2", "assets/pack2.json"); this.load.pack("stage2", `assets/pack2.json?t=${Date.now()}`);
} }
if (this.required >= AssetLoadingRange.CAMPAIGN && AssetLoading.loaded < AssetLoadingRange.CAMPAIGN) { if (this.required >= AssetLoadingRange.CAMPAIGN && AssetLoading.loaded < AssetLoadingRange.CAMPAIGN) {
console.log("Loading campaign assets"); console.log("Loading campaign assets");
this.load.pack("stage3", "assets/pack3.json"); this.load.pack("stage3", `assets/pack3.json?t=${Date.now()}`);
} }
this.load.start(); this.load.start();