add jacketPath to challengesCache #14
|
@ -131,6 +131,10 @@ ImageFont.draw = function(this, text, x, y, alpha, hFlag, vFlag)
|
|||
end
|
||||
|
||||
function GetDisplayDifficulty(jacketPath, difficulty)
|
||||
if jacketPath == nil then
|
||||
return difficulty
|
||||
end
|
||||
|
||||
local strippedPath = string.match(jacketPath:lower(), "[/\\][^\\/]+$")
|
||||
if difficulty == 3 and strippedPath then
|
||||
if string.find(strippedPath, "inf") ~= nil then
|
||||
|
|
|
@ -143,7 +143,8 @@ local check_or_create_cache = function(challenge)
|
|||
["title"] = gfx.CreateLabel(missing_text, defaultLabelSize, 0),
|
||||
["title_raw"] = missing_text,
|
||||
["level"] = 0,
|
||||
["difficulty"] = 0
|
||||
["difficulty"] = 0,
|
||||
["jacketPath"] = "",
|
||||
}
|
||||
}
|
||||
else -- if not challenge.missing_chart then
|
||||
|
@ -153,7 +154,8 @@ local check_or_create_cache = function(challenge)
|
|||
["title"] = gfx.CreateLabel(chart.title, defaultLabelSize, 0),
|
||||
["title_raw"] = chart.title,
|
||||
["level"] = chart.level,
|
||||
["difficulty"] = chart.difficulty
|
||||
["difficulty"] = chart.difficulty,
|
||||
["jacketPath"] = chart.jacketPath,
|
||||
})
|
||||
end
|
||||
challengeCache[challenge.id]["charts"] = charts
|
||||
|
@ -403,8 +405,7 @@ draw_challenge = function(challenge, x, y, w, h, selected)
|
|||
|
||||
for i, chart in ipairs(challengeCache[challenge.id]["charts"]) do
|
||||
local ypos = offsetY + paddingY * (i - 1)
|
||||
|
||||
local adjustedDiff = GetDisplayDifficulty(chart.jacketPath, chart.diff)
|
||||
local adjustedDiff = GetDisplayDifficulty(chart.jacketPath, chart.difficulty)
|
||||
DiffRectangle.render(timer, offsetX, ypos, diffIconScale, adjustedDiff, chart.level)
|
||||
|
||||
local _, titleHeight = gfx.LabelSize(chart.title)
|
||||
|
|
Loading…
Reference in New Issue