core/menusystem: update widgets id each time a new widget is added
This commit is contained in:
parent
6fb00518bb
commit
cad0cbc071
1 changed files with 7 additions and 0 deletions
|
@ -109,6 +109,7 @@ function Menu:addWidget(newwidget)
|
|||
self.widget.selected = 1
|
||||
end
|
||||
table.insert(self.widget.list, newwidget)
|
||||
self:updateWidgetsID()
|
||||
end
|
||||
|
||||
function Menu:updateWidgets(dt)
|
||||
|
@ -119,6 +120,12 @@ function Menu:updateWidgets(dt)
|
|||
end
|
||||
end
|
||||
|
||||
function Menu:updateWidgetsID()
|
||||
for i,v in ipairs(self.widget.list) do
|
||||
v.id = i
|
||||
end
|
||||
end
|
||||
|
||||
function Menu:removeDestroyedWidgets() -- On retire les widgets marquées comme supprimées
|
||||
for i,v in ipairs(self.widget.list) do
|
||||
if (v.destroyed == true) then
|
||||
|
|
Loading…
Reference in a new issue