feat(core/menusystem): make work the selectAction

This commit is contained in:
Kazhnuz 2019-08-22 21:31:56 +02:00
parent 42837c6fbd
commit 76eb9b1482
5 changed files with 14 additions and 0 deletions

View file

@ -55,6 +55,7 @@ end
function FlowBox:update(dt) function FlowBox:update(dt)
self:updateView() self:updateView()
self:updateSelectedWidget(dt)
end end
function FlowBox:updateView() function FlowBox:updateView()

View file

@ -140,6 +140,7 @@ end
function GridBox:update(dt) function GridBox:update(dt)
self.view.firstSlot = 1 self.view.firstSlot = 1
self:updateSelectedWidget(dt)
end end
-- KEYS FUNCTIONS -- KEYS FUNCTIONS

View file

@ -50,6 +50,7 @@ end
function HListBox:update(dt) function HListBox:update(dt)
self:updateView() self:updateView()
self:updateSelectedWidget(dt)
end end
function HListBox:updateView() function HListBox:updateView()

View file

@ -50,6 +50,7 @@ end
function ListBox:update(dt) function ListBox:update(dt)
self:updateView() self:updateView()
self:updateSelectedWidget(dt)
end end
function ListBox:updateView() function ListBox:updateView()

View file

@ -158,6 +158,16 @@ end
function Menu:update(dt) function Menu:update(dt)
-- Cette fonction ne contient rien par défaut -- Cette fonction ne contient rien par défaut
self:updateSelectedWidget(dt)
end
function Menu:updateSelectedWidget(dt)
if (self.widget.selected ~= self.widget.previous) and (self.isActive) then
if (self.widget.list[self.widget.selected] ~= nil) then
self.widget.list[self.widget.selected]:selectAction()
self.widget.previous = self.widget.selected
end
end
end end
-- DRAW FUNCTIONS -- DRAW FUNCTIONS