diff --git a/public/src/js/loader.js b/public/src/js/loader.js index 96b332b..6603c6a 100644 --- a/public/src/js/loader.js +++ b/public/src/js/loader.js @@ -86,7 +86,7 @@ class Loader{ }), url) } - assets.img.forEach(name => { + assets.img.forEach(name=>{ var id = this.getFilename(name) var image = document.createElement("img") var url = gameConfig.assets_baseurl + "img/" + name @@ -132,6 +132,20 @@ class Loader{ return } + assets.categories //load category backgrounds to DOM + .filter(cat=>cat.songSkin && cat.songSkin.bg_img) + .forEach(cat=>{ + let name = cat.songSkin.bg_img + var id = this.getFilename(name) + var image = document.createElement("img") + var url = gameConfig.assets_baseurl + "img/" + name + this.addPromise(pageEvents.load(image), url) + image.id = name + image.src = url + this.assetsDiv.appendChild(image) + assets.image[id] = image + }) + snd.buffer = new SoundBuffer() snd.musicGain = snd.buffer.createGain() snd.sfxGain = snd.buffer.createGain() diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index d319afb..6075c5a 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -107,7 +107,6 @@ class SongSelect{ category.songSkin.sort = sortCount sortCount += 1 } - this.songSkin[category.title] = category.songSkin } } @@ -2326,7 +2325,8 @@ class SongSelect{ drawBackground(cat, sort){ if(this.songSkin[cat] && this.songSkin[cat].bg_img){ - this.songSelect.style.backgroundImage = "url('assets/img/" + this.songSkin[cat].bg_img + "')" + let filename = this.songSkin[cat].bg_img.slice(0, this.songSkin[cat].bg_img.lastIndexOf(".")) + this.songSelect.style.backgroundImage = "url('" + assets.image[filename].src + "')" }else{ if(assets.image["bg_genre_" + sort]){ this.songSelect.style.backgroundImage = "url('" + assets.image["bg_genre_" + sort].src + "')"