Skip to content

Commit

Permalink
Fix misc net eval scoreboard display stuff
Browse files Browse the repository at this point in the history
score sorting, positioning, max amount of scores
  • Loading branch information
poco0317 committed Dec 4, 2018
1 parent a739d7c commit e95c5d6
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions Themes/Til Death/BGAnimations/MPscoreboard.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local lines = 6 -- number of scores to display
local lines = 10 -- number of scores to display
local framex = SCREEN_WIDTH - capWideScale(get43size(230), 230)
local framey = 60
local frameWidth = capWideScale(get43size(220), 220)
Expand Down Expand Up @@ -59,6 +59,9 @@ local function Update(self)
end
end

local sortFunction = function(first, second)
return first["highscore"]:GetWifeScore() > second["highscore"]:GetWifeScore()
end

local t =
Def.ActorFrame {
Expand All @@ -69,12 +72,14 @@ local t =
BeginCommand = function(self)
SCREENMAN:GetTopScreen():AddInputCallback(input)
multiscores = NSMAN:GetEvalScores()
table.sort(multiscores, sortFunction)
for i=1, math.min(#multiscores) do
self:GetChild(i):queuecommand("UpdateNetScore")
end
end,
NewMultiScoreMessageCommand = function(self)
multiscores = NSMAN:GetEvalScores()
table.sort(multiscores, sortFunction)
for i=1, math.min(#multiscores) do
self:GetChild(i):queuecommand("UpdateNetScore")
end
Expand All @@ -94,15 +99,15 @@ local function scoreitem(pn, i)
--The main quad
Def.Quad {
InitCommand = function(self)
self:xy(framex, framey + (i * spacing) - 4):zoomto(frameWidth, 30):halign(0):valign(0):diffuse(
self:xy(framex, framey + ((i-1) * spacing) - 4):zoomto(frameWidth, 30):halign(0):valign(0):diffuse(
color("#333333")
):diffusealpha(1):diffuserightedge(color("#33333333"))
end
},
--Highlight quad for the current score
Def.Quad {
InitCommand = function(self)
self:xy(framex, framey + (i * spacing) - 4):zoomto(frameWidth, 30):halign(0):valign(0):diffuse(
self:xy(framex, framey + ((i-1) * spacing) - 4):zoomto(frameWidth, 30):halign(0):valign(0):diffuse(
color("#ffffff")
):diffusealpha(0.3):diffuserightedge(color("#33333300"))
end,
Expand All @@ -117,15 +122,15 @@ local function scoreitem(pn, i)
Def.Quad {
Name = "mouseOver",
UpdateNetScoreCommand = function(self)
self:xy(framex, framey + (i * spacing) - 4):zoomto(frameWidth*2, 30):halign(0):valign(0):diffuse(
self:xy(framex, framey + ((i-1) * spacing) - 4):zoomto(frameWidth*2, 30):halign(0):valign(0):diffuse(
getMainColor("highlight")
):diffusealpha(0)
end
},
--ClearType lamps
Def.Quad {
UpdateNetScoreCommand = function(self)
self:xy(framex, framey + (i * spacing) - 4):zoomto(8, 30):halign(0):valign(0):diffuse(
self:xy(framex, framey + ((i-1) * spacing) - 4):zoomto(8, 30):halign(0):valign(0):diffuse(
getClearTypeFromScore(pn, hs, 2)
)
end
Expand All @@ -134,7 +139,7 @@ local function scoreitem(pn, i)
LoadFont("Common normal") ..
{
InitCommand = function(self)
self:xy(framex - 8, framey + 12 + (i * spacing)):zoom(0.35)
self:xy(framex - 8, framey + 12 + ((i-1) * spacing)):zoom(0.35)
end,
UpdateNetScoreCommand = function(self)
self:settext(i)
Expand All @@ -152,7 +157,7 @@ local function scoreitem(pn, i)
{
Name = "wife",
InitCommand = function(self)
self:xy(framex + 10, framey + 11 + (i * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.3)
self:xy(framex + 10, framey + 11 + ((i-1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.3)
end,
UpdateNetScoreCommand = function(self)
self:settextf("%05.2f%% (%s)", notShit.floor(multiscores[i].highscore:GetWifeScore() * 10000) / 100, "Wife")
Expand All @@ -162,7 +167,7 @@ local function scoreitem(pn, i)
{
Name = "user",
InitCommand = function(self)
self:xy(framex + 10, framey + 1 + (i * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.3)
self:xy(framex + 10, framey + 1 + ((i-1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.3)
end,
UpdateNetScoreCommand = function(self)
self:settextf(multiscores[i].user)
Expand All @@ -175,7 +180,7 @@ local function scoreitem(pn, i)
{
Name = "option",
InitCommand = function(self)
self:xy(framex + 10, framey + 11 + (i * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.35)
self:xy(framex + 10, framey + 11 + ((i-1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.35)
end,
UpdateNetScoreCommand = function(self)
self:settext(multiscores[i].highscore:GetModifiers())
Expand All @@ -186,7 +191,7 @@ local function scoreitem(pn, i)
{
Name = "grade",
InitCommand = function(self)
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 2 + (i * spacing)):zoom(0.35):halign(0.5):maxwidth(
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 2 + ((i-1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
(frameWidth - 15) / 0.35
)
end,
Expand All @@ -199,7 +204,7 @@ local function scoreitem(pn, i)
{
Name = "clear",
InitCommand = function(self)
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 12 + (i * spacing)):zoom(0.35):halign(0.5):maxwidth(
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 12 + ((i-1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
(frameWidth - 15) / 0.35
)
end,
Expand All @@ -212,7 +217,7 @@ local function scoreitem(pn, i)
{
Name = "combo",
InitCommand = function(self)
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 22 + (i * spacing)):zoom(0.35):halign(0.5):maxwidth(
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 22 + ((i-1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
(frameWidth - 15) / 0.35
)
end,
Expand All @@ -224,7 +229,7 @@ local function scoreitem(pn, i)
{
Name = "judge",
InitCommand = function(self)
self:xy(framex + 10, framey + 20 + (i * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.35)
self:xy(framex + 10, framey + 20 + ((i-1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.35)
end,
UpdateNetScoreCommand = function(self)
self:settextf("%d / %d / %d / %d / %d / %d",
Expand All @@ -241,7 +246,7 @@ local function scoreitem(pn, i)
{
Name = "date",
InitCommand = function(self)
self:xy(framex + 10, framey + 20 + (i * spacing)):zoom(0.35):halign(0)
self:xy(framex + 10, framey + 20 + ((i-1) * spacing)):zoom(0.35):halign(0)
end,
UpdateNetScoreCommand = function(self)
self:settext(multiscores[i].highscore:GetDate())
Expand Down

0 comments on commit e95c5d6

Please sign in to comment.