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
|
self.widget.selected = 1
|
||||||
end
|
end
|
||||||
table.insert(self.widget.list, newwidget)
|
table.insert(self.widget.list, newwidget)
|
||||||
|
self:updateWidgetsID()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Menu:updateWidgets(dt)
|
function Menu:updateWidgets(dt)
|
||||||
|
@ -119,6 +120,12 @@ function Menu:updateWidgets(dt)
|
||||||
end
|
end
|
||||||
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
|
function Menu:removeDestroyedWidgets() -- On retire les widgets marquées comme supprimées
|
||||||
for i,v in ipairs(self.widget.list) do
|
for i,v in ipairs(self.widget.list) do
|
||||||
if (v.destroyed == true) then
|
if (v.destroyed == true) then
|
||||||
|
|
Loading…
Reference in a new issue