diff --git a/sonic-radiance.love/birb/modules/gui/screen/init.lua b/sonic-radiance.love/birb/modules/gui/screen/init.lua index beb54f5..e95bd14 100644 --- a/sonic-radiance.love/birb/modules/gui/screen/init.lua +++ b/sonic-radiance.love/birb/modules/gui/screen/init.lua @@ -43,26 +43,32 @@ end function GuiScreen:showSimple(focusElement, widgetId, page) focusElement = focusElement or self.defaultFocus - local time = 0 if (not self.isVisible) then self.isVisible = true - if (self.transforms["show"] ~= nil) then - time = self:playTransform("show") - end - - if (self.subscreens ~= nil) then - self.subscreens:show() - end - + local delay = 0 if (self.set ~= nil) then - self.set:setCurrentScreen(self.name) + delay = self.set:setCurrentScreen(self.name) end - if (focusElement) then - self.tweens:newFunc(time, "focus", function () self.gui:setFocus(focusElement, widgetId, page) end) + if (self.transforms["show"] ~= nil) then + if (delay == 0) then + self:showWithSubScreen(focusElement, widgetId, page) + else + self.tweens:newFunc(delay, "focus", function () self:showWithSubScreen(focusElement, widgetId, page) end) + end end end +end +function GuiScreen:showWithSubScreen(focusElement, widgetId, page) + self:playTransform("show") + if (focusElement ~= nil) then + self.gui:setFocus(focusElement, widgetId, page) + end + + if (self.subscreens ~= nil) then + self.subscreens:show() + end end function GuiScreen:setDatas(datas) @@ -70,9 +76,10 @@ function GuiScreen:setDatas(datas) end function GuiScreen:hide() + local time = 0 if (self.isVisible) then if (self.transforms["hide"] ~= nil) then - local time = self:playTransform("hide") + time = self:playTransform("hide") self.tweens:newFunc(time, "hide", function () self.isVisible = false end) @@ -82,7 +89,7 @@ function GuiScreen:hide() self.subscreens:hideCurrent() end end - + return time end function GuiScreen:addTransform(name, transform) diff --git a/sonic-radiance.love/birb/modules/gui/screen/screenset.lua b/sonic-radiance.love/birb/modules/gui/screen/screenset.lua index 357ba3f..78143d0 100644 --- a/sonic-radiance.love/birb/modules/gui/screen/screenset.lua +++ b/sonic-radiance.love/birb/modules/gui/screen/screenset.lua @@ -29,6 +29,7 @@ function ScreenSet:new(owner) self.defaultScreen = "" self.currentScreen = "" self.owner = owner + self.delay = 0 end function ScreenSet:show(screenName) @@ -47,15 +48,18 @@ end function ScreenSet:setCurrentScreen(screenName) screenName = screenName or self.defaultScreen - self:hideCurrent() + local time = self:hideCurrent() + self.delay self.currentScreen = screenName + return time end function ScreenSet:hideCurrent() + local time = 0 if (self.currentScreen ~= "") then - self.set[self.currentScreen]:hide() + time = self.set[self.currentScreen]:hide() self.currentScreen = "" end + return time end function ScreenSet:add(screen, setAsDefault)