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