2022-03-04 04:06:19 +01:00
|
|
|
local Dim = require("common.dimensions")
|
|
|
|
local Wallpaper = require("components.wallpaper")
|
|
|
|
|
2022-04-03 01:35:41 +02:00
|
|
|
local PageView = require("components.pager.pageview")
|
|
|
|
local ServicePage = require("titlescreen.service.servicepage")
|
|
|
|
local Field = require("components.pager.field")
|
|
|
|
|
|
|
|
--[[ WIP: REIMPLEMENTATION
|
2021-12-20 00:39:38 +01:00
|
|
|
local triggerSplashScreen = false
|
2022-03-29 04:29:28 +02:00
|
|
|
local updateUrl, updateVersion = game.UpdateAvailable()
|
|
|
|
|
|
|
|
local updateTimer = 0
|
|
|
|
local updateFlickerTime = 0.5 --seconds
|
|
|
|
|
|
|
|
---Draw special slider field
|
|
|
|
---
|
|
|
|
--- Tip: You can specify a background using the gfx.FillColor or gfx.FillPaint
|
|
|
|
--- functions before calling this function
|
|
|
|
---@param x number
|
|
|
|
---@param y number
|
|
|
|
---@param w number
|
|
|
|
---@param h number
|
|
|
|
---@param val number
|
|
|
|
---@param max? number optional maximum value (default 1.0)
|
|
|
|
---@param min? number optional minimum value (default 0.0)
|
|
|
|
local function drawSlider(x, y, w, h, val, max, min)
|
|
|
|
max = max or 1.0
|
|
|
|
min = min or 0.0
|
|
|
|
|
|
|
|
-- draw background
|
|
|
|
gfx.BeginPath()
|
|
|
|
gfx.Rect(x, y, w, h)
|
|
|
|
gfx.Fill()
|
|
|
|
|
|
|
|
-- draw frame
|
|
|
|
gfx.BeginPath()
|
|
|
|
gfx.Rect(x, y, w, h)
|
|
|
|
gfx.StrokeColor(255, 255, 255)
|
|
|
|
gfx.StrokeWidth(2)
|
|
|
|
gfx.Stroke()
|
|
|
|
|
|
|
|
if max == min then
|
|
|
|
return -- would be an error case
|
|
|
|
end
|
|
|
|
|
|
|
|
-- draw indicator
|
|
|
|
local pos = x + (val - min) * ((x + w - x) / (max - min)) --lerp
|
|
|
|
gfx.BeginPath()
|
|
|
|
gfx.Rect(pos, y, 4, h)
|
|
|
|
gfx.FillColor(0, 255, 0)
|
|
|
|
gfx.Fill()
|
|
|
|
end
|
|
|
|
|
|
|
|
---Draw special text field
|
|
|
|
---@param x number
|
|
|
|
---@param y number
|
|
|
|
---@param text string
|
|
|
|
---@param color? table optional {R, G, B} integer array
|
|
|
|
---@param fontSize? integer optional font size
|
|
|
|
local function drawText(x, y, text, color, fontSize)
|
|
|
|
gfx.BeginPath()
|
|
|
|
|
|
|
|
if color then
|
|
|
|
gfx.FillColor(color[1], color[2], color[3])
|
|
|
|
end
|
|
|
|
|
|
|
|
if fontSize then
|
|
|
|
gfx.FontSize(fontSize)
|
|
|
|
end
|
|
|
|
|
|
|
|
gfx.Text(text, x, y)
|
|
|
|
end
|
2021-12-20 00:39:38 +01:00
|
|
|
|
2021-12-20 01:34:41 +01:00
|
|
|
local rootMenu = {
|
2022-03-29 04:29:28 +02:00
|
|
|
{
|
|
|
|
label = "INPUT CHECK",
|
|
|
|
children = {
|
|
|
|
{label = "START BUTTON", value = "OFF"},
|
|
|
|
{label = "A BUTTON", value = "OFF"},
|
|
|
|
{label = "B BUTTON", value = "OFF"},
|
|
|
|
{label = "C BUTTON", value = "OFF"},
|
|
|
|
{label = "D BUTTON", value = "OFF"},
|
|
|
|
{label = "FX L BUTTON", value = "OFF"},
|
|
|
|
{label = "FX R BUTTON", value = "OFF"},
|
|
|
|
{
|
|
|
|
label = "VOL L",
|
|
|
|
value = 0,
|
|
|
|
render = function (deltaTime)
|
|
|
|
drawSlider(64, 0, 128, 24, game.GetKnob(0))
|
|
|
|
end
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label = "VOL R",
|
|
|
|
value = 0,
|
|
|
|
render = function (deltaTime)
|
|
|
|
drawSlider(64, 0, 128, 24, game.GetKnob(1))
|
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label = "SCREEN CHECK",
|
|
|
|
children = {
|
|
|
|
render = function (deltaTime)
|
|
|
|
|
|
|
|
end
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label = "COLOR CHECK",
|
|
|
|
children = {
|
|
|
|
{
|
|
|
|
label = "RED",
|
|
|
|
render = function (deltaTime)
|
|
|
|
|
|
|
|
end
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label = "YELLOW",
|
|
|
|
render = function (deltaTime)
|
|
|
|
|
|
|
|
end
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label = "GREEN",
|
|
|
|
render = function (deltaTime)
|
|
|
|
|
|
|
|
end
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label = "CYAN",
|
|
|
|
render = function (deltaTime)
|
|
|
|
|
|
|
|
end
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label = "BLUE",
|
|
|
|
render = function (deltaTime)
|
|
|
|
|
|
|
|
end
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label = "MAGENTA",
|
|
|
|
render = function (deltaTime)
|
|
|
|
|
|
|
|
end
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label = "WHITE",
|
|
|
|
render = function (deltaTime)
|
|
|
|
|
|
|
|
end
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label = "VERSION INFORMATION",
|
|
|
|
children = {
|
|
|
|
{label = "USC BRANCH"},
|
|
|
|
{label = "USC VERSION"},
|
|
|
|
{
|
|
|
|
label = "UPDATE",
|
|
|
|
render = function (deltaTime)
|
|
|
|
if updateVersion then
|
|
|
|
local color = {255, 0, 0}
|
|
|
|
updateTimer = updateTimer + deltaTime
|
|
|
|
if (updateTimer % updateFlickerTime) < (updateFlickerTime / 2) then
|
|
|
|
color = {255, 255, 0}
|
|
|
|
end
|
|
|
|
drawText(0, 0, "*UPDATE AVAILABLE (" .. updateVersion .. ")*", color)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
handler = function ()
|
|
|
|
if updateUrl then
|
|
|
|
Menu.Update()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
2022-03-12 15:18:41 +01:00
|
|
|
{label = "IDOLS", children = {{label = "GRACEv6"}, {label = "NEARNOAHv6"}, {label = "IDKv6"}}},
|
2021-12-20 00:39:38 +01:00
|
|
|
{
|
2022-03-12 15:18:41 +01:00
|
|
|
label = "LASER COLORS",
|
2021-12-20 00:39:38 +01:00
|
|
|
children = {
|
|
|
|
{
|
2022-03-12 15:18:41 +01:00
|
|
|
label = "LEFT LASER",
|
2021-12-20 01:34:41 +01:00
|
|
|
children = {
|
2022-03-12 15:18:41 +01:00
|
|
|
{label = "BLUE", color = {0, 128, 255}},
|
|
|
|
{label = "PINK", color = {255, 0, 255}},
|
|
|
|
{label = "GREEN", color = {0, 255, 0}},
|
|
|
|
{label = "YELLOW", color = {255, 255, 0}},
|
|
|
|
},
|
2021-12-20 01:34:41 +01:00
|
|
|
},
|
2021-12-20 00:39:38 +01:00
|
|
|
{
|
2022-03-12 15:18:41 +01:00
|
|
|
label = "RIGHT LASER",
|
|
|
|
children = {{label = "BLUE"}, {label = "PINK"}, {label = "GREEN"}, {label = "YELLOW"}},
|
|
|
|
},
|
|
|
|
},
|
2021-12-20 00:39:38 +01:00
|
|
|
},
|
2022-03-29 04:29:28 +02:00
|
|
|
{label = "BACK TO TITLE SCREEN", type = "back", handler = function() triggerSplashScreen = true end},
|
2021-12-20 00:39:38 +01:00
|
|
|
}
|
|
|
|
|
2022-03-29 04:29:28 +02:00
|
|
|
local index = 1
|
2022-04-03 01:35:41 +02:00
|
|
|
]]
|
|
|
|
|
|
|
|
local pages = {
|
|
|
|
root = {
|
|
|
|
page = ServicePage:new{title="MAIN MENU"},
|
|
|
|
fields = {
|
|
|
|
Field:new(),
|
|
|
|
Field:new(),
|
|
|
|
Field:new(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, field in ipairs(pages.root.fields) do
|
|
|
|
pages.root.page:addField(field)
|
|
|
|
end
|
|
|
|
|
|
|
|
local pageview = PageView:new(pages.root.page)
|
|
|
|
|
|
|
|
local function reset()
|
|
|
|
pageview = PageView:new(pages.root.page)
|
|
|
|
end
|
2021-12-20 00:39:38 +01:00
|
|
|
|
2022-03-04 04:06:19 +01:00
|
|
|
local function render(deltaTime)
|
|
|
|
Dim.updateResolution()
|
|
|
|
|
|
|
|
Wallpaper.render()
|
|
|
|
|
|
|
|
Dim.transformToScreenSpace()
|
|
|
|
|
2022-04-03 01:35:41 +02:00
|
|
|
pageview:render(deltaTime)
|
|
|
|
|
|
|
|
--[[ WIP: REIMPLEMENTATION
|
|
|
|
|
2022-03-29 04:29:28 +02:00
|
|
|
gfx.BeginPath()
|
|
|
|
gfx.FillColor(0, 0, 0, 255)
|
|
|
|
gfx.Rect(0, 0, 1080, 1920)
|
|
|
|
gfx.Fill()
|
2021-12-20 00:39:38 +01:00
|
|
|
|
|
|
|
gfx.LoadSkinFont("dfmarugoth.ttf")
|
2022-03-29 04:29:28 +02:00
|
|
|
gfx.FillColor(255, 255, 255, 255)
|
2021-12-20 00:39:38 +01:00
|
|
|
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
|
2022-03-29 04:29:28 +02:00
|
|
|
gfx.FontSize(24)
|
2021-12-20 00:39:38 +01:00
|
|
|
|
2022-03-29 04:29:28 +02:00
|
|
|
gfx.BeginPath()
|
|
|
|
gfx.Text("SERIVCE MENU", 1080 / 2, 128)
|
|
|
|
gfx.Text("BT-A/BT-B = UP/DOWN", 1080 / 2, 1920 - 256 - 28)
|
|
|
|
gfx.Text("START = SELECT", 1080 / 2, 1920 - 256)
|
2021-12-20 01:34:41 +01:00
|
|
|
|
2021-12-20 00:39:38 +01:00
|
|
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
2021-12-20 01:34:41 +01:00
|
|
|
|
2022-03-29 04:29:28 +02:00
|
|
|
local yOffset = 256
|
2021-12-20 00:39:38 +01:00
|
|
|
for i, menuItem in ipairs(menu) do
|
2022-03-12 15:18:41 +01:00
|
|
|
if menuItem.type == "back" then
|
2022-03-29 04:29:28 +02:00
|
|
|
yOffset = yOffset + 28 * 2
|
2021-12-20 01:34:41 +01:00
|
|
|
else
|
2022-03-29 04:29:28 +02:00
|
|
|
yOffset = yOffset + 28
|
2021-12-20 01:34:41 +01:00
|
|
|
end
|
|
|
|
|
2021-12-20 00:39:38 +01:00
|
|
|
if (i == index) then
|
2021-12-20 01:34:41 +01:00
|
|
|
if menuItem.color then
|
2022-03-12 15:18:41 +01:00
|
|
|
gfx.FillColor(menuItem.color[1], menuItem.color[2], menuItem.color[3])
|
2021-12-20 01:34:41 +01:00
|
|
|
else
|
2022-03-29 04:29:28 +02:00
|
|
|
gfx.FillColor(0, 255, 0, 255)
|
2021-12-20 01:34:41 +01:00
|
|
|
end
|
2022-03-29 04:29:28 +02:00
|
|
|
-- gfx.FillColor(0,128,255,255)
|
2021-12-20 00:39:38 +01:00
|
|
|
else
|
2022-03-29 04:29:28 +02:00
|
|
|
gfx.FillColor(255, 255, 255, 255)
|
2021-12-20 00:39:38 +01:00
|
|
|
end
|
2022-03-29 04:29:28 +02:00
|
|
|
gfx.BeginPath()
|
|
|
|
gfx.Text(menuItem.label, 100, yOffset)
|
2021-12-20 00:39:38 +01:00
|
|
|
end
|
|
|
|
|
2022-04-03 01:35:41 +02:00
|
|
|
]]
|
|
|
|
|
|
|
|
if not pageview.pageStack[1] then
|
2022-03-12 15:18:41 +01:00
|
|
|
return {eventType = "switch", toScreen = "splash"}
|
2021-12-20 00:39:38 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-04-03 01:35:41 +02:00
|
|
|
local function onButtonPressed(button)
|
|
|
|
pageview.pageStack[1]:handleButtonInput(button)
|
2021-12-20 00:39:38 +01:00
|
|
|
end
|
|
|
|
|
2022-04-03 01:35:41 +02:00
|
|
|
return {reset = reset, render = render, onButtonPressed = onButtonPressed}
|