forked from Yonokid/YataiDONNijiiro
54 lines
2.2 KiB
Lua
54 lines
2.2 KiB
Lua
-- Arcade control_guide panel (plate + drum + sticks), drawn from the layered Lumen clip
|
|
-- (control_guide.nulm sprite 88). Shared by Indicator, entry and song_select.
|
|
|
|
local sampler = require("anim/sampler")
|
|
local clip = sampler.load("anim/guide_layers")
|
|
|
|
local PILL_TEX, PILL_W, PILL_H = "guide_57", 216, 72 -- the 決定 pill (guide_65 is its blink); label is skin text
|
|
local ARCADE_FPS = 60
|
|
local ALL_LEN, DECIDE_START, DECIDE_LEN = 420, 420, 230 -- Lumen loops: both sticks, then 決定
|
|
|
|
GuidePanel = {}
|
|
GuidePanel.__index = GuidePanel
|
|
|
|
GuidePanel.Loop = { ALL = 1, DECIDE = 2 }
|
|
|
|
function GuidePanel.new()
|
|
local self = setmetatable({}, GuidePanel)
|
|
self.plate = tex.get_texture("global/indicator/guide_plate")
|
|
self.layers = {}
|
|
for i, path in ipairs(clip.order) do
|
|
local m = clip.meta[path]
|
|
self.layers[i] = { path = path, tex = tex.get_texture("global/indicator/" .. m.tex),
|
|
mirror = m.mirror and "horizontal" or "none", pill = (m.tex == PILL_TEX) }
|
|
end
|
|
self.t0 = tex.get_current_ms()
|
|
self.decide = text.create_raw_text(tex.skin_text("guide_decide_label"), 24, { 30, 30, 30, 255 },
|
|
{ 30, 30, 30, 255 }, false, 0, 1.0, "FOT-Seurat_Pro_B.otf")
|
|
return self
|
|
end
|
|
|
|
function GuidePanel:draw(loop, x, y, fade)
|
|
local f = (tex.get_current_ms() - self.t0) * ARCADE_FPS / 1000
|
|
if loop == GuidePanel.Loop.ALL then
|
|
f = f % ALL_LEN
|
|
else
|
|
f = DECIDE_START + f % DECIDE_LEN
|
|
end
|
|
x, y, fade = x or 0, y or 0, fade or 1.0
|
|
tex.draw_texture(self.plate, { x = x, y = y, fade = fade })
|
|
for _, l in ipairs(self.layers) do
|
|
local tx, ty, sc, rot, a = clip:at(l.path, f)
|
|
if a and a > 0.002 then
|
|
tex.draw_texture(l.tex, { x = x + tx, y = y + ty, scale = sc, rotation = rot,
|
|
origin = { 0, 0 }, mirror = l.mirror, fade = a * fade })
|
|
if l.pill then
|
|
self.decide:draw({ x = x + tx + PILL_W / 2 - self.decide.width / 2,
|
|
y = y + 12 + ty + PILL_H / 2 - self.decide.height / 2, fade = a * fade })
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
return GuidePanel
|