forked from Yonokid/PyTaikoGreen
115 lines
4.1 KiB
Lua
115 lines
4.1 KiB
Lua
local DonBGBase = require("background/bg_objects/donbg/base")
|
|
local BGNormal = require("background/bg_objects/bg_normal")
|
|
local Footer = require("background/bg_objects/footer")
|
|
local ChibiController = require("background/bg_objects/chibi")
|
|
|
|
local COLLAB_PATH = "background/collab/dan"
|
|
|
|
-- Custom DonBG: DonBG6 draw-shape but with extra bg_overlay_2 scroll
|
|
local DanDonBG = setmetatable({}, { __index = DonBGBase })
|
|
DanDonBG.__index = DanDonBG
|
|
|
|
function DanDonBG.new(player_num)
|
|
local self = setmetatable({}, DanDonBG)
|
|
local base = DonBGBase.new(1, player_num, COLLAB_PATH)
|
|
for k, v in pairs(base) do self[k] = v end
|
|
self.overlay_move = tex.get_animation(2, "background")
|
|
local bg_overlay_info = tex.get_texture_info(self.name, "bg_overlay")
|
|
self.bg_overlay_width = bg_overlay_info and bg_overlay_info.width or 0
|
|
local bg_overlay_2_info = tex.get_texture_info(self.name, "bg_overlay_2")
|
|
self.bg_overlay_2_width = bg_overlay_2_info and bg_overlay_2_info.width or 0
|
|
self.overlay_move_2 = anim.move(8000, {
|
|
total_distance = -self.bg_overlay_2_width, loop = true
|
|
})
|
|
self._id_bg_overlay = tex.get_texture(COLLAB_PATH .. "/" .. self.name .. "/" .. "bg_overlay") or 0
|
|
self._id_bg_overlay_2 = tex.get_texture(COLLAB_PATH .. "/" .. self.name .. "/" .. "bg_overlay_2") or 0
|
|
self._id_overlay_1 = tex.get_texture(COLLAB_PATH .. "/" .. self.name .. "/" .. "overlay_1") or 0
|
|
self._id_bg_overlay_3 = tex.get_texture(COLLAB_PATH .. "/" .. self.name .. "/" .. "bg_overlay_3") or 0
|
|
self._id_overlay_2 = tex.get_texture(COLLAB_PATH .. "/" .. self.name .. "/" .. "overlay_2") or 0
|
|
return self
|
|
end
|
|
|
|
function DanDonBG:update(current_time_ms)
|
|
DonBGBase.update(self, current_time_ms)
|
|
self.overlay_move:update(current_time_ms)
|
|
self.overlay_move_2:update(current_time_ms)
|
|
end
|
|
|
|
function DanDonBG:draw_textures(fade, y, frame)
|
|
local sc = tex.get_screen_scale()
|
|
tex.draw_texture(self._id_bg)
|
|
for i = 0, math.floor(3 * sc) - 1 do
|
|
tex.draw_texture(self._id_bg_overlay, { x = i * self.bg_overlay_width, y = y })
|
|
end
|
|
for i = 0, math.floor(3 * sc) - 1 do
|
|
tex.draw_texture(self._id_bg_overlay_2, {
|
|
x = (i * self.bg_overlay_2_width) + self.overlay_move_2.attribute, y = y
|
|
})
|
|
end
|
|
local step = math.floor(2 * sc)
|
|
for i = 0, math.floor(6 * sc) - 1, step do
|
|
tex.draw_texture(self._id_overlay_1, {
|
|
x = (i * 264 * sc) + self.move.attribute * 3,
|
|
y = -self.move.attribute * 0.85 + y
|
|
})
|
|
end
|
|
tex.draw_texture(self._id_bg_overlay_3)
|
|
for i = 0, math.floor(5 * sc) - 1 do
|
|
tex.draw_texture(self._id_overlay_2, {
|
|
x = (i * 328 * sc) + self.move.attribute,
|
|
y = self.overlay_move.attribute + y
|
|
})
|
|
end
|
|
end
|
|
|
|
-- Background
|
|
|
|
local DanBackground = {}
|
|
DanBackground.__index = DanBackground
|
|
|
|
function DanBackground.new(player_num, bpm)
|
|
local self = setmetatable({}, DanBackground)
|
|
self.donbg = DanDonBG.new(player_num)
|
|
self.bg_normal = BGNormal.Base.new(0, COLLAB_PATH)
|
|
self.footer = Footer.new(COLLAB_PATH, 0)
|
|
self.chibi = ChibiController.new(bpm, COLLAB_PATH, 2)
|
|
return self
|
|
end
|
|
|
|
function DanBackground:update(current_ms, bpm)
|
|
self.donbg:update(current_ms)
|
|
self.chibi:update(current_ms, bpm)
|
|
end
|
|
|
|
function DanBackground:handle_good(player_num) self.chibi:add_chibi(player_num, false) end
|
|
|
|
function DanBackground:handle_ok(player_num) self.chibi:add_chibi(player_num, false) end
|
|
|
|
function DanBackground:handle_bad(player_num) self.chibi:add_chibi(player_num, true) end
|
|
|
|
function DanBackground:handle_drumroll(player_num) end
|
|
|
|
function DanBackground:handle_balloon(player_num) end
|
|
|
|
function DanBackground:handle_gauge(player_num, progress, is_clear, is_rainbow)
|
|
self.donbg:set_clear(is_clear)
|
|
end
|
|
|
|
function DanBackground:draw_back()
|
|
self.bg_normal:draw()
|
|
self.donbg:draw()
|
|
self.footer:draw()
|
|
self.chibi:draw()
|
|
end
|
|
|
|
function DanBackground:draw_fore() end
|
|
|
|
function DanBackground:destroy()
|
|
self.donbg:destroy()
|
|
self.bg_normal:destroy()
|
|
self.footer:destroy()
|
|
self.chibi:destroy()
|
|
end
|
|
|
|
return DanBackground
|