Files
PyTaikoGreen/Scripts/result/result_fade_in.lua
2026-07-17 13:03:07 -04:00

59 lines
2.5 KiB
Lua

local function draw_background_tiles(player_num, width, fade)
local screen_h = tex.get_screen_height()
local screen_w = tex.get_screen_width()
local x = 0
if player_num == 3 then -- TWO_PLAYER
local bg1 = tex.load_texture("result/background/background_1p")
local bg2 = tex.load_texture("result/background/background_2p")
local ft1 = tex.load_texture("result/background/footer_1p")
local ft2 = tex.load_texture("result/background/footer_2p")
local info = tex.get_texture_info("background", "footer_1p")
local fh = info and info.height or 0
while x < width do
if bg1 then tex.draw_texture(bg1, { x = x, y = -screen_h / 2, fade = fade }) end
if bg2 then tex.draw_texture(bg2, { x = x, y = screen_h / 2, fade = fade }) end
if ft1 then tex.draw_texture(ft1, { x = x, y = -(fh / 2), fade = fade }) end
if ft2 then tex.draw_texture(ft2, { x = x, y = screen_h - fh / 2, fade = fade }) end
x = x + screen_w / 5
end
else
local ps = tostring(player_num) .. "p"
local bg = tex.load_texture("result/background/background_" .. ps)
local ft = tex.load_texture("result/background/footer_" .. ps)
local info = tex.get_texture_info("background", "footer_" .. ps)
local fh = info and info.height or 0
while x < width do
if bg then tex.draw_texture(bg, { x = x, y = -screen_h / 2, fade = fade }) end
if bg then tex.draw_texture(bg, { x = x, y = screen_h / 2, fade = fade }) end
if ft then tex.draw_texture(ft, { x = x, y = -(fh / 2), fade = fade }) end
if ft then tex.draw_texture(ft, { x = x, y = screen_h - fh / 2, fade = fade }) end
x = x + screen_w / 5
end
end
end
ResultFadeIn = {}
ResultFadeIn.__index = ResultFadeIn
function ResultFadeIn.new(player_num)
local self = setmetatable({}, ResultFadeIn)
self.player_num = player_num
tex.load_animations("result")
self.fade_in = tex.get_animation(15, "result")
self.fade_in:start()
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()
local screen_w = tex.get_screen_width()
draw_background_tiles(self.player_num, screen_w, self.fade_in.attribute)
end