Refonte pour utiliser le systeme de GUI #112
2 changed files with 11 additions and 6 deletions
|
@ -46,7 +46,7 @@ function ElementList:elementExists(name)
|
|||
end
|
||||
|
||||
function ElementList:haveFocus()
|
||||
return self:elementExists(self.focusedElement)
|
||||
return self:elementIsVisible(self.focusedElement)
|
||||
end
|
||||
|
||||
function ElementList:getFocusedElement()
|
||||
|
@ -81,4 +81,11 @@ function ElementList:getVisibleElement(topLayer)
|
|||
return visibleList
|
||||
end
|
||||
|
||||
function ElementList:elementIsVisible(name)
|
||||
if (self:elementExists(name)) then
|
||||
return self.elements[name]:getVisibility()
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
return ElementList
|
|
@ -80,18 +80,16 @@ function GuiScreen:registerElements()
|
|||
local elemData = utils.table.parse(rawElement, elementDataStruct, 3)
|
||||
local element = elemData.element
|
||||
self:addElement(element.name, element)
|
||||
if (elemData.focus == true) then
|
||||
element:getFocus()
|
||||
end
|
||||
if (elemData.delay > 0) then
|
||||
element.isVisible = false
|
||||
element:newSwitch(elemData.delay, {"isVisible"})
|
||||
print(elemData.delay)
|
||||
end
|
||||
if (elemData.depth ~= nil) then
|
||||
element.depth = elemData.depth
|
||||
end
|
||||
print(element, element.name, elemData.depth, elemData.focus)
|
||||
if (elemData.focus == true) then
|
||||
element:getFocus()
|
||||
end
|
||||
if (elemData.keypress ~= nil) then
|
||||
element:setKeyPressAction(elemData.keypress)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue