41 lines
1.3 KiB
Lua
41 lines
1.3 KiB
Lua
-- Result fade-in: the arcade background drawn on top and faded out (animation 15).
|
|
ResultFadeIn = {}
|
|
ResultFadeIn.__index = ResultFadeIn
|
|
|
|
local ok_layers, Layers = pcall(require, "result/result_bg_layers")
|
|
if not ok_layers then Layers = nil end
|
|
|
|
function ResultFadeIn.new(player_num)
|
|
local self = setmetatable({}, ResultFadeIn)
|
|
self.player_num = player_num
|
|
tex.load_animations("result")
|
|
__hss_result_bg_clear = 0.0 -- first object the result scene builds; clear last run's state
|
|
self.fade_in = tex.get_animation(15, "result")
|
|
self.fade_in:start()
|
|
if Layers then
|
|
local ok, obj = pcall(Layers.new, player_num)
|
|
if ok then self.layers = obj end
|
|
end
|
|
if not self.layers then
|
|
self.t_bg = tex.get_texture(player_num == 3 and "result/background/background_2p"
|
|
or "result/background/background_1p")
|
|
end
|
|
return self
|
|
end
|
|
|
|
function ResultFadeIn:update(current_ms)
|
|
self.fade_in:update(current_ms)
|
|
end
|
|
|
|
function ResultFadeIn:is_finished()
|
|
return self.fade_in.is_finished
|
|
end
|
|
|
|
function ResultFadeIn:draw()
|
|
if self.layers then
|
|
self.layers:draw(self.fade_in.attribute, __hss_result_bg_clear or 0.0)
|
|
elseif self.t_bg then
|
|
tex.draw_texture(self.t_bg, { fade = self.fade_in.attribute })
|
|
end
|
|
end
|