Skip to content

Commit

Permalink
Display SSR ranking
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram authored Dec 27, 2016
1 parent 5b2858a commit f0468f5
Showing 1 changed file with 124 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ local fontScale = 0.4
local distY = 15
local offsetX = 10
local offsetY = 20
local rankingSkillset=0
local rankingPage=1
local rankingWidth = 250
local rankingX = 90
local rankingY = 160
local rankingTitleWidth = (rankingWidth/(#ms.SkillSets + 1))

local skillsets = {
Overall = 0,
Expand All @@ -54,11 +60,126 @@ t[#t+1] = Def.Quad{InitCommand=cmd(xy,frameX,frameY;zoomto,frameWidth,offsetY;ha
t[#t+1] = LoadFont("Common Normal")..{InitCommand=cmd(xy,frameX+5,frameY+offsetY-9;zoom,0.6;halign,0;diffuse,getMainColor('positive');settext,"Profile Info (WIP)")}


local function input(event)
if event.type ~= "InputEventType_Release" and active then
if event.DeviceInput.button == "DeviceButton_left mouse button" then
MESSAGEMAN:Broadcast("MouseLeftClick")
end
end
return false
end


local r = Def.ActorFrame{
OnCommand=function(self) SCREENMAN:GetTopScreen():AddInputCallback(input) end,
}

local function rankingLabel(i)
local t = Def.ActorFrame{
LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+rankingX,frameY+rankingY+110-(11-i)*10;halign,0;zoom,0.25;diffuse,getMainColor('positive');maxwidth,160),
SetCommand=function(self)
local a=profile:GetTopSSRValue(i+(10*(rankingPage-1)), rankingSkillset)
if a==0 then
self:settext( ' - ' )
else
self:settextf("%5.2f", a)
end
end,
UpdateRankingMessageCommand=cmd(queuecommand,"Set"),
},
LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+rankingX+40,frameY+rankingY+110-(11-i)*10;halign,0;zoom,0.25;diffuse,getMainColor('positive');maxwidth,rankingWidth*4-160),
SetCommand=function(self)
local a=profile:GetTopSSRValue(i+(10*(rankingPage-1)), rankingSkillset)
if a==0 then
self:settext( ' ' )
else
self:settext(profile:GetTopSSRSongName(i+(10*(rankingPage-1)), rankingSkillset) )
end
end,
UpdateRankingMessageCommand=cmd(queuecommand,"Set"),
},
}
return t
end
local function rankingButton(i)
local t = Def.ActorFrame{
Def.Quad{
InitCommand=cmd(xy,frameX+rankingX+(i-1+i*(1/(1+#ms.SkillSets)))*rankingTitleWidth,frameY+rankingY-30;zoomto,rankingTitleWidth,30;halign,0;valign,0;diffuse,getMainColor('frames');diffusealpha,0.35),
MouseLeftClickMessageCommand=function(self)
if isOver(self) then
rankingSkillset = i-1
MESSAGEMAN:Broadcast("UpdateRanking")
end;
end;
},
LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+rankingX+(i-1+i*(1/(1+#ms.SkillSets)))*rankingTitleWidth,frameY+rankingY-15;halign,0;diffuse,getMainColor('positive');maxwidth,rankingTitleWidth;maxheight,25),
BeginCommand=function(self)
self:settext(ms.SkillSets[i])
end,
}
}
return t
end


r[#r+1] = Def.Quad{
InitCommand=cmd(xy,frameX+rankingX+rankingWidth,frameY+rankingY+40;zoomto,40,20;halign,0;valign,0;diffuse,getMainColor('frames');diffusealpha,0.35),
MouseLeftClickMessageCommand=function(self)
if isOver(self) then
--Move right
if RankingPage == 10 then
rankingPage=1
else
rankingPage=rankingPage+1
end
MESSAGEMAN:Broadcast("UpdateRanking")
end;
end;
}
r[#r+1] = LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+rankingX+rankingWidth,frameY+rankingY+50;halign,0;zoom,0.3;diffuse,getMainColor('positive')),
BeginCommand=function(self)
self:settext( 'Next' )
end,
}

r[#r+1] = Def.Quad{
InitCommand=cmd(xy,frameX+rankingX-75,frameY+rankingY+40;zoomto,65,20;halign,0;valign,0;diffuse,getMainColor('frames');diffusealpha,0.35),
MouseLeftClickMessageCommand=function(self)
if isOver(self) then
--Move left
if RankingPage == 1 then
rankingPage=10
else
rankingPage=rankingPage-1
end
MESSAGEMAN:Broadcast("UpdateRanking")
end;
end;
}
r[#r+1] = LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+rankingX-75,frameY+rankingY+50;halign,0;zoom,0.3;diffuse,getMainColor('positive')),
BeginCommand=function(self)
self:settext( 'Previous' )
end,
}
for i=1,10 do
r[#r+1] = rankingLabel(i)
end
for i=1,#ms.SkillSets do
r[#r+1] = rankingButton(i)
end

t[#t+1] = r

-- should make a highlight or something to indicate the greatest value at a quick glance
local function littlebits(i)
local t = Def.ActorFrame{
LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+15,frameY+160 + 22*i;halign,0;zoom,0.5;diffuse,getMainColor('positive')),
InitCommand=cmd(xy,frameX+(frameWidth/2)-100,frameY+20 + 22*i;halign,0;zoom,0.5;diffuse,getMainColor('positive')),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
self:settext(ms.SkillSets[i]..":")
Expand All @@ -67,7 +188,7 @@ local function littlebits(i)
PlayerUnjoinedMessageCommand=cmd(queuecommand,"Set"),
},
LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+205,frameY+160 + 22*i;halign,1;zoom,0.5),
InitCommand=cmd(xy,frameX+(frameWidth/2)+90,frameY+20 + 22*i;halign,1;zoom,0.5),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
self:settextf("%5.2f",skillsets[ms.SkillSets[i]])
Expand All @@ -85,4 +206,4 @@ for i=1,#ms.SkillSets do
end


return t
return t

0 comments on commit f0468f5

Please sign in to comment.