ExperimentalGear/scripts/titlescreen/pages/boot/bootpage.lua

77 lines
2.4 KiB
Lua
Raw Normal View History

require("common.class")
require("common.filereader")
local Dim = require("common.dimensions")
local Version = require("common.version")
local Page = require("components.pager.page")
local ServiceField = require("titlescreen.fields.service.servicefield")
local ListField = require("titlescreen.fields.service.listfield")
local SelfTestField = require("titlescreen.fields.boot.selftestfield")
local function checkSkinConfig(obj)
local crewpath = "textures/crew/anim/" .. game.GetSkinSetting("single_idol")
if not IsDir(crewpath) then
return SelfTestStatusEnum.ERROR
end
end
local networkStatus = SelfTestStatusEnum.IDLE
local function irHeardbeat(res)
if res.statusCode == IRData.States.Success then
networkStatus = SelfTestStatusEnum.OK
else
networkStatus = SelfTestStatusEnum.ERROR
end
end
local function checkNetwork(obj)
if not IRData.Active then
return SelfTestStatusEnum.PASS
end
IR.Heartbeat(irHeardbeat)
end
---@class BootPage: Page
local BootPage = {
__tostring = function() return "BootPage" end,
}
---Create a new BootPage instance
---@param o? table # initial parameters
---@return BootPage
function BootPage:new(o)
o = o or {}
local this = Inherit(self, o, Page)
this:addField(ServiceField:new{posX = 32, posY = 32, label = Version.getLongVersion(), value = ""})
this:addField(ServiceField:new{posX = 64, posY = 64, label = "UNNAMED SDVX CLONE STARTUP...", value = ""})
local valueOffX = 220
local list = ListField:new{posX = 64, posY = 96}
list:addField(SelfTestField:new{label = "MAIN I/O", VALUE_OFFSETX = valueOffX, status = SelfTestStatusEnum.OK})
list:addField(SelfTestField:new{label = "SKIN CONFIG", VALUE_OFFSETX = valueOffX, status = SelfTestStatusEnum.OK, callback = checkSkinConfig})
list:addField(SelfTestField:new{label = "IR NETWORK", VALUE_OFFSETX = valueOffX, status = SelfTestStatusEnum.ERROR, callback = checkNetwork})
this:addField(list)
return this
end
---@param deltaTime number # frametime in seconds
function BootPage:drawBackground(deltaTime)
gfx.BeginPath()
gfx.FillColor(0, 0, 0)
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Fill()
end
function BootPage:render(deltaTime)
Page.render(self, deltaTime)
local skinconfig = self.content[3].content[2] --this is hacktastic
local network = self.content[3].content[3] --this is also hacktastic
end
return BootPage