Skip to content

Commit 924213d

Browse files
mash a recent scores viewer into profile tab
1 parent 9e9bb32 commit 924213d

File tree

3 files changed

+342
-9
lines changed

3 files changed

+342
-9
lines changed

Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/profile.lua

+233-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local update = false
22
local showOnline = false
3+
local recentactive = false
34
local function BroadcastIfActive(msg)
45
if update then
56
MESSAGEMAN:Broadcast(msg)
@@ -131,7 +132,7 @@ local function rankingLabel(i)
131132
self:visible(false)
132133
end,
133134
UpdateRankingMessageCommand = function(self)
134-
if rankingSkillset > 1 and update then
135+
if rankingSkillset > 1 and update and not recentactive then
135136
if not showOnline then
136137
ths = SCOREMAN:GetTopSSRHighScoreForGame(i + (scoresperpage * (rankingPage - 1)), ms.SkillSets[rankingSkillset])
137138
if ths then
@@ -366,14 +367,15 @@ local function rankingButton(i)
366367
self:zoomto(rankingTitleSpacing, 30):diffuse(getMainColor("frames")):diffusealpha(0.35)
367368
end,
368369
SetCommand = function(self)
369-
if i == rankingSkillset then
370+
if i == rankingSkillset and not recentactive then
370371
self:diffusealpha(1)
371372
else
372373
self:diffusealpha(0.35)
373374
end
374375
end,
375376
MouseLeftClickMessageCommand = function(self)
376377
if ButtonActive(self) then
378+
recentactive = false
377379
rankingSkillset = i
378380
rankingPage = 1
379381
SCOREMAN:SortSSRsForGame(ms.SkillSets[rankingSkillset])
@@ -397,6 +399,222 @@ local function rankingButton(i)
397399
return t
398400
end
399401

402+
403+
local function recentLabel(i)
404+
local ths -- aAAAAAAAA
405+
local ck
406+
local thssteps
407+
local thssong
408+
local xoffset
409+
local onlineScore
410+
411+
local t =
412+
Def.ActorFrame {
413+
InitCommand = function(self)
414+
self:xy(rankingX - 38 , rankingY + offsetY + 10 + (i - 1) * scoreYspacing)
415+
self:visible(false)
416+
end,
417+
UpdateRankingMessageCommand = function(self)
418+
if recentactive and update then
419+
ths = SCOREMAN:GetRecentScoreForGame(i + (scoresperpage * (rankingPage - 1)))
420+
if ths then
421+
self:visible(true)
422+
ck = ths:GetChartKey()
423+
thssong = SONGMAN:GetSongByChartKey(ck)
424+
thssteps = SONGMAN:GetStepsByChartKey(ck)
425+
MESSAGEMAN:Broadcast("DisplayProfileRankingLabels")
426+
else
427+
self:visible(false)
428+
end
429+
else
430+
onlinesScore = nil
431+
self:visible(false)
432+
end
433+
end,
434+
LoadFont("Common Large") ..
435+
{
436+
InitCommand = function(self)
437+
self:halign(0):zoom(fontScale)
438+
self:maxwidth(100)
439+
end,
440+
DisplayProfileRankingLabelsMessageCommand = function(self)
441+
if ths then
442+
self:halign(0.5)
443+
self:settext(((rankingPage - 1) * 25) + i .. ".")
444+
self:diffuse(byValidity(ths:GetEtternaValid()))
445+
end
446+
end
447+
},
448+
LoadFont("Common Large") ..
449+
{
450+
InitCommand = function(self)
451+
self:halign(0):zoom(fontScale)
452+
self:x(15):maxwidth(160)
453+
end,
454+
DisplayProfileRankingLabelsMessageCommand = function(self)
455+
if ths then
456+
self:settextf("%5.2f", ths:GetSkillsetSSR(ms.SkillSets[1]))
457+
self:diffuse(byValidity(ths:GetEtternaValid()))
458+
else
459+
self:settext("")
460+
end
461+
end
462+
},
463+
LoadFont("Common Large") ..
464+
{
465+
InitCommand = function(self)
466+
self:halign(0):zoom(fontScale)
467+
self:x(55):maxwidth(580)
468+
end,
469+
DisplayProfileRankingLabelsMessageCommand = function(self)
470+
471+
if thssong then
472+
self:settext(thssong:GetDisplayMainTitle())
473+
self:diffuse(byValidity(ths:GetEtternaValid()))
474+
else
475+
self:settext("")
476+
end
477+
478+
479+
end
480+
},
481+
LoadFont("Common Large") ..
482+
{
483+
InitCommand = function(self)
484+
self:halign(0):zoom(fontScale)
485+
self:x(220)
486+
end,
487+
DisplayProfileRankingLabelsMessageCommand = function(self)
488+
489+
if ths then
490+
self:halign(0.5)
491+
local ratestring = string.format("%.2f", ths:GetMusicRate()):gsub("%.?0+$", "") .. "x"
492+
self:settext(ratestring)
493+
self:diffuse(byValidity(ths:GetEtternaValid()))
494+
else
495+
self:settext("")
496+
end
497+
end
498+
},
499+
LoadFont("Common Large") ..
500+
{
501+
InitCommand = function(self)
502+
self:halign(0):zoom(fontScale)
503+
self:x(240):maxwidth(160)
504+
end,
505+
DisplayProfileRankingLabelsMessageCommand = function(self)
506+
507+
if ths then
508+
self:settextf("%5.2f%%", ths:GetWifeScore() * 100)
509+
if not ths:GetEtternaValid() then
510+
self:diffuse(byJudgment("TapNoteScore_Miss"))
511+
else
512+
self:diffuse(getGradeColor(ths:GetWifeGrade()))
513+
end
514+
else
515+
self:settext("")
516+
end
517+
518+
end
519+
},
520+
LoadFont("Common Large") ..
521+
{
522+
InitCommand = function(self)
523+
self:halign(0):zoom(fontScale)
524+
self:x(300)
525+
end,
526+
DisplayProfileRankingLabelsMessageCommand = function(self)
527+
self:halign(0.5)
528+
if thssteps then
529+
local diff = thssteps:GetDifficulty()
530+
self:diffuse(byDifficulty(diff))
531+
self:settext(getShortDifficulty(diff))
532+
else
533+
self:settext("")
534+
end
535+
end
536+
},
537+
Def.Quad {
538+
InitCommand = function(self)
539+
self:halign(0):zoom(fontScale)
540+
self:diffusealpha(buttondiffuse)
541+
end,
542+
DisplayProfileRankingLabelsMessageCommand = function(self) -- hacky
543+
self:visible(true)
544+
self:zoomto(300, scoreYspacing)
545+
end,
546+
MouseLeftClickMessageCommand = function(self)
547+
if recentactive and ButtonActive(self) then
548+
if ths then
549+
local srate = ths:GetMusicRate()
550+
whee:SelectSong(thssong)
551+
GAMESTATE:GetSongOptionsObject("ModsLevel_Preferred"):MusicRate(srate)
552+
GAMESTATE:GetSongOptionsObject("ModsLevel_Song"):MusicRate(srate)
553+
GAMESTATE:GetSongOptionsObject("ModsLevel_Current"):MusicRate(srate)
554+
end
555+
end
556+
end
557+
},
558+
LoadFont("Common Normal") ..
559+
{
560+
--date
561+
InitCommand = function(self)
562+
self:x(310):zoom(fontScale + 0.05):halign(0)
563+
end,
564+
DisplayProfileRankingLabelsMessageCommand = function(self)
565+
if ths then
566+
self:settext(ths:GetDate())
567+
else
568+
self:settext("")
569+
end
570+
end,
571+
},
572+
}
573+
return t
574+
end
575+
576+
local function recentButton()
577+
local t =
578+
Def.ActorFrame {
579+
InitCommand = function(self)
580+
self:xy(rankingX + (3.5) * rankingTitleSpacing, offsetY * 0.65):valign(1)
581+
end,
582+
Def.Quad {
583+
InitCommand = function(self)
584+
self:zoomto(rankingTitleSpacing, 30):diffuse(getMainColor("frames")):diffusealpha(0.35)
585+
end,
586+
SetCommand = function(self)
587+
if recentactive then
588+
self:diffusealpha(1)
589+
else
590+
self:diffusealpha(0.35)
591+
end
592+
end,
593+
MouseLeftClickMessageCommand = function(self)
594+
if ButtonActive(self) then
595+
recentactive = true
596+
rankingPage = 1
597+
SCOREMAN:SortRecentScoresForGame()
598+
BroadcastIfActive("UpdateRanking")
599+
end
600+
end,
601+
UpdateRankingMessageCommand = function(self)
602+
self:queuecommand("Set")
603+
end
604+
},
605+
LoadFont("Common Large") ..
606+
{
607+
InitCommand = function(self)
608+
self:diffuse(getMainColor("positive")):maxwidth(rankingTitleSpacing):maxheight(25):zoom(0.85)
609+
end,
610+
BeginCommand = function(self)
611+
self:settext("recent")
612+
end
613+
}
614+
}
615+
return t
616+
end
617+
400618
t[#t + 1] =
401619
Def.ActorFrame {
402620
InitCommand = function(self)
@@ -509,7 +727,7 @@ r[#r + 1] =
509727
self:xy(10, frameHeight - offsetY):visible(false)
510728
end,
511729
UpdateRankingMessageCommand = function(self)
512-
if rankingSkillset > 1 and not showOnline then
730+
if (rankingSkillset > 1 or recentactive ) and not showOnline then
513731
self:visible(true)
514732
if not self and self.GetChildren then
515733
for child in self:GetChildren() do
@@ -577,20 +795,26 @@ for i = 1, scoresperpage do
577795
r[#r + 1] = rankingLabel(i)
578796
end
579797

798+
for i = 1, scoresperpage do
799+
r[#r + 1] = recentLabel(i)
800+
end
801+
580802
-- Technically the "overall" skillset is used for single value display during music select/eval and isn't factored in to the profile rating
581803
-- Only the specific skillsets are, and so overall should be used to display the specific skillset breakdowns separately - mina
582804
for i = 1, #ms.SkillSets do
583805
r[#r + 1] = rankingButton(i)
584806
end
585807

808+
r[#r + 1] = recentButton()
809+
586810
local function littlebits(i)
587811
local t =
588812
Def.ActorFrame {
589813
InitCommand = function(self)
590814
self:xy(frameX + 30, frameY + 50)
591815
end,
592816
UpdateRankingMessageCommand = function(self)
593-
if rankingSkillset == 1 and update then
817+
if rankingSkillset == 1 and update and not recentactive then
594818
self:visible(true)
595819
else
596820
self:visible(false)
@@ -693,7 +917,7 @@ local profilebuttons =
693917
end
694918
end,
695919
UpdateRankingMessageCommand = function(self)
696-
if rankingSkillset == 1 and update then
920+
if rankingSkillset == 1 and update and not recentactive then
697921
self:visible(true)
698922
else
699923
self:visible(false)
@@ -710,7 +934,7 @@ local profilebuttons =
710934
self:zoomto(100, 20):diffusealpha(buttondiffuse)
711935
end,
712936
MouseLeftClickMessageCommand = function(self)
713-
if ButtonActive(self) and rankingSkillset == 1 then
937+
if ButtonActive(self) and rankingSkillset == 1 and not recentactive then
714938
if PROFILEMAN:SaveProfile(PLAYER_1) then
715939
ms.ok(translated_info["Success"])
716940
STATSMAN:UpdatePlayerRating()
@@ -731,7 +955,7 @@ local profilebuttons =
731955
self:x(100):zoomto(100, 20):diffusealpha(buttondiffuse)
732956
end,
733957
MouseLeftClickMessageCommand = function(self)
734-
if ButtonActive(self) and rankingSkillset == 1 then
958+
if ButtonActive(self) and rankingSkillset == 1 and not recentactive then
735959
SCREENMAN:SetNewScreen("ScreenAssetSettings")
736960
end
737961
end
@@ -747,7 +971,7 @@ local profilebuttons =
747971
self:x(200):zoomto(100, 20):diffusealpha(buttondiffuse)
748972
end,
749973
MouseLeftClickMessageCommand = function(self)
750-
if ButtonActive(self) and rankingSkillset == 1 then
974+
if ButtonActive(self) and rankingSkillset == 1 and not recentactive then
751975
profile:UnInvalidateAllScores()
752976
STATSMAN:UpdatePlayerRating()
753977
end
@@ -764,7 +988,7 @@ local profilebuttons =
764988
self:x(300):zoomto(100, 20):diffusealpha(buttondiffuse)
765989
end,
766990
MouseLeftClickMessageCommand = function(self)
767-
if ButtonActive(self) and rankingSkillset == 1 then
991+
if ButtonActive(self) and rankingSkillset == 1 and not recentactive then
768992
ms.ok("Recalculating Scores... this might be slow and may or may not crash")
769993
profile:ForceRecalcScores()
770994
end

0 commit comments

Comments
 (0)