diff --git a/docs/lua_api/songwheel.lua b/docs/lua_api/songwheel.lua index 2c57b26..c86b9be 100644 --- a/docs/lua_api/songwheel.lua +++ b/docs/lua_api/songwheel.lua @@ -1,29 +1,62 @@ -- songwheel `songwheel` table ----@class Difficulty +---@class SongWheelScore +---@field auto_flags integer # Autoplay flag +---@field badge integer # `0` = Manual Exit, `1` = Played, `2` = Cleared, `3` = Hard Cleared, `4` = Full Chain, `5` = Perfect Chain +---@field combo integer # Max combo +---@field earlies integer # Total early hits +---@field gauge number # Ending gauge percentage, `0.0` to `1.0` +---@field gauge_option integer # Gauge option e.g. ARS +---@field gauge_type integer # `0` = Normal, `1` = Hard, `2` = Permissive, `3` = Blastive +---@field goods integer # Total near hits +---@field isLocal integer # `0` = false, `1` = true +---@field lates integer # Total late hits +---@field mirror integer # Mirror mode flag +---@field misses integer # Total errors +---@field playerName string # Name of the player +---@field perfects integer # Total critical hits +---@field random integer # Random mode flag +---@field score integer # Result score +---@field timestamp integer # Unix timestamp of the score +SongWheelScore = {} + +---@class SongWheelDifficulty ---@field difficulty integer # Difficulty index +---@field effector string # Name of charter ---@field hash string # Difficulty hash ---@field id integer # Difficulty id, unique static identifier ---@field illustrator string # Difficulty jacket illustrator ---@field jacketPath string # Full filepath to the jacket image on the disk ---@field level integer # Difficulty level ----@field scores Score[] # Scores for the current difficulty +---@field scores SongWheelScore[] # Scores for the current difficulty ---@field topBadge integer # `0 = Never Played`, `1 = Played`, `2 = Cleared`, `3 = Hard Cleared`, `4 = Full Chain`, `5 = Perfect Chain` -Difficulty = {}; +SongWheelDifficulty = {} ----@class Song +---@class SongWheelSong ---@field artist string # Chart artist ----@field difficulties Difficulty[] # Array of difficulties for the current song +---@field difficulties SongWheelDifficulty[] # Array of difficulties for the current song ---@field bpm number # Chart BPM ---@field id integer # Song id, unique static identifier ---@field path string # Full filepath to the chart folder on the disk ---@field title string # Chart title -Song = {}; +SongWheelSong = {} ---@class songwheel ----@field allSongs Song[] # Array of all available songs +---@field allSongs SongWheelSong[] # Array of all available songs ---@field searchInputActive boolean # Search status ---@field searchStatus string # Current song database status ---@field searchText string # Search input text ----@field songs Song[] # Array of songs with the current filters/sorting applied -songwheel = {}; \ No newline at end of file +---@field songs SongWheelSong[] # Array of songs with the current filters/sorting applied +songwheel = {} + +---Render, called every frame +---@param deltaTime number # time in seconds between frames +render = function (deltaTime) end + +---Called when selected difficulty changes +---@param diff integer # Difficulty level +set_diff = function (diff) end + +---Called when song database changes +---@param withAll boolean # Reload all songs +songs_changed = function (withAll) end diff --git a/scripts/songselect/songwheel.lua b/scripts/songselect/songwheel.lua index 44116b1..9e92ff1 100644 --- a/scripts/songselect/songwheel.lua +++ b/scripts/songselect/songwheel.lua @@ -525,6 +525,7 @@ function drawData() -- Draws the song data on the left panel end +---@param diff SongWheelDifficulty function drawLocalLeaderboard(diff) gfx.LoadSkinFont('Digital-Serial-Bold.ttf') gfx.FontSize(26) @@ -550,15 +551,19 @@ function drawLocalLeaderboard(diff) gfx.Text("LOCAL TOP", sbBarContentRightX, scoreBoardY + sbBarHeight/2) for i = 1, 5, 1 do + local scoreTable = diff.scores[i] + local username = scoreTable and scoreTable.playerName or game.GetSkinSetting("username") or "Unknown" + local score = scoreTable and scoreTable.score or "- - - - - - - -" + gfx.BeginPath() gfx.ImageRect(scoreBoardX, scoreBoardY + i*sbBarHeight, sbBarWidth, sbBarHeight, scoreBoardBarBgImage, 1, 0) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE) gfx.BeginPath() - gfx.Text(game.GetSkinSetting("username"), sbBarContentLeftX, scoreBoardY + sbBarHeight/2 + i*sbBarHeight) + gfx.Text(username, sbBarContentLeftX, scoreBoardY + sbBarHeight/2 + i*sbBarHeight) gfx.BeginPath() - gfx.Text((diff.scores[i]) and diff.scores[i].score or "- - - - - - - -", sbBarContentRightX, scoreBoardY + sbBarHeight/2 + i*sbBarHeight) + gfx.Text(score, sbBarContentRightX, scoreBoardY + sbBarHeight/2 + i*sbBarHeight) end end