@@ -25,14 +25,19 @@ local mapCam={
2525}
2626local visibleModes
2727local touchDist
28+ local totalGrade
29+ local maxGrade
2830
2931local scene = {}
3032
3133function scene .sceneInit ()
34+ totalGrade ,maxGrade = 0 ,0
3235 BG .set ()
3336 mapCam .zoomK = SCN .prev == ' main' and 5 or 1
3437 visibleModes = {}-- 1=unlocked, 2=locked but visible
3538 for name ,M in next ,MODES do
39+ maxGrade = maxGrade + (M .getRank and 5 or 0 )
40+ totalGrade = (RANKS [name ] and RANKS [name ]> 0 ) and totalGrade + RANKS [name ] or totalGrade
3641 if RANKS [name ]and M .x then
3742 visibleModes [name ]= 1
3843 if M .unlock then
@@ -229,6 +234,35 @@ local function _drawModeShape(M,S,drawType)
229234 end
230235end
231236function scene .draw ()
237+ if CHALLENGE ~= 0 then
238+ setFont (50 )
239+ local percentage = string.format (" %.1f" , 100 * totalGrade / maxGrade ).. " %, "
240+ local rank = math.min (math.floor (8 * totalGrade / maxGrade )+ 1 ,8 )
241+ local colors = {
242+ {.7 ,.7 ,.7 }, -- F [0.00% - 12.5%]
243+ {.63 ,.52 ,.65 }, -- D [12.5% - 25.0%]
244+ {.45 ,.24 ,.56 }, -- C [25.0% - 37.5%]
245+ {.2 ,.4 ,.6 }, -- B [37.5% - 50.0%]
246+ {.6 ,.85 ,.65 }, -- A [50.0% - 62.5%]
247+ {.85 ,.8 ,.3 }, -- S [62.5% - 75.0%]
248+ {.85 ,.5 ,.4 }, -- U [75.0% - 87.5%]
249+ {.85 ,.3 ,.8 } -- X [87.5% - 100%]
250+ }
251+ local letters = {
252+ CHAR .icon .rankF ,
253+ CHAR .icon .rankD ,
254+ CHAR .icon .rankC ,
255+ CHAR .icon .rankB ,
256+ CHAR .icon .rankA ,
257+ CHAR .icon .rankS ,
258+ CHAR .icon .rankU ,
259+ CHAR .icon .rankX
260+ }
261+ gc_setColor (colors [rank ])
262+ local text = " [C" .. CHALLENGE .. " ] " .. totalGrade .. " /" .. maxGrade .. " (" .. percentage .. letters [rank ].. (totalGrade == maxGrade and " +" or " " ).. " )"
263+ mStr (text ,360 ,20 )
264+ end
265+ gc_setColor (1 ,1 ,1 ,1 )
232266 local _
233267 gc_push (' transform' )
234268 gc_translate (640 ,360 )
0 commit comments