Module:沙盒/盐棋/Sandbox:修订间差异

添加185字节 、​ 2024年2月25日 (星期日)
ulk测试
(调整)
(ulk测试)
第52行: 第52行:
end)
end)
return res
return res
end
local names = {'frag', 'prev', 'ptt'}
local function judgeCond(type)
if type == 0 then
return 'frag'
elseif type == 5 then
return 'ptt'
elseif type <= 100 and type ~= 5 then
return 'prev'
end
end
local function createRow()
local res = {}
for _, k in ipairs(names) do res[k] = 0 end
return res
end
local function judgeRow(row)
local res = {}
for _, k in ipairs(names) do if row[k] > 0 then table.insert(res, 'ulk-' .. k) end end
return #res > 0 and ('class="%s"'):format(table.concat(res, ' ')) or ''
end
end


第59行: 第80行:
local id, rc = chartUlk.songId, chartUlk.ratingClass + 1
local id, rc = chartUlk.songId, chartUlk.ratingClass + 1
for _, cond in ipairs(chartUlk.conditions) do
for _, cond in ipairs(chartUlk.conditions) do
local className
local className = judgeCond(cond.type)
if cond.type == 0 or cond.type == 5 then
className = 'frag'
elseif cond.type <= 100 then
className = 'prev'
end
if className then
if className then
local row = view[id]
local row = view[id]
if not row then
if not row then
row = {frag = 0, prev = 0}
row = createRow()
view[id] = row
view[id] = row
end
end
第94行: 第110行:
rowText[i] = ' '
rowText[i] = ' '
else
else
rowText[i] = table.concat(cell, '<br/>')
rowText[i] = table.concat(cell, '<br>')
end
end
end
end
local tot = row.frag + row.prev
local className = judgeRow(row)
local className
if id == 'lasteternity' then className = '' end
if row.frag == tot then
className = 'frag'
elseif row.prev == tot then
className = 'prev'
end
className = className and ('class="ulk-%s"'):format(className) or ''
if id == 'lasteternity' then className = 'class="ulk-frag ulk-prev"' end
table.insert(texts, {
table.insert(texts, {
data = rowFormat:format(className, mLink[id], unpack(rowText)),
data = rowFormat:format(className, mLink[id], unpack(rowText)),
2,525

个编辑