Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PB and Diff display in Til' Death Playlists and add Refresh Button if you don't have songs #1307

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ local ind = 7
local translated_info = {
Alert = THEME:GetString("ScreenCoreBundleSelect", "Alert"),
Task = THEME:GetString("ScreenCoreBundleSelect", "Task"),
Explanation = THEME:GetString("ScreenCoreBundleSelect", "Explanation")
Explanation = THEME:GetString("ScreenCoreBundleSelect", "Explanation"),
RefreshSongs = THEME:GetString("GeneralInfo", "DifferentialReloadTrigger")
}

local o = Def.ActorFrame {
Expand Down Expand Up @@ -136,6 +137,33 @@ local function makedoots(i)
return t
end

o[#o + 1] = Def.ActorFrame {
UIElements.TextToolTip(1, 1, "Common Normal") .. {
Name = "refreshbutton",
InitCommand = function(self)
self:xy(0, 400):zoom(1):diffuse(getMainColor("positive")) -- curse of ra
end,
BeginCommand = function(self)
self:queuecommand("Set")
end,
SetCommand = function(self)
self:settextf(translated_info["RefreshSongs"])
end,
MouseOverCommand = function(self)
self:diffusealpha(0.6)
end,
MouseOutCommand = function(self)
self:diffusealpha(1)
end,
MouseDownCommand = function(self, params)
if params.event == "DeviceButton_left mouse button" then
SONGMAN:DifferentialReload()
SCREENMAN:GetTopScreen():StartTransitioningScreen("SM_GoToNextScreen")
end
end
}
}

for i = 1, #minidoots do
o[#o + 1] = makedoots(i)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ local function RateDisplayButton(i)
local o = Def.ActorFrame {
Name = "RateDisplay",
InitCommand = function(self)
self:x(220):diffuse(getMainColor("positive"))
self:x(200):diffuse(getMainColor("positive"))
end,
UIElements.TextToolTip(1, 1, "Common Large") .. {
Name = "Text",
Expand Down Expand Up @@ -226,7 +226,7 @@ local function TitleDisplayButton(i)
end,
UIElements.QuadButton(1, 1) .. {
InitCommand = function(self)
self:x(-22):zoomto(212, scoreYspacing):halign(0):diffusealpha(0)
self:x(-20):zoomto(190, scoreYspacing):halign(0):diffusealpha(0)
end,
MouseDownCommand = function(self, params)
-- wtf
Expand All @@ -251,7 +251,7 @@ local function TitleDisplayButton(i)
end,
DisplaySinglePlaylistLevel2MessageCommand = function(self)
self:zoom(fontScale)
self:maxwidth(480)
self:maxwidth(620)
local chartentry = chartlist[i + ((currentchartpage - 1) * chartsperplaylist)]
if chartentry == nil then return end
if chartentry:IsLoaded() then
Expand Down Expand Up @@ -310,6 +310,119 @@ local function DeleteChartButton(i)
return o
end

local function PBDisplayButton(i)
local o = Def.ActorFrame {
Name = "PBDisplay",
InitCommand = function(self)
self:x(227):zoom(1):halign(0):valign(0)
end,
UIElements.QuadButton(1, 1) .. {
InitCommand = function(self)
self:x(0):zoomto(40, scoreYspacing):halign(0):diffusealpha(0)
end,
MouseDownCommand = function(self, params)
-- wtf
if params.event == "DeviceButton_left mouse button" and update and chartlist[i + ((currentchartpage - 1) * chartsperplaylist)] and
chartlist[i + ((currentchartpage - 1) * chartsperplaylist)]:IsLoaded() and
singleplaylistactive and not clickedForSinglePlaylist
then
whee:SelectSong(songlist[i + ((currentchartpage - 1) * chartsperplaylist)])
end
end,
MouseOverCommand = function(self)
self:GetParent():GetChild("Text"):diffusealpha(0.7)
end,
MouseOutCommand = function(self)
self:GetParent():GetChild("Text"):diffusealpha(1)
end,
},
LoadFont("Common Large") .. {
Name = "Text",
InitCommand = function(self)
self:halign(0)
end,
DisplaySinglePlaylistLevel2MessageCommand = function(self)
local function getpb(chartkey, your_rate) --thank you poco i would buy you dr pepper if i would be able to do this
local scoresatrates = SCOREMAN:GetScoresByKey(chartkey)
local x = "x"
if scoresatrates ~= nil then
for r, l in pairs(scoresatrates) do
local rr = r:gsub("["..x.."]+", "")
if math.abs(rr - your_rate) < 0.001 then
local scoresatrate = l:GetScores()
return scoresatrate[1] -- either nil or a score
end
end
end
return nil
end
self:zoom(fontScale)
self:maxwidth(160)
local pbrate = chartlist[i + ((currentchartpage - 1) * chartsperplaylist)]:GetRate()
local pbchartkey = keylist[i + ((currentchartpage - 1) * chartsperplaylist)]
local pb = getpb(pbchartkey, pbrate)
if pb then
local bp = pb:GetWifeScore() * 100
self:settextf("%05.2f%%", bp)
self:diffuse(getGradeColor(pb:GetWifeGrade()))
else
self:settext("")
end
end,
DisplayLanguageChangedMessageCommand = function(self)
self:playcommand("DisplaySinglePlaylistLevel2")
end,
},
}
return o
end

local function DisplayDiff(i)
local o = Def.ActorFrame {
Name = "DisplayDiff",
InitCommand = function(self)
self:x(290):zoom(1):halign(0):valign(0)
end,
UIElements.QuadButton(1,1) .. {
InitCommand = function(self)
self:x(-7):zoomto(16, scoreYspacing):halign(0):diffusealpha(0) --you like odd numbers don't you
end,
MouseDownCommand = function(self, params)
-- wtf
if params.event == "DeviceButton_left mouse button" and update and chartlist[i + ((currentchartpage - 1) * chartsperplaylist)] and
chartlist[i + ((currentchartpage - 1) * chartsperplaylist)]:IsLoaded() and
singleplaylistactive and not clickedForSinglePlaylist
then
whee:SelectSong(songlist[i + ((currentchartpage - 1) * chartsperplaylist)])
end
end,
MouseOverCommand = function(self)
self:GetParent():GetChild("Text"):diffusealpha(0.7)
end,
MouseOutCommand = function(self)
self:GetParent():GetChild("Text"):diffusealpha(1)
end,
},
LoadFont("Common Large") .. {
Name = "Text",
InitCommand = function(self)
self:halign(0.5)
end,
DisplaySinglePlaylistLevel2MessageCommand = function(self)
self:zoom(fontScale)
self:maxwidth(70)
local diff = stepslist[i + ((currentchartpage - 1) * chartsperplaylist)]:GetDifficulty()
self:diffuse(byDifficulty(diff))
self:settext(getShortDifficulty(diff))
end,
DisplayLanguageChangedMessageCommand = function(self)
self:playcommand("DisplaySinglePlaylistLevel2")
end,
}
}
return o
end

local function rankingLabel(i)
local chart
local chartloaded
Expand All @@ -330,15 +443,21 @@ local function rankingLabel(i)
self:GetChild("DeleteButton"):queuecommand("DisplaySinglePlaylistLevel2")
self:GetChild("TitleDisplay"):queuecommand("DisplaySinglePlaylistLevel2")
self:GetChild("RateDisplay"):queuecommand("DisplaySinglePlaylistLevel2")
self:GetChild("PBDisplay"):queuecommand("DisplaySinglePlaylistLevel2")
self:GetChild("DisplayDiff"):queuecommand("DisplaySinglePlaylistLevel2")
self:GetChild("DeleteButton"):visible(true)
self:GetChild("TitleDisplay"):visible(true)
self:GetChild("RateDisplay"):visible(true)
self:GetChild("PBDisplay"):visible(true)
self:GetChild("DisplayDiff"):visible(true)
self:GetChild("PackMouseOver"):visible(true)
self:GetChild("ChartNumber"):visible(true)
else
self:GetChild("DeleteButton"):visible(false)
self:GetChild("TitleDisplay"):visible(false)
self:GetChild("RateDisplay"):visible(false)
self:GetChild("PBDisplay"):visible(false)
self:GetChild("DisplayDiff"):visible(false)
self:GetChild("PackMouseOver"):visible(false)
self:GetChild("ChartNumber"):visible(false)
end
Expand Down Expand Up @@ -453,6 +572,8 @@ local function rankingLabel(i)
t[#t + 1] = RateDisplayButton(i)
t[#t + 1] = TitleDisplayButton(i)
t[#t + 1] = DeleteChartButton(i)
t[#t + 1] = PBDisplayButton(i)
t[#t + 1] = DisplayDiff(i)
return t
end

Expand Down
2 changes: 1 addition & 1 deletion Themes/Til Death/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ DefaultDescription=Press <CTRL + Delete> to select the default color\nPress <ALT
[ScreenCoreBundleSelect]
Alert=You have no songs!
Task=Select a skill range to begin downloading some
Explanation=Core bundles are diverse selections of packs that span a skill range. They are chosen based on quality\nand popularity and are intended to span a variety of music and chart types. They will always be \navailable for download in the Packs tab in case you misjudge your level or wish for an easy step up.
Explanation=Core bundles are diverse selections of packs that span a skill range. They are chosen based on quality\nand popularity and are intended to span a variety of music and chart types. They will always be \navailable for download in the Packs tab in case you misjudge your level or wish for an easy step up.\nIf you have installed packs manually, press the corresponding button below or restart the game.

[ScreenEvaluation]
Title=Results
Expand Down