mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 15:31:51 +08:00
preload all category images in loader.js
This commit is contained in:
parent
85d6e70ff6
commit
e1411bcd0d
@ -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()
|
||||
|
@ -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 + "')"
|
||||
|
Loading…
Reference in New Issue
Block a user