continue refactoring

This commit is contained in:
Hersi 2024-02-02 02:27:05 +01:00
parent 941e0421ea
commit 1c82b44e34
15 changed files with 242 additions and 212 deletions

View File

@ -1,25 +1,16 @@
require "api.logging"
require "common.class"
require "api.filesys"
require "api.graphics"
local Image = require "api.image"
---@class AnimationParams
---@field fps number?
---@field loop boolean?
---@field loopPoint integer?
---@field width number?
---@field height number?
---@field x number?
---@field y number?
---@field scaleX number?
---@field scaleY number?
---@field centered boolean?
---@field blendOp integer?
---@field color number[]?
---@field alpha number?
---@field stroke StrokeParams?
---@class AnimationParam: Animation
---@field animPath string
---@field animFPS number
---@class Animation
---@field frames Image[]
@ -38,7 +29,7 @@ local Image = require "api.image"
---@field color number[]?
---@field alpha number?
---@field stroke StrokeParams?
local Animation = { };
local Animation = { }
---@class AnimationState
---@field animation Animation # The animation data this state is playing through
@ -46,72 +37,61 @@ local Animation = { };
---@field timer number # Timer used to determine when to change to the next frame
---@field running boolean # Is the animation currently running and accepting updates?
---@field callback function? # Called when the animation completes
local AnimationState = { };
local AnimationState = { }
---Load Animation Frames from path
---@param animPath string
---@return Image[]
---@return integer
local function loadSequentialAnimationFrames(animPath)
local frames = { };
local count = 0;
local frames = { } ---@type Image[]
local count = 0
local detectedFormat = nil;
local anim_files = filesys.scandir(filesys.fromTexturePath(animPath))
while (true) do
local frame = nil;
if (detectedFormat) then
frame = Image.new(detectedFormat:format(animPath, count + 1), true);
else
for i = 1, 4 do
local format = '%s/%0' .. i .. 'd.png';
frame = Image.new(format:format(animPath, count + 1), true);
for index, frame_path in ipairs(anim_files) do
frame_path = filesys.join(filesys.normpath(animPath), frame_path)
DetailedLog("Frame "..index..": '"..frame_path.."'", game.LOGGER_DEBUG)
local frame = Image.new(frame_path, true)
if (frame) then
detectedFormat = format;
break;
end
end
if not frame then
DetailedLog("Could not load frame image '"..frame_path.."'", game.LOGGER_ERROR)
break
end
if (not frame) then
break;
end
count = count + 1;
frames[count] = frame;
frames[index] = frame
count = count + 1
end
return frames, count;
return frames, count
end
---Animation constructor
---@param animPath string
---@param params AnimationParams
---@param params AnimationParam
---@return Animation
function Animation.new(animPath, params)
function Animation.new(params)
local self = CreateInstance(Animation, params)
local frames, frameCount = loadSequentialAnimationFrames(animPath);
self.frames, self.frameCount = loadSequentialAnimationFrames(params.animPath)
local instance = {
frames = frames,
frameCount = frameCount,
self.frameTime = 1 / (params.animFPS or 30)
self.loop = params.loop or false
self.loopPoint = params.loopPoint or 1
frameTime = 1 / (params.fps or 30),
loop = params.loop or false,
loopPoint = params.loopPoint or 1,
};
self.width = params.width
self.height = params.height
self.x = params.x
self.y = params.y
self.scaleX = params.scaleX
self.scaleY = params.scaleY
self.centered = params.centered
self.blendOp = params.blendOp
self.color = params.color
self.alpha = params.alpha
self.stroke = params.stroke
if (params.width ~= nil) then instance.width = params.width; end
if (params.height ~= nil) then instance.height = params.height; end
if (params.x ~= nil) then instance.x = params.x; end
if (params.y ~= nil) then instance.y = params.y; end
if (params.scaleX ~= nil) then instance.scaleX = params.scaleX; end
if (params.scaleY ~= nil) then instance.scaleY = params.scaleY; end
if (params.centered ~= nil) then instance.centered = params.centered; end
if (params.blendOp ~= nil) then instance.blendOp = params.blendOp; end
if (params.color ~= nil) then instance.color = params.color; end
if (params.alpha ~= nil) then instance.alpha = params.alpha; end
if (params.stroke ~= nil) then instance.stroke = params.stroke; end
return CreateInstance(Animation, instance);
return self
end
---Create an AnimationState to play this animation.
@ -120,85 +100,85 @@ end
---@return AnimationState
function Animation:createState(callback)
---@type AnimationState
local state = { animation = self, callback = callback, frameIndex = 1, timer = 0, running = false };
return CreateInstance(AnimationState, state);
local state = { animation = self, callback = callback, frameIndex = 1, timer = 0, running = false }
return CreateInstance(AnimationState, state)
end
---Create an AnimationState to play this animation and start it.
---@param callback function?
---@return AnimationState
function Animation:start(callback)
local state = self:createState(callback);
state:start();
local state = self:createState(callback)
state:start()
return state;
return state
end
---Start this AnimationState.
---Does nothing if it's already running.
function AnimationState:start()
self.running = true;
self.running = true
end
---Restart this AnimationState.
---The frame index is reset to 1.
function AnimationState:restart()
self.running = true;
self.frameIndex = 1;
self.timer = 0;
self.running = true
self.frameIndex = 1
self.timer = 0
end
---Stop this AnimationState.
function AnimationState:stop()
self.running = false;
self.running = false
end
---Updates this AnimationState and then renders it, passing on the given ImageParams to each frame.
---@param deltaTime number
---@param params? ImageParams
function AnimationState:render(deltaTime, params)
if (not self.running) then return; end;
if (not self.running) then return end
self.timer = self.timer + deltaTime;
self.timer = self.timer + deltaTime
while (self.timer > self.animation.frameTime) do
self.timer = self.timer - self.animation.frameTime;
self.frameIndex = self.frameIndex + 1;
self.timer = self.timer - self.animation.frameTime
self.frameIndex = self.frameIndex + 1
if (self.frameIndex > self.animation.frameCount) then
if (self.animation.loop) then
self.frameIndex = self.animation.loopPoint;
self.frameIndex = self.animation.loopPoint
else
self.running = false;
self.running = false
if (self.callback) then
self.callback();
self.callback()
end
return;
return
end
end
end
if (params) then
if (params.width == nil) then params.width = self.animation.width; end
if (params.height == nil) then params.height = self.animation.height; end
if (params.x == nil) then params.x = self.animation.x; end
if (params.y == nil) then params.y = self.animation.y; end
if (params.scaleX == nil) then params.scaleX = self.animation.scaleX; end
if (params.scaleY == nil) then params.scaleY = self.animation.scaleY; end
if (params.centered == nil) then params.centered = self.animation.centered; end
if (params.blendOp == nil) then params.blendOp = self.animation.blendOp; end
if (params.alpha == nil) then params.alpha = self.animation.alpha; end
if (params.stroke == nil) then params.stroke = self.animation.stroke; end
if (params.width == nil) then params.width = self.animation.width end
if (params.height == nil) then params.height = self.animation.height end
if (params.x == nil) then params.x = self.animation.x end
if (params.y == nil) then params.y = self.animation.y end
if (params.scaleX == nil) then params.scaleX = self.animation.scaleX end
if (params.scaleY == nil) then params.scaleY = self.animation.scaleY end
if (params.centered == nil) then params.centered = self.animation.centered end
if (params.blendOp == nil) then params.blendOp = self.animation.blendOp end
if (params.alpha == nil) then params.alpha = self.animation.alpha end
if (params.stroke == nil) then params.stroke = self.animation.stroke end
end
local frame = self.animation.frames[self.frameIndex];
local frame = self.animation.frames[self.frameIndex]
if (not frame) then
-- TODO(local): what do
else
frame:render(params);
frame:render(params)
end
end
return Animation;
return Animation

View File

@ -1,6 +1,6 @@
require "api.platform"
local FileSys = require "api.platform.filesys_impl"
filesys = require "api.platform.filesys_impl"
if os.name() == Platform.WINDOWS then
require "api.platform.win.filesys"
@ -13,5 +13,3 @@ else
game.Log("OS Platform not recognized, loading linux filesys module", game.LOGGER_WARNING)
require "api.platform.linux.filesys"
end
return FileSys

35
scripts/api/logging.lua Normal file
View File

@ -0,0 +1,35 @@
---Return a string representation of where this function was called from
---@param affix? string
---@param stack_level? integer
---@return string
function Where(affix, stack_level)
stack_level = stack_level or 2
local fun_name = debug.getinfo(stack_level, "n").name
local current_file = debug.getinfo(stack_level, "S").source
local current_line = debug.getinfo(stack_level, "l").currentline
--remove redundant path components
current_file = current_file:gsub("([@=]?).*[\\/]skins[\\/]", "%1")
local where = current_file..":"..current_line
if fun_name then
where = where.." ("..fun_name..")"
end
if affix then
where = where..affix
end
return where
end
---Same as game.Log, but prefixed with where the call happened
---@param message string
---@param severity integer
function DetailedLog(message, severity)
game.Log(Where(": ", 3)..message, severity)
end

View File

@ -1,36 +1,21 @@
require "common.globals"
require "common.class"
---@type PageRegistry
local instance = nil
require "api.logging"
---@class PageRegistry
---@field pages Page[]
local PageRegistry = {
__name = "PageManager"
__name = "PageManager",
pages = {},
}
---Create new PageManager instance
---Reset and initialize PageManager global
---@param params? PageRegistry
---@return PageRegistry
function PageRegistry.new(params)
function PageRegistry:init(params)
params = params or {}
local self = CreateInstance(PageRegistry, params)
self.pages = params.pages or {}
return self
end
---Get PageManager instance
---@return PageRegistry
function PageRegistry.get()
if not instance then
instance = PageRegistry.new()
end
return instance
end
---Store page with default name
@ -65,4 +50,17 @@ function PageRegistry:getPage(page)
return nil
end
---Get page by class
---
---Ensure valid page instance by creating and registering one, if not found
---@param page Page
function PageRegistry:getOrCreatePage(page)
if not self:getPage(page) then
page = page.new()
self:register(page)
end
return page
end
return PageRegistry

View File

@ -1,6 +1,9 @@
require "common.globals"
require "api.logging"
---@note setup code from: https://stackoverflow.com/a/30960054
local BinaryFormat = package.cpath:match("%p[\\|/]?%p(%a+)")
local BinaryFormat = package.cpath:match("%?%.(%a+)")
DetailedLog("BinaryFormat: " .. BinaryFormat, game.LOGGER_DEBUG)
if BinaryFormat == "dll" then
function os.name()
@ -14,6 +17,11 @@ elseif BinaryFormat == "dylib" then
function os.name()
return "MacOS"
end
else
DetailedLog("Could not identify binary format", game.LOGGER_WARNING)
function os.name()
return nil
end
end
BinaryFormat = nil

View File

@ -1,4 +1,5 @@
require "common.globals"
require "api.logging"
---@class FileSys
local FileSys = {
@ -6,6 +7,8 @@ local FileSys = {
sep = "/"
}
setmetatable(FileSys, FileSys)
---Return a normalized absolutized version of `path`
---@param path string
---@return string
@ -33,7 +36,7 @@ end
function FileSys.exists(path)
local ok, err, code = os.rename(path, path)
if not ok then
game.Log("err: "..err..", code: "..code, game.LOGGER_DEBUG)
DetailedLog("err: "..err..", code: "..code, game.LOGGER_DEBUG)
if code == 13 then
-- Permission denied, but it exists
return true
@ -42,11 +45,24 @@ function FileSys.exists(path)
return ok, err
end
---Returns a path relative to the current working directory from a texture path
---@param path string # must be a path accepted by game.CreateSkinImage and such
---@return string
function FileSys.fromTexturePath(path)
--skins/<skin>/textures/<path>
local relpath = FileSys.join("skins", game.GetSkin(), "textures", FileSys.normpath(path))
if not FileSys.exists(FileSys.join(FileSys.getcwd(), relpath)) then
DetailedLog("'"..relpath.."' does not exist", game.LOGGER_ERROR)
end
return relpath
end
---Return a string representing the current working directory
---@return string
function FileSys.getcwd()
assert(false, FileSys.__name .. ".getcwd() : Not Implemented")
return ""
error(FileSys.__name .. ".getcwd() : Not Implemented")
end
---Join one or more path components with the platform specific separator
@ -66,9 +82,10 @@ end
---Normalize `path`, collapse redundant separators and up references
---@param path string
---@param overrideSep? string
---@return string
function FileSys.normpath(path)
local sep = FileSys.sep
function FileSys.normpath(path, overrideSep)
local sep = overrideSep or FileSys.sep
--remove multiple slashes
path = path:gsub("("..sep..")"..sep.."+", "%1")
@ -81,7 +98,7 @@ function FileSys.normpath(path)
local upRefPattern = "%w+"..sep.."%.%."..sep
repeat
path, count = path:gsub(upRefPattern, "")
until count ~= 0
until count == 0
--remove last slash
path = path:gsub("(.-)"..sep.."$", "%1")
@ -103,8 +120,7 @@ end
---@param path string
---@return string[]
function FileSys.scandir(path)
assert(false, FileSys.__name .. ".scandir() : Not Implemented")
return {}
error(FileSys.__name .. ".scandir() : Not Implemented")
end
---Split `path` to (head, tail), tail is the last component, head is everything else

View File

@ -6,9 +6,14 @@ function FileSys.getcwd()
local cwd, popen = "", io.popen
local pfile, err = popen("pwd")
if not pfile or err ~= 0 then
game.Log(tostring(FileSys) .. ".getcwd() : popen failed executing " .. tostring(err), game.LOGGER_ERROR)
return nil
if not pfile or err then
game.Log(FileSys.__name .. ".getcwd() : popen failed executing " .. tostring(err), game.LOGGER_ERROR)
if pfile then
pfile:close()
end
return nil, err
end
cwd = pfile:read()
@ -18,12 +23,21 @@ function FileSys.getcwd()
end
function FileSys.scandir(path)
if not FileSys.exists(path) then
return nil, "Incorrect or non-existent path"
end
local i, t, popen = 0, {}, io.popen
local pfile, err = popen('find "' .. path .. '" -maxdepth 1 -print0')
if not pfile or err ~= 0 then
game.Log(tostring(FileSys) .. ".scandir() : popen failed executing " .. tostring(err), game.LOGGER_ERROR)
return nil
if not pfile or err then
game.Log(FileSys.__name .. ".scandir() : popen failed executing " .. tostring(err), game.LOGGER_ERROR)
if pfile then
pfile:close()
end
return nil, err
end
for filename in pfile:lines() do

View File

@ -4,11 +4,16 @@ FileSys.sep = "\\"
function FileSys.getcwd()
local cwd, popen = "", io.popen
local pfile, err = popen("cd")
local pfile, err = popen("cmd /C cd")
if not pfile or err ~= 0 then
game.Log(tostring(FileSys) .. ".getcwd() : popen failed executing " .. tostring(err), game.LOGGER_ERROR)
return nil
if not pfile or err then
game.Log(FileSys.__name .. ".getcwd() : popen failed executing " .. tostring(err), game.LOGGER_ERROR)
if pfile then
pfile:close()
end
return nil, err
end
cwd = pfile:read()
@ -19,20 +24,29 @@ end
local baseNormpath = FileSys.normpath
function FileSys.normpath(path)
path = baseNormpath(path)
path = path:gsub("/", "\\")
path = baseNormpath(path)
return path
end
function FileSys.scandir(path)
local i, t, popen = 0, {}, io.popen
local pfile, err = popen('dir "' .. path .. '" /b /ad')
if not FileSys.exists(path) then
return nil, "Incorrect or non-existent path"
end
if not pfile or err ~= 0 then
game.Log(tostring(FileSys) .. ".scandir() : popen failed executing " .. tostring(err), game.LOGGER_ERROR)
return nil
local i, t, popen = 0, {}, io.popen
local pfile, err = popen('cmd /C dir "' .. path .. '" /b /a-d')
if not pfile or err then
game.Log(FileSys.__name .. ".scandir() : popen failed executing " .. tostring(err), game.LOGGER_ERROR)
if pfile then
pfile:close()
end
return nil, err
end
for filename in pfile:lines() do

View File

@ -32,6 +32,7 @@ function CreateInstance(cls, params, ...)
params = base.new(params)
end
end
--DetailedLog(debug.traceback(), game.LOGGER_DEBUG) -- here for debug purposes
setmetatable(params, cls)
return params
end

View File

@ -1,4 +1,5 @@
require("common.globals")
require "api.filesys"
--file reader utility functions
---Get game path

View File

@ -4,50 +4,18 @@ local Dim = require "common.dimensions"
local Wallpaper = require "components.wallpaper"
local PageView = require "api.page.pageview"
local PageManager = require "api.page.pagemanager"
local PageRegistry = require "api.page.pageregistry"
local BootPage = require "titlescreen.boot"
local CheckUpdatePage = require "titlescreen.boot.checkupdatepage"
local SplashPage = require "titlescreen.splash"
local KShootManiaPage = require "titlescreen.splash.kshootmaniapage"
local USCPage = require "titlescreen.splash.uscpage"
local TeamExceedPage = require "titlescreen.splash.teamexceedpage"
local CreditsPage = require "titlescreen.splash.creditspage"
local TitlePage = require "titlescreen.title"
local MainMenuPage = require "titlescreen.mainmenu"
local ServiceMenuPage = require "titlescreen.service"
local InputCheckPage = require "titlescreen.service.inputcheckpage"
local ScreenCheckPage = require "titlescreen.service.screencheckpage"
local ColorCheckPage = require "titlescreen.service.colorcheckpage"
local VersionInfoPage = require "titlescreen.service.versioninfopage"
local pageView = PageView.new()
local pageManager = PageManager.get()
pageManager:storePage(CheckUpdatePage.new())
pageManager:storePage(BootPage.new())
pageManager:storePage(KShootManiaPage.new())
pageManager:storePage(USCPage.new())
pageManager:storePage(TeamExceedPage.new())
pageManager:storePage(CreditsPage.new())
pageManager:storePage(SplashPage.new())
pageManager:storePage(TitlePage.new())
pageManager:storePage(MainMenuPage.new())
pageManager:storePage(InputCheckPage.new())
pageManager:storePage(ScreenCheckPage.new())
pageManager:storePage(ColorCheckPage.new())
pageManager:storePage(VersionInfoPage.new())
pageManager:storePage(ServiceMenuPage.new())
pageView.onNavigated = function(self, back)
game.Log(tostring(self) .. " navigated " .. (back and "back " or "") .. "to: " .. tostring(pageView:get()),
game.LOGGER_INFO
@ -58,41 +26,40 @@ pageView.onEmptied = function(self)
game.Log(tostring(self) .. " empty!", game.LOGGER_WARNING)
end
local pages = PageManager.get().pages
pageManager:getPage(BootPage).onInvalidation = function(self, toVersionPage)
PageRegistry:getOrCreatePage(BootPage).onInvalidation = function(self, toVersionPage)
if toVersionPage then
pageView:replace(pageManager:getPage(ServiceMenuPage))
pageView:replace(PageRegistry:getOrCreatePage(ServiceMenuPage))
pageView:get():init()
pageView:navigate(pageManager:getPage(VersionInfoPage))
pageView:navigate(PageRegistry:getOrCreatePage(VersionInfoPage))
pageView:get():init()
else
pageView:replace(pageManager:getPage(SplashPage))
pageView:replace(PageRegistry:getOrCreatePage(SplashPage))
pageView:get():init()
end
end
pageManager:getPage(SplashPage).onInvalidation = function(self)
pageView:replace(pageManager:getPage(TitlePage))
PageRegistry:getOrCreatePage(SplashPage).onInvalidation = function(self)
pageView:replace(PageRegistry:getOrCreatePage(TitlePage))
pageView:get():init()
end
pageManager:getPage(TitlePage).onInvalidation = function(self, toServiceMenu)
PageRegistry:getOrCreatePage(TitlePage).onInvalidation = function(self, toServiceMenu)
if toServiceMenu then
pageView:replace(pageManager:getPage(ServiceMenuPage))
pageView:replace(PageRegistry:getOrCreatePage(ServiceMenuPage))
pageView:get():init()
else
pageView:replace(pageManager:getPage(MainMenuPage))
pageView:replace(PageRegistry:getOrCreatePage(MainMenuPage))
pageView:get():init()
end
end
pageManager:getPage(ServiceMenuPage).onInvalidation = function(self)
pageView:replace(pageManager:getPage(SplashPage))
PageRegistry:getOrCreatePage(ServiceMenuPage).onInvalidation = function(self)
pageView:replace(PageRegistry:getOrCreatePage(SplashPage))
pageView:get():init()
end
--local currentScreen = game.GetSkinSetting("animations_skipIntro") and screens.title or screens.boot -- show boot screen if skipIntro is not set
pageView:replace(pages[BootPage.__name])
pageView:replace(PageRegistry:getOrCreatePage(BootPage))
pageView:get():init()
local function deltaKnob(delta)

View File

@ -4,7 +4,7 @@ require "common.filereader"
local Dim = require "common.dimensions"
local Version = require "common.version"
local PageManager = require "api.page.pagemanager"
local PageRegistry = require "api.page.pageregistry"
local Page = require "api.page.page"
local CheckUpdatePage = require "titlescreen.boot.checkupdatepage"
@ -26,10 +26,10 @@ function BootPage.new(params)
local self = CreateInstance(BootPage, params, Page)
local pageManager = PageManager.get()
local checkUpdatePage = PageRegistry:getOrCreatePage(CheckUpdatePage)
self._networkResult = {}
pageManager:getPage(CheckUpdatePage).onInvalidation = function (page_self, reason)
checkUpdatePage.onInvalidation = function (page_self, reason)
self:onInvalidation(reason)
end
@ -87,7 +87,7 @@ function BootPage.new(params)
IR.Heartbeat(function(res) self._networkResult = res end) -- IR doesn't like being called in a coroutine
elseif status == SelfTestStatus.PASS or status == SelfTestStatus.OK then
if self.viewHandler then
self.viewHandler:navigate(pageManager:getPage(CheckUpdatePage))
self.viewHandler:navigate(checkUpdatePage)
self.viewHandler:get():init()
end
end

View File

@ -485,11 +485,12 @@ local crew = game.GetSkinSetting("single_idol")
local MainMenuPage = {
__name = "MainMenuPage",
ANIM = {
idolAnimation = Animation.new("crew/anim/" .. crew, {
fps = 30, loop = true,
idolAnimation = Animation.new{
animPath = "crew/anim/" .. crew,
animFPS = 30, loop = true,
centered = true, x = Dim.design.width / 2, y = Dim.design.height / 2,
width = Dim.design.width, height = Dim.design.height,
})
}
},
AUDIO = {
bgm = AudioSample.new{path = "titlescreen/bgm.wav", exclusive = true, loop = true},
@ -516,4 +517,4 @@ function MainMenuPage:drawForeground(deltaTime)
Footer.draw(deltaTime)
end
return MainMenuPage
return MainMenuPage

View File

@ -1,6 +1,6 @@
require("common.class")
local PageManager = require "api.page.pagemanager"
local PageRegistry = require "api.page.pageregistry"
local ServicePage = require("api.page.servicepage")
local InputCheckPage = require("titlescreen.service.inputcheckpage")
@ -18,7 +18,7 @@ local ServiceMenuPage = {
---Create a new MainMenuPage instance
---@param params? MainMenuPage # initial parameters
---@return MainMenuPage
---@return ServiceMenuPage
function ServiceMenuPage.new(params)
params = params or {}
@ -26,12 +26,11 @@ function ServiceMenuPage.new(params)
local self = CreateInstance(ServiceMenuPage, params, ServicePage)
local pageManager = PageManager.get()
local list = ListField.new()
list:addField(ServiceLinkField.new{label = "INPUT CHECK", link = pageManager:getPage(InputCheckPage)})
list:addField(ServiceLinkField.new{label = "SCREEN CHECK", link = pageManager:getPage(ScreenCheckPage)})
list:addField(ServiceLinkField.new{label = "COLOR CHECK", link = pageManager:getPage(ColorCheckPage)})
list:addField(ServiceLinkField.new{label = "VERSION INFORMATION", link = pageManager:getPage(VersionInfoPage)})
list:addField(ServiceLinkField.new{label = "INPUT CHECK", link = PageRegistry:getOrCreatePage(InputCheckPage)})
list:addField(ServiceLinkField.new{label = "SCREEN CHECK", link = PageRegistry:getOrCreatePage(ScreenCheckPage)})
list:addField(ServiceLinkField.new{label = "COLOR CHECK", link = PageRegistry:getOrCreatePage(ColorCheckPage)})
list:addField(ServiceLinkField.new{label = "VERSION INFORMATION", link = PageRegistry:getOrCreatePage(VersionInfoPage)})
list:refreshFields()
self:addField(list)

View File

@ -4,7 +4,7 @@ local Dim = require("common.dimensions")
require "common.globals"
require "common.class"
local PageManager = require "api.page.pagemanager"
local PageRegistry = require "api.page.pageregistry"
local Page = require "api.page.page"
local KShootManiaPage = require "titlescreen.splash.kshootmaniapage"
@ -29,14 +29,12 @@ local SplashPage = {
function SplashPage.new(params)
local self = CreateInstance(SplashPage, params, Page)
local pageManager = PageManager.get()
self.currentPage = 0 -- start on nil page
self.content = {
pageManager:getPage(KShootManiaPage),
pageManager:getPage(USCPage),
pageManager:getPage(TeamExceedPage),
pageManager:getPage(CreditsPage),
PageRegistry:getOrCreatePage(KShootManiaPage),
PageRegistry:getOrCreatePage(USCPage),
PageRegistry:getOrCreatePage(TeamExceedPage),
PageRegistry:getOrCreatePage(CreditsPage),
}
self._isTransitioning = true -- immediately transition to first page