43 lines
1.1 KiB
Lua
43 lines
1.1 KiB
Lua
local SHOW_MS = 9000
|
|
local FADE_MS = 250
|
|
|
|
local function texture(name)
|
|
return tex.get_texture("title/tournament/" .. name)
|
|
end
|
|
|
|
TournamentAttract = {}
|
|
TournamentAttract.__index = TournamentAttract
|
|
|
|
function TournamentAttract.new(current_ms)
|
|
local self = setmetatable({}, TournamentAttract)
|
|
self.start_ms = current_ms
|
|
self.now = current_ms
|
|
self.t_background = texture("background")
|
|
self.t_precautions = texture("precautions")
|
|
return self
|
|
end
|
|
|
|
function TournamentAttract:update(current_ms)
|
|
self.now = current_ms
|
|
end
|
|
|
|
function TournamentAttract:draw()
|
|
local elapsed = self.now - self.start_ms
|
|
local fade = math.min(1, elapsed / FADE_MS) * math.min(1, (SHOW_MS - elapsed) / FADE_MS)
|
|
tex.draw_texture(self.t_background, { fade = fade })
|
|
tex.draw_texture(self.t_precautions, { fade = fade })
|
|
end
|
|
|
|
-- the gacha is not ported to this skin: the title never starts a spin
|
|
function TournamentAttract:can_spin()
|
|
return false
|
|
end
|
|
|
|
function TournamentAttract:spin() end
|
|
|
|
function TournamentAttract:is_finished()
|
|
return self.now - self.start_ms >= SHOW_MS
|
|
end
|
|
|
|
function TournamentAttract:close() end
|