require("global/guide_panel") EntryOverlay = {} EntryOverlay.__index = EntryOverlay local CARD = { x = 1460, y = 38, cx = 53, cy = 82 } local STAGE = { x = 1200, y = 45, cx = 120, y1 = 17, y2 = 45 } local CARD_SIZE, STAGE_SIZE = 30, 26 local NG_COLOR, OK_COLOR, STAGE_COLOR = { 255, 255, 255, 255 }, { 60, 60, 60, 255 }, { 40, 40, 40, 255 } local function plain(str, size, color) return text.create_raw_text(str, GuidePanel.label_size(size), color, color, false, 0, 1.0, 0.0, GuidePanel.label_font()) end local function draw_centered(t, cx, cy, x, y) if t then t:draw({ x = x + cx - t.width / 2, y = y + cy - t.height / 2 }) end end function EntryOverlay.new(online) local self = setmetatable({}, EntryOverlay) self.online = online self.stage_plate = tex.get_texture("global/overlay/banapass_or") self.card_chip = tex.get_texture("global/overlay/banapass_card") self.dani_chip = tex.get_texture("global/overlay/banapass_no") self.card_ng = plain("NG", CARD_SIZE, NG_COLOR) self.card_ok = plain("OK", CARD_SIZE, OK_COLOR) return self end function EntryOverlay:stage_lines() local limit = tex.song_limit() if limit ~= self.limit then self.limit = limit self.stage_line_1, self.stage_line_2 = nil, nil if limit > 0 then self.stage_line_1 = plain(tex.skin_text("entry_stage_plate_1"), STAGE_SIZE, STAGE_COLOR) self.stage_line_2 = plain((tex.skin_text("entry_stage_plate_2"):gsub("{n}", tostring(limit))), STAGE_SIZE, STAGE_COLOR) end end return self.stage_line_1, self.stage_line_2 end function EntryOverlay:update(current_ms, online) self.online = online end function EntryOverlay:draw(is_title) local x = is_title and -4000 or 0 local y = 0 tex.draw_texture(self.stage_plate, { x = x, y = y }) local line_1, line_2 = self:stage_lines() draw_centered(line_1, STAGE.cx, STAGE.y1, x + STAGE.x, y + STAGE.y) draw_centered(line_2, STAGE.cx, STAGE.y2, x + STAGE.x, y + STAGE.y) tex.draw_texture(self.card_chip, { frame = self.online and 1 or 0, x = x, y = y }) draw_centered(self.online and self.card_ok or self.card_ng, CARD.cx, CARD.cy, x + CARD.x, y + CARD.y) tex.draw_texture(self.dani_chip, { x = x, y = y }) end