Files
computercraft-LLKJ-logo-bimg/player.lua
2025-12-21 05:39:52 +08:00

71 lines
9.4 KiB
Lua

-- logo
local logostr = '[3]{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[14] \139[10] ","[7]f[7]0f[3]0[7]f","[14]f0[10]f"},{"[11] \143\129\149 \132[8] ","[7]f[4]0ff[5]0[7]f","[11]f00f00[9]f"},{"[8] \159\135[3] \149\143\158\135\149[7] ","[7]f0ff[5]0ff0[7]f","[8]f[5]0ff00[8]f"},{"[7] \149[4] \143\150\144 \131\133[7] ","[8]f[5]0f[4]0[7]f","[7]f[5]0f0[11]f"},{"[7] \149 \136 \149 \131\144[8] ","[8]f00f00f0f00[7]f","[7]f[4]0ff[3]0[9]f"},{"[7] \138[4] \131\133 \149[8] ","[7]f[5]0ff[4]0[7]f","[8]f[8]0[9]f"},{"[8] \130\139\144[5] \149[8] ","[7]f[3]0f[7]0[7]f","[10]f[6]0[9]f"},{"[9] \143\131[4] \135[9] ","[7]f00ff[7]0[7]f","[9]f[6]0[10]f"},{"[12] \143\131[11] ","[7]f[11]0[7]f","[9]f[3]0[13]f"},{"[9] \143\135\129[13] ","[7]f[11]0[7]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"},duration=1},{{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[14] \139[10] ","[7]f[7]0f[3]0[7]f","[14]f0[10]f"},{"[11] \143\129\149 \132[8] ","[7]f[4]0ff[5]0[7]f","[11]f00f00[9]f"},{"[8] \159\135[3] \149\143\158\135\149[7] ","[7]f0ff[5]0ff0[7]f","[8]f[5]0ff00[8]f"},{"[7] \149[4] \143\150\144 \131\133[7] ","[8]f[5]0f[4]0[7]f","[7]f[5]0f0[11]f"},{"[7] \149 \136 \149 \131\144[8] ","[8]f00f00f0f00[7]f","[7]f[4]0ff[3]0[9]f"},{"[7] \138[4] \131\133 \149[8] ","[7]f[5]0ff[4]0[7]f","[8]f[8]0[9]f"},{"[8] \130\139\144[5] \149[8] ","[7]f[3]0f[7]0[7]f","[10]f[6]0[9]f"},{"[9] \143\131[4] \135[9] ","[7]f00ff[7]0[7]f","[9]f[6]0[10]f"},{"[12] \143\131[11] ","[7]f[11]0[7]f","[9]f[3]0[13]f"},{"[9] \143\135\129[13] ","[7]f[11]0[7]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"}},{{"[25] ","[25]f","[25]f"},{"[14] \139[10] ","[7]f[7]0f[3]0[7]f","[14]f0[10]f"},{"[11] \143\129\149 \132[8] ","[7]f[4]0ff[5]0[7]f","[11]f00f00[9]f"},{"[8] \159\135[3] \149\143\158\135\149[7] ","[7]f0ff[5]0ff0[7]f","[8]f[5]0ff00[8]f"},{"[7] \149[4] \143\150\144 \131\133[7] ","[8]f[5]0f[4]0[7]f","[7]f[5]0f0[11]f"},{"[7] \149 \136 \149 \131\144[8] ","[8]f00f00f0f00[7]f","[7]f[4]0ff[3]0[9]f"},{"[7] \138[4] \131\133 \149[8] ","[7]f[5]0ff[4]0[7]f","[8]f[8]0[9]f"},{"[8] \130\139\144[5] \149[8] ","[7]f[3]0f[7]0[7]f","[10]f[6]0[9]f"},{"[9] \143\131[4] \135[9] ","[7]f00ff[7]0[7]f","[9]f[6]0[10]f"},{"[12] \143\131[11] ","[7]f[11]0[7]f","[9]f[3]0[13]f"},{"[9] \143\135\129[13] ","[7]f[11]0[7]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"}},{{"[14] \139[10] ","[7]f[7]0f[3]0[7]f","[14]f0[10]f"},{"[11] \143\129\149 \132[8] ","[7]f[4]0ff[5]0[7]f","[11]f00f00[9]f"},{"[8] \159\135[3] \149\143\158\135\149[7] ","[7]f0ff[5]0ff0[7]f","[8]f[5]0ff00[8]f"},{"[7] \149[4] \143\150\144 \131\133[7] ","[8]f[5]0f[4]0[7]f","[7]f[5]0f0[11]f"},{"[7] \149 \136 \149 \131\144[8] ","[8]f00f00f0f00[7]f","[7]f[4]0ff[3]0[9]f"},{"[7] \138[4] \131\133 \149[8] ","[7]f[5]0ff[4]0[7]f","[8]f[8]0[9]f"},{"[8] \130\139\144[5] \149[8] ","[7]f[3]0f[7]0[7]f","[10]f[6]0[9]f"},{"[9] \143\131[4] \135[9] ","[7]f00ff[7]0[7]f","[9]f[6]0[10]f"},{"[12] \143\131[11] ","[7]f[11]0[7]f","[9]f[3]0[13]f"},{"[9] \143\135\129[13] ","[7]f[11]0[7]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"},{"[25] ","[25]f","[25]f"}},{{"[14] \139[10] ","[7]f[7]0f[3]0[7]f","[14]f0[10]f"},{"[11] \143\129\149 \132[8] ","[7]f[4]0ff[5]0[7]f","[11]f00f00[9]f"},{"[8] \159\135[3] \149\143\158\135\149[7] ","[7]f0ff[5]0ff0[7]f","[8]f[5]0ff00[8]f"},{"[7] \149[4] \143\150\144 \131\133[7] ","[8]f[5]0f[4]0[7]f","[7]f[5]0f0[11]f"},{"[7] \149 \136 \149 \131\144[8] ","[8]f00f00f0f00[7]f","[7]f[4]0ff[3]0[9]f"},{"[7] \138[4] \131\133 \149[8] ","[7]f[5]0ff[4]0[7]f","[8]f[8]0[9]f"},{"[8] \130\139\144[5] \149[8] ","[7]f[3]0f[7]0[7]f","[10]f[6]0[9]f"},{"[9] \143\131[4] \135[9] ","[7]f00ff[7]0[7]f","[9]f[6]0[10]f"},{"[12] \143\131[11] ","[7]f[11]0[7]f","[9]f[3]0[13]f"},{"[9] \143\135\129[13] ","[7]f[11]0[7]f","[25]f"},{"[6] \136\135\149\142\134\145[6] \159\149\143\153\153\143","[6]f00f00[8]f0f0ff","[8]f0ff0[6]f0f0f00"},{"[24] ","[24]f","[24]f"},{"[24] ","[24]f","[24]f"},{"\159\143\159\143\139\143[6] \159\143\132\159\128\148[6] ","[14]f0f00[6]f","[6]0[6]f00f0[8]f"},{"[3]-[18] [3]-","[3]0[18]f[3]0","[24]f"}},{{"[14] \139[10] ","[7]f[7]0f[3]0[7]f","[14]f0[10]f"},{"[11] \143\129\149 \132[8] ","[7]f[4]0ff[5]0[7]f","[11]f00f00[9]f"},{"[8] \159\135[3] \149\143\158\135\149[7] ","[7]f0ff[5]0ff0[7]f","[8]f[5]0ff00[8]f"},{"[7] \149[4] \143\150\144 \131\133[7] ","[8]f[5]0f[4]0[7]f","[7]f[5]0f0[11]f"},{"[7] \149 \136 \149 \131\144[8] ","[8]f00f00f0f00[7]f","[7]f[4]0ff[3]0[9]f"},{"[7] \138[4] \131\133 \149[8] ","[7]f[5]0ff[4]0[7]f","[8]f[8]0[9]f"},{"[8] \130\139\144[5] \149[8] ","[7]f[3]0f[7]0[7]f","[10]f[6]0[9]f"},{"[9] \143\131[4] \135[9] ","[7]f00ff[7]0[7]f","[9]f[6]0[10]f"},{"[12] \143\131[11] ","[7]f[11]0[7]f","[9]f[3]0[13]f"},{"[9] \143\135\129[13] ","[7]f[11]0[7]f","[25]f"},{"[6] \130\151\157\140\136\140[6] \136\151\149\131\131\149","[6]f00[10]f00f[3]0","[8]f[4]0[8]f0[3]f"},{"[6] \136\135\149\142\134\145[6] \159\149\143\153\153\143","[6]f00f00[8]f0f0ff","[8]f0ff0[6]f0f0f00"},{"\159\143\159\143\139\143[6] \159\143\132\159\128\148[6] ","[14]f0f00[6]f","[6]0[6]f00f0[8]f"},{"\128\149\159\137\143\155[6] \159\133\144\144\129\149[6] ","00[12]f[4]0[6]f","ff[4]0[6]f00[10]f"},{"[6]-[12] [6]-","[6]0[12]f[6]0","[24]f"}},{{"[14] \139[10] ","[7]f[7]0f[3]0[7]f","[14]f0[10]f"},{"[11] \143\129\149 \132[8] ","[7]f[4]0ff[5]0[7]f","[11]f00f00[9]f"},{"[8] \159\135[3] \149\143\158\135\149[7] ","[7]f0ff[5]0ff0[7]f","[8]f[5]0ff00[8]f"},{"[7] \149[4] \143\150\144 \131\133[7] ","[8]f[5]0f[4]0[7]f","[7]f[5]0f0[11]f"},{"[7] \149 \136 \149 \131\144[8] ","[8]f00f00f0f00[7]f","[7]f[4]0ff[3]0[9]f"},{"[7] \138[4] \131\133 \149[8] ","[7]f[5]0ff[4]0[7]f","[8]f[8]0[9]f"},{"[8] \130\139\144[5] \149[8] ","[7]f[3]0f[7]0[7]f","[10]f[6]0[9]f"},{"[9] \143\131[4] \135[9] ","[7]f00ff[7]0[7]f","[9]f[6]0[10]f"},{"[12] \143\131[11] ","[7]f[11]0[7]f","[9]f[3]0[13]f"},{"[9] \143\135\129[13] ","[7]f[11]0[7]f","[25]f"},{"[6] \128\149\151\157\153\151[6] \130\151\130\131\151\131","[6]f00[10]f[6]0","[8]f[4]0[12]f"},{"\159\143\159\143\139\143\130\151\157\140\136\140\159\143\132\159\128\148\136\151\149\131\131\149","[6]f00[6]f0f[4]0f[3]0","[6]0ff[6]0f0[4]f0[3]f"},{"\128\149\159\137\143\155\136\135\149\142\134\145\159\133\144\144\129\149\159\149\143\153\153\143","00[4]f00f00[3]f[4]0f0f0ff","ff[4]0ff0ff[3]0[4]f0f0f00"},{"\130\151\128\148\148\148[6] \128\129\144\130\143\157[6] ","[6]0[6]f0f00f0[6]f","[13]f0ff0[7]f"},{"[9]-[6] [9]-","[9]0[6]f[9]0","[24]f"}},{{"[14] \139[10] ","[7]f[7]0f[3]0[7]f","[14]f0[10]f"},{"[11] \143\129\149 \132[8] ","[7]f[4]0ff[5]0[7]f","[11]f00f00[9]f"},{"[8] \159\135[3] \149\143\158\135\149[7] ","[7]f0ff[5]0ff0[7]f","[8]f[5]0ff00[8]f"},{"[7] \149[4] \143\150\144 \131\133[7] ","[8]f[5]0f[4]0[7]f","[7]f[5]0f0[11]f"},{"[7] \149 \136 \149 \131\144[8] ","[8]f00f00f0f00[7]f","[7]f[4]0ff[3]0[9]f"},{"[7] \138[4] \131\133 \149[8] ","[7]f[5]0ff[4]0[7]f","[8]f[8]0[9]f"},{"[8] \130\139\144[5] \149[8] ","[7]f[3]0f[7]0[7]f","[10]f[6]0[9]f"},{"[9] \143\131[4] \135[9] ","[7]f00ff[7]0[7]f","[9]f[6]0[10]f"},{"[12] \143\131[11] ","[7]f[11]0[7]f","[9]f[3]0[13]f"},{"[9] \143\135\129[13] ","[7]f[11]0[7]f","[25]f"},{"\159\143\159\143\139\143\159\143\159\143\139\143\159\143\132\159\128\148\128\148\128\128\148\128","[14]f0f[8]0","[14]0f0[8]f"},{"\128\149\159\137\143\155\128\149\151\157\153\151\159\133\144\144\129\149\130\151\130\131\151\131","00[4]f00[6]f[10]0","ff[4]0ff[6]0[10]f"},{"\130\151\128\148\148\148\130\151\157\140\136\140\128\129\144\130\143\157\136\151\149\131\131\149","[8]0[4]f0f00f[3]0f[3]0","[8]f[4]0f0ff0[3]f0[3]f"},{"\136\135\159\133\149\138\136\135\149\142\134\145\130\149\128\131\128\149\159\149\143\153\153\143","00f00f00f00f0f[4]0f0f0ff","ff0ff0ff0ff0f0[4]f0f0f00"},{"[3]=[18]-[3]=","[24]0","[24]f"}},animation=true,secondsPerFrame=0.1}'
-- 解压函数
function rleDecompress(str)
local result = {}
local i = 1
while i <= #str do
if str:sub(i, i) == "[" then
local j = str:find("]", i)
local num = tonumber(str:sub(i+1, j-1))
local char = str:sub(j+1, j+1)
table.insert(result, char:rep(num))
i = j + 2
else
table.insert(result, str:sub(i, i))
i = i + 1
end
end
return table.concat(result)
end
-- 解压
local img = textutils.unserialize(rleDecompress(logostr))
logostr = ""
local function drawFrame(frame, term)
-- 获取终端的尺寸
local termWidth, termHeight = term.getSize()
-- 计算图像的尺寸
-- 假设所有行具有相同的长度,取第一行的长度作为图像宽度
local imageWidth, imageHeight = #frame[1][1] - 1, #frame
-- 计算居中的x和y偏移量
local xOffset = math.max(math.floor((termWidth - imageWidth) / 2), 0)
local yOffset = math.max(math.floor((termHeight - imageHeight) / 2), 0)
for y, row in ipairs(frame) do
-- 使用计算出的yOffset来垂直居中图像
term.setCursorPos(xOffset + 1, yOffset + y)
term.blit(table.unpack(row))
end
if frame.palette then
for i = 0, #frame.palette do
local c = frame.palette[i]
if type(c) == "table" then
term.setPaletteColor(2^i, table.unpack(c))
else
term.setPaletteColor(2^i, c)
end
end
end
if img.multiMonitor then
term.setTextScale(img.multiMonitor.scale or 0.5)
end
end
for i, frame in ipairs(img) do
drawFrame(frame, term)
if img.animation then sleep(frame.duration or img.secondsPerFrame or 0.05)
else read() break end
end