From 5861b249de7806e43574cd610a130556bfb4aed0 Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Fri, 30 Jul 2021 18:27:43 +0200 Subject: [PATCH] + badges to songwheel plates --- scripts/songselect/songwheel.lua | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/scripts/songselect/songwheel.lua b/scripts/songselect/songwheel.lua index 61ae1a0..4e27d18 100644 --- a/scripts/songselect/songwheel.lua +++ b/scripts/songselect/songwheel.lua @@ -3,6 +3,8 @@ local backgroundImage = gfx.CreateSkinImage("song_select/bg.png", 1) local songPlateBg = gfx.CreateSkinImage("song_select/plate/bg.png", 1) local songPlateBottomBarOverlayImage = gfx.CreateSkinImage("song_select/plate/bottom_bar_overlay.png", 1) +local cursorImage = gfx.CreateSkinImage("song_select/cursor.png", 1) + local difficultyLabelImages = { gfx.CreateSkinImage("song_select/plate/difficulty_labels/novice.png", 1), gfx.CreateSkinImage("song_select/plate/difficulty_labels/advanced.png", 1), @@ -14,6 +16,15 @@ local difficultyLabelImages = { gfx.CreateSkinImage("song_select/plate/difficulty_labels/vivid.png", 1), } +local badgeImages = { + gfx.CreateSkinImage("song_select/medal/nomedal.png", 1), + gfx.CreateSkinImage("song_select/medal/played.png", 1), + gfx.CreateSkinImage("song_select/medal/cleared.png", 1), + gfx.CreateSkinImage("song_select/medal/hard.png", 1), + gfx.CreateSkinImage("song_select/medal/uc.png", 1), + gfx.CreateSkinImage("song_select/medal/puc.png", 1), +} + local difficultyNumbers; local resx, resy = game.GetResolution() @@ -76,6 +87,8 @@ end function drawSong(song, y) local songX = desw/2+28 + local selectedSongDifficulty = song.difficulties[selectedDifficulty] + local bestScore = selectedSongDifficulty.scores[1] or nil; -- Draw the bg for the song plate gfx.BeginPath() @@ -92,12 +105,20 @@ function drawSong(song, y) -- Draw the difficulty notch background gfx.BeginPath() - gfx.ImageRect(songX, y+95, 83, 74, difficultyLabelImages[song.difficulties[selectedDifficulty].difficulty+1], 1, 0) + gfx.ImageRect(songX, y+95, 83, 74, difficultyLabelImages[selectedSongDifficulty.difficulty+1], 1, 0) -- Draw the difficulty level number gfx.BeginPath() - draw_number(songX+30, y+125, 1.0, song.difficulties[selectedDifficulty].level, 2, difficultyNumbers, false, 0.65, 1) + draw_number(songX+30, y+125, 1.0, selectedSongDifficulty.level, 2, difficultyNumbers, false, 0.65, 1) + -- Draw score badge + local badgeImage = badgeImages[1]; + if bestScore and bestScore.badge > 0 then + badgeImage = badgeImages[bestScore.badge+1]; + end + + gfx.BeginPath() + gfx.ImageRect(songX+282, y+44, 79, 69, badgeImage, 1, 0) end function drawSongList() @@ -108,6 +129,11 @@ function drawSongList() drawSong(songwheel.songs[selectedIndex+2], desh/2-172/2+172*2) end +function drawCursor() + gfx.BeginPath() + gfx.ImageRect(desw/2-14, desh/2-213/2, 555, 213, cursorImage, 1, 0) +end + render = function (deltaTime) resetLayoutInformation(); gfx.Scale(scale, scale); @@ -119,6 +145,7 @@ render = function (deltaTime) drawBackground(); drawSongList() + drawCursor() gfx.BeginPath(); gfx.FontSize(18)