Spell List: Small tweaks

Tweaks and formatting.
This commit is contained in:
Samuel
2012-10-07 04:17:45 +02:00
parent a83be17bfe
commit 8536c61c01
2 changed files with 18 additions and 10 deletions

View File

@@ -136,7 +136,8 @@ function init()
g_keyboard.bindKeyPress('Down', function() spellList:focusNextChild(KeyboardFocusReason) end, spelllistWindow)
g_keyboard.bindKeyPress('Up', function() spellList:focusPreviousChild(KeyboardFocusReason) end, spelllistWindow)
for index, spell in ipairs(spellDisplayOrder) do
for i = 1, #spellDisplayOrder do
local spell = spellDisplayOrder[i]
local info = SpellInfo[spell]
local tmpLabel = g_ui.createWidget('SpellListLabel', spellList)
tmpLabel:setId(spell)
@@ -164,6 +165,11 @@ function terminate()
disconnect(g_game, { onGameStart = setupOptions,
onGameEnd = resetWindow })
disconnect(spellList, { onChildFocusChange = function(self, focusedChild)
if focusedChild == nil then return end
updateSpellInformation(focusedChild)
end })
spelllistButton:destroy()
spelllistButton = nil
spelllistWindow:destroy()
@@ -204,7 +210,8 @@ function terminate()
end
function updateSpelllist()
for index, spell in ipairs(spellDisplayOrder) do
for i = 1, #spellDisplayOrder do
local spell = spellDisplayOrder[i]
local info = SpellInfo[spell]
local tmpLabel = spellList:getChildById(spell)
@@ -236,7 +243,8 @@ function updateSpellInformation(widget)
name = spell
formula = info.words
for _, vocationId in ipairs(info.vocations) do
for i = 1, #info.vocations do
local vocationId = info.vocations[i]
if vocationId <= 4 or not(table.find(info.vocations, (vocationId-4))) then
vocation = vocation .. (vocation:len() == 0 and '' or ', ') .. VocationNames[vocationId]
end