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
|
end
|
||||||
|
|
||||||
function ElementList:haveFocus()
|
function ElementList:haveFocus()
|
||||||
return self:elementExists(self.focusedElement)
|
return self:elementIsVisible(self.focusedElement)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ElementList:getFocusedElement()
|
function ElementList:getFocusedElement()
|
||||||
|
@ -81,4 +81,11 @@ function ElementList:getVisibleElement(topLayer)
|
||||||
return visibleList
|
return visibleList
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ElementList:elementIsVisible(name)
|
||||||
|
if (self:elementExists(name)) then
|
||||||
|
return self.elements[name]:getVisibility()
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
return ElementList
|
return ElementList
|
|
@ -80,18 +80,16 @@ function GuiScreen:registerElements()
|
||||||
local elemData = utils.table.parse(rawElement, elementDataStruct, 3)
|
local elemData = utils.table.parse(rawElement, elementDataStruct, 3)
|
||||||
local element = elemData.element
|
local element = elemData.element
|
||||||
self:addElement(element.name, element)
|
self:addElement(element.name, element)
|
||||||
|
if (elemData.focus == true) then
|
||||||
|
element:getFocus()
|
||||||
|
end
|
||||||
if (elemData.delay > 0) then
|
if (elemData.delay > 0) then
|
||||||
element.isVisible = false
|
element.isVisible = false
|
||||||
element:newSwitch(elemData.delay, {"isVisible"})
|
element:newSwitch(elemData.delay, {"isVisible"})
|
||||||
print(elemData.delay)
|
|
||||||
end
|
end
|
||||||
if (elemData.depth ~= nil) then
|
if (elemData.depth ~= nil) then
|
||||||
element.depth = elemData.depth
|
element.depth = elemData.depth
|
||||||
end
|
end
|
||||||
print(element, element.name, elemData.depth, elemData.focus)
|
|
||||||
if (elemData.focus == true) then
|
|
||||||
element:getFocus()
|
|
||||||
end
|
|
||||||
if (elemData.keypress ~= nil) then
|
if (elemData.keypress ~= nil) then
|
||||||
element:setKeyPressAction(elemData.keypress)
|
element:setKeyPressAction(elemData.keypress)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue