moved service page and service field to page API

This commit is contained in:
Hersi 2022-06-29 00:24:59 +02:00
parent f543cd21f4
commit a6a95cbd9c
2 changed files with 4 additions and 6 deletions

View File

@ -2,7 +2,7 @@ require("common.class")
local Dim = require("common.dimensions") local Dim = require("common.dimensions")
local Util = require("common.util") local Util = require("common.util")
local Page = require("api.page.page") local Page = require("api.page.page")
local ServiceField = require("titlescreen.components.servicefield") local ServiceField = require("api.page.servicefield")
---@class ServicePage: Page ---@class ServicePage: Page
---@field title string|string[] ---@field title string|string[]
@ -52,7 +52,7 @@ function ServicePage:refreshFields()
if index == self.selectedIndex then if index == self.selectedIndex then
field:focus() field:focus()
else else
field:deactivate() field:unfocus()
end end
end end
Page.refreshFields(self) Page.refreshFields(self)
@ -72,9 +72,7 @@ function ServicePage:handleButtonInput(button)
local direction = 0 local direction = 0
if button == game.BUTTON_BCK then if button == game.BUTTON_BCK then
if self.viewHandler then self:onInvalidation()
self.viewHandler:back()
end
return return
elseif button == game.BUTTON_BTA then elseif button == game.BUTTON_BTA then
direction = -1 direction = -1
@ -83,7 +81,7 @@ function ServicePage:handleButtonInput(button)
end end
if direction ~= 0 then if direction ~= 0 then
field:deactivate() field:unfocus()
self.selectedIndex = Util.modIndex(self.selectedIndex + direction, #self.content) self.selectedIndex = Util.modIndex(self.selectedIndex + direction, #self.content)