Merge pull request 'Fix crashes on chalresult + fix wrong diff rectangles on chalresult' (#37) from fix/chalresult-crashes into master
Reviewed-on: #37
This commit is contained in:
commit
313b9819dd
|
@ -75,8 +75,8 @@ local gradeImages = {
|
||||||
none = gfx.CreateSkinImage("common/grades/none.png", 0),
|
none = gfx.CreateSkinImage("common/grades/none.png", 0),
|
||||||
}
|
}
|
||||||
|
|
||||||
local percRequired = 1;
|
local percRequired = nil;
|
||||||
local percGet = 0;
|
local percGet = nil;
|
||||||
|
|
||||||
-- AUDIO
|
-- AUDIO
|
||||||
game.LoadSkinSample("challenge_result.wav")
|
game.LoadSkinSample("challenge_result.wav")
|
||||||
|
@ -161,7 +161,7 @@ function drawChartResult(deltaTime, x, y, chartResult)
|
||||||
gfx.GlobalAlpha(1);
|
gfx.GlobalAlpha(1);
|
||||||
gfx.Text(chartResult.title, x+160,y+32);
|
gfx.Text(chartResult.title, x+160,y+32);
|
||||||
|
|
||||||
DiffRectangle.render(deltaTime, x+287.5, y+67, 0.85, chartResult.difficulty, chartResult.level)
|
DiffRectangle.render(deltaTime, x+287.5, y+67, 0.85, chartResult.difficulty+1, chartResult.level)
|
||||||
|
|
||||||
local score = chartResult.score or 0;
|
local score = chartResult.score or 0;
|
||||||
|
|
||||||
|
@ -215,8 +215,11 @@ function drawCompletion()
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.ImageRect(63, 1331, 766*0.85, 130*0.85, completitionImage, 1, 0)
|
gfx.ImageRect(63, 1331, 766*0.85, 130*0.85, completitionImage, 1, 0)
|
||||||
|
|
||||||
Numbers.draw_number(925, 1370, 1.0, percGet, 3, scoreNumber, true, 0.3, 1.12)
|
if (percRequired == nil) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
Numbers.draw_number(925, 1370, 1.0, percGet, 3, scoreNumber, true, 0.3, 1.12)
|
||||||
|
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.Rect(741, 1402, 278*math.min(1, percGet / percRequired), 6);
|
gfx.Rect(741, 1402, 278*math.min(1, percGet / percRequired), 6);
|
||||||
|
@ -226,7 +229,13 @@ end
|
||||||
|
|
||||||
|
|
||||||
function result_set()
|
function result_set()
|
||||||
|
if (result.requirement_text == nil) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local reqTextWords = common.split(result.requirement_text, ' ');
|
local reqTextWords = common.split(result.requirement_text, ' ');
|
||||||
|
|
||||||
|
|
||||||
for index, word in ipairs(reqTextWords) do
|
for index, word in ipairs(reqTextWords) do
|
||||||
if string.find(word, '%%') ~= nil then -- %% = %, because % is an escape char
|
if string.find(word, '%%') ~= nil then -- %% = %, because % is an escape char
|
||||||
local percNumber = tonumber(string.gsub(word, '%%', ''), 10)
|
local percNumber = tonumber(string.gsub(word, '%%', ''), 10)
|
||||||
|
@ -234,6 +243,10 @@ function result_set()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (percRequired == nil) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
game.Log(percRequired, game.LOGGER_ERROR);
|
game.Log(percRequired, game.LOGGER_ERROR);
|
||||||
|
|
||||||
local a = 0;
|
local a = 0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
local function split(s, delimiter)
|
local function split(s, delimiter)
|
||||||
result = {};
|
local result = {};
|
||||||
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
|
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
|
||||||
table.insert(result, match);
|
table.insert(result, match);
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue