Preload properly with g_textures.preload

* Thanks Baxnie for advising me of this method :)
master
BeniS 11 years ago
parent f4f9e319d8
commit 039c3072dc

@ -25,10 +25,9 @@ function init()
contentsPanel = cooldownWindow:getChildById('contentsPanel') contentsPanel = cooldownWindow:getChildById('contentsPanel')
cooldownPanel = contentsPanel:getChildById('cooldownPanel') cooldownPanel = contentsPanel:getChildById('cooldownPanel')
-- load cooldown icons -- preload cooldown images
local iconIds = Spells.getSpellIconIds() for k,v in pairs(SpelllistSettings) do
for k,id in pairs(iconIds) do g_textures.preload(v.iconFile)
loadIcon(id):destroy()
end end
if g_game.isOnline() then if g_game.isOnline() then
@ -58,7 +57,7 @@ function loadIcon(iconId)
icon:setId(iconId) icon:setId(iconId)
end end
icon:setImageSource('/images/game/spells/' .. SpelllistSettings[profile].iconFile) icon:setImageSource('/images/game/spells/'..SpelllistSettings[profile].iconFile)
icon:setImageClip(Spells.getImageClip(clientIconId, profile)) icon:setImageClip(Spells.getImageClip(clientIconId, profile))
return icon return icon
end end

@ -50,7 +50,7 @@ function init()
-- load condition icons -- load condition icons
for k,v in pairs(Icons) do for k,v in pairs(Icons) do
loadIcon(k):destroy() g_textures.preload(v.path)
end end
if g_game.isOnline() then if g_game.isOnline() then

@ -371,6 +371,17 @@ function Spells.getSpellIconIds()
return ids return ids
end end
function Spells.getSpellProfileById(id)
for profile,data in pairs(SpellInfo) do
for k,spell in pairs(data) do
if spell.id == id then
return profile
end
end
end
return nil
end
function Spells.getSpellProfileByWords(words) function Spells.getSpellProfileByWords(words)
for profile,data in pairs(SpellInfo) do for profile,data in pairs(SpellInfo) do
for k,spell in pairs(data) do for k,spell in pairs(data) do

Loading…
Cancel
Save