wip misc things, no real implementation change

This commit is contained in:
Hersi 2022-07-16 02:45:20 +02:00
parent c71b020243
commit 6f0c35ac30
4 changed files with 112 additions and 13 deletions

View File

@ -86,6 +86,8 @@ end
---@param params AnimationParams ---@param params AnimationParams
---@return Animation ---@return Animation
function Animation.new(animPath, params) function Animation.new(animPath, params)
local self = CreateInstance(Animation, params)
local frames, frameCount = loadSequentialAnimationFrames(animPath); local frames, frameCount = loadSequentialAnimationFrames(animPath);
local instance = { local instance = {

View File

@ -80,7 +80,7 @@ end
--- Check if a file or directory exists in this path --- Check if a file or directory exists in this path
---@param file string # relative path to game file ---@param file string # relative path to game file
---@return boolean # file exists ---@return boolean # file exists
---@return string # error message ---@return string? # error message
function IsFileExists(file) function IsFileExists(file)
local gamepath, sep = getGamePath() local gamepath, sep = getGamePath()
file = gamepath .. sep .. file file = gamepath .. sep .. file

View File

@ -484,14 +484,14 @@ local crew = game.GetSkinSetting("single_idol")
---@field _idolAnimationState AnimationState ---@field _idolAnimationState AnimationState
local MainMenuPage = { local MainMenuPage = {
__name = "MainMenuPage", __name = "MainMenuPage",
anims = { ANIM = {
idolAnimation = Animation.new("crew/anim/" .. crew, { idolAnimation = Animation.new("crew/anim/" .. crew, {
fps = 30, loop = true, fps = 30, loop = true,
centered = true, x = Dim.design.width / 2, y = Dim.design.height / 2, centered = true, x = Dim.design.width / 2, y = Dim.design.height / 2,
width = Dim.design.width, height = Dim.design.height, width = Dim.design.width, height = Dim.design.height,
}) })
}, },
audiosamples = { AUDIO = {
bgm = AudioSample.new{path = "titlescreen/bgm.wav", exclusive = true, loop = true}, bgm = AudioSample.new{path = "titlescreen/bgm.wav", exclusive = true, loop = true},
} }
} }
@ -503,8 +503,8 @@ function MainMenuPage.new(params)
end end
function MainMenuPage:init() function MainMenuPage:init()
self._idolAnimationState = self.anims.idolAnimation:start() self._idolAnimationState = self.ANIM.idolAnimation:start()
self.audiosamples.bgm:play() self.AUDIO.bgm:play()
end end
function MainMenuPage:drawBackground(deltaTime) function MainMenuPage:drawBackground(deltaTime)

View File

@ -1,5 +1,9 @@
require "common.class" require "common.class"
local Dim = require "common.dimensions"
local Lang = require "language.call" local Lang = require "language.call"
local AudioSample = require "api.audiosample" local AudioSample = require "api.audiosample"
local Page = require "api.page.page" local Page = require "api.page.page"
@ -10,30 +14,123 @@ local crew = game.GetSkinSetting("single_idol")
---@class ModeSelectPage: Page ---@class ModeSelectPage: Page
local ModeSelectPage = { local ModeSelectPage = {
__name = "ModeSelectPage", __name = "ModeSelectPage",
images = { IMAGES = {
selectorBgImage = gfx.CreateSkinImage("titlescreen/selector_bg.png", 0), selectorBgImage = gfx.CreateSkinImage("titlescreen/selector_bg.png", 0),
selectorArrowsImage = gfx.CreateSkinImage("titlescreen/selector_arrows.png", 0), selectorArrowsImage = gfx.CreateSkinImage("titlescreen/selector_arrows.png", 0),
unselectedButtonImage = gfx.CreateSkinImage("titlescreen/unselected_button.png", 0), unselectedButtonImage = gfx.CreateSkinImage("titlescreen/unselected_button.png", 0),
selectedButtonBgImage = gfx.CreateSkinImage("titlescreen/selected_button_bg.png", 0), selectedButtonBgImage = gfx.CreateSkinImage("titlescreen/selected_button_bg.png", 0),
selectedButtonOverImage = gfx.CreateSkinImage("titlescreen/selected_button_over.png", 0) selectedButtonOverImage = gfx.CreateSkinImage("titlescreen/selected_button_over.png", 0)
}, },
anims = { ANIMS = {
}, },
audiosamples = { AUDIO = {
cursorChange = AudioSample.new{path = "titlescreen/cursor_change.wav"}, cursorChange = AudioSample.new { path = "titlescreen/cursor_change.wav" },
cursorSelect = AudioSample.new{path = "titlescreen/cursor_select.wav"} cursorSelect = AudioSample.new { path = "titlescreen/cursor_select.wav" }
}, },
labels = { LABELS = {
selectorDescriptionLabel = gfx.CreateLabel(Lang.Start.desc, 22, 0), selectorDescriptionLabel = gfx.CreateLabel(Lang.Start.desc, 22, 0),
selectorLegendScrollLabel = gfx.CreateLabel(Lang.Start.sc, 20, 0), selectorLegendScrollLabel = gfx.CreateLabel(Lang.Start.sc, 20, 0),
selectorLegendSelectLabel = gfx.CreateLabel(Lang.Start.st3, 20, 0) selectorLegendSelectLabel = gfx.CreateLabel(Lang.Start.st3, 20, 0)
} },
SELECTOR_BAR_OFFSET_FROM_CENTER = 128
} }
function ModeSelectPage.new(params) function ModeSelectPage.new(params)
local self = CreateInstance(ModeSelectPage, params, Page) local self = CreateInstance(ModeSelectPage, params, Page)
local buttons = {
{
labelImage = gfx.CreateSkinImage("titlescreen/labels/skill.png", 0),
labelWidth = 412,
action = nil, -- Menu.Challenges,
description = Lang.Challanges.ch,
details = Lang.Challanges.ch1,
},
{
labelImage = gfx.CreateSkinImage("titlescreen/labels/friend.png", 0),
labelWidth = 169,
action = nil, -- Menu.Multiplayer,
description = Lang.Multiplayer.mp,
details = Lang.Multiplayer.mp2,
},
{
labelImage = gfx.CreateSkinImage("titlescreen/labels/normal.png", 0),
labelWidth = 210,
action = nil, -- Menu.Start,
description = Lang.Start.st,
details = Lang.Start.st2,
},
{
labelImage = gfx.CreateSkinImage("titlescreen/labels/nautica.png", 0),
labelWidth = 230,
action = nil, -- Menu.DLScreen,
description = Lang.Nautica.dls,
details = Lang.Nautica.dls2,
},
{
labelImage = gfx.CreateSkinImage("titlescreen/labels/settings.png", 0),
labelWidth = 247,
action = nil, -- Menu.Settings,
description = Lang.Settings.se,
details = Lang.Settings.se1,
},
{
labelImage = gfx.CreateSkinImage("titlescreen/labels/exit.png", 0),
labelWidth = 110,
action = nil, -- Menu.Exit,
description = Lang.Exit.ex,
details = Lang.Exit.ex2,
},
}
local buttonHeight = 100
local miscButtons = {
upArrow = {
x = Dim.design.width - 265,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight + 4,
w = 64,
h = 36
},
downArrow = {
x = Dim.design.width - 265,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER + buttonHeight / 2 + 28,
w = 64,
h = 36
},
mainButton = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight / 2 - 28,
w = 505,
h = 196
},
upButton1 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - 128 - buttonHeight,
w = 1026 / 2,
h = 257 / 2
},
upButton2 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - 128 - buttonHeight * 2,
w = 1026 / 2,
h = 257 / 2
},
downButton1 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER + 128 + 10,
w = 1026 / 2,
h = 257 / 2
},
downButton2 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER + 128 + buttonHeight + 10,
w = 1026 / 2,
h = 257 / 2
},
}
return self return self
end end