Skip to content

Commit

Permalink
rework country filter in score/scoreboard lua
Browse files Browse the repository at this point in the history
make global dropdown respond to collapse
  • Loading branch information
MinaciousGrace committed Oct 8, 2018
1 parent 054f387 commit c03f8e5
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local scoreIndex = 1
local score
local pn = GAMESTATE:GetEnabledPlayers()[1]
local nestedTab = 1
local nestedTabs = {"Local", "Global", "Country"}
local nestedTabs = {"Local", "Online"}

local frameX = 10
local frameY = 45
Expand All @@ -23,8 +23,6 @@ local nestedTabButtonHeight = 20
local netPageButtonWidth = 50
local netPageButtonHeight = 50
local headeroffY = 26 / 1.5
local isGlobalRanking = true;


local selectedrateonly

Expand All @@ -39,8 +37,6 @@ local judges = {
"HoldNoteScore_LetGo"
}



local defaultRateText = ""
if themeConfig:get_data().global.RateSort then
defaultRateText = "1.0x"
Expand Down Expand Up @@ -656,11 +652,6 @@ function nestedTabButton(i)
if isOver(self) then
nestedTab = i
MESSAGEMAN:Broadcast("NestedTabChanged")
if nestedTab == 3 then
isGlobalRanking = false
elseif nestedTab == 2 then
isGlobalRanking = true
end
MESSAGEMAN:Broadcast("ChartLeaderboardUpdate")
if nestedTab == 1 then
self:GetParent():GetParent():GetChild("ScoreDisplay"):visible(false)
Expand All @@ -677,8 +668,7 @@ function nestedTabButton(i)
end

-- online score display
-- ret[#ret + 1] = LoadActor("../superscoreboard")
ret[#ret + 1] = LoadActorWithParams("../superscoreboard",{getIsGlobalRanking=function() return isGlobalRanking end})
ret[#ret + 1] = LoadActor("../superscoreboard")

for i = 1, #nestedTabs do
ret[#ret + 1] = nestedTabButton(i)
Expand Down
88 changes: 81 additions & 7 deletions Themes/Til Death/BGAnimations/superscoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ local moving
local cheese
local collapsed = false

local getIsGlobalRanking = Var "getIsGlobalRanking"
local isGlobalRanking = true

-- will eat any mousewheel inputs to scroll pages while mouse is over the background frame
local function input(event)
Expand Down Expand Up @@ -107,11 +107,7 @@ local o =
self:queuecommand("ChartLeaderboardUpdate")
end,
ChartLeaderboardUpdateMessageCommand = function(self)
scoretable =
DLMAN:RequestChartLeaderBoard(
GAMESTATE:GetCurrentSteps(PLAYER_1):GetChartKey(),
getIsGlobalRanking() and "" or DLMAN:GetUserCountryCode()
)
scoretable = DLMAN:RequestChartLeaderBoard(GAMESTATE:GetCurrentSteps(PLAYER_1):GetChartKey(),isGlobalRanking)
ind = 0
self:playcommand("Update")
end,
Expand Down Expand Up @@ -280,7 +276,7 @@ local o =
if collapsed then
self:xy(c5x - 175, headeroff):zoom(tzoom):halign(1)
else
self:xy(c5x - 100, headeroff):zoom(tzoom):halign(1)
self:xy(c5x - 115, headeroff):zoom(tzoom):halign(1)
end
end,
HighlightCommand = function(self)
Expand Down Expand Up @@ -480,4 +476,82 @@ for i = 1, numscores do
o[#o + 1] = makeScoreDisplay(i)
end

o[#o + 1] = Widg.ComboBox
{
choices = {"Global", "US","CA", "BR"},
commands = {
CollapseCommand = function(self)
self:xy(c5x -20, headeroff-20):halign(0)
end,
ExpandCommand = function(self)
self:xy(c5x - 89, headeroff)
end,
CurrentSongChangedMessageCommand = function(self)
--choices = {"Global", "CA", "US", "BR"} -- this should be set based on what countries are available on a songs' leaderboards
--ms.ok(showKeys(self:GetChild("Global").params))
local doot = self:GetChild("container"):GetChildren()
--doot["CA"].params.onClick2 = function(self) ms.ok(self:GetName()) end
for k,v in pairs(doot) do
if k == "Global" then
doot[k].params.onClick2 = function()
isGlobalRanking = true
ind = 0
self:GetParent():queuecommand("ChartLeaderboardUpdate")
end
else
doot[k].params.onClick2 = function()
isGlobalRanking = false
DLMAN:SetCountryCode(k)
ind = 0
self:GetParent():queuecommand("ChartLeaderboardUpdate")
end
end
end
end
},
selectionColor = color("#aaaaaabb"),
defaultColor = color("#000000ff"),
headerParams = {
height = tzoom*32,
font = {
scale = tzoom,
color = Color.White,
padding = {
x = 10,
y = 10
}
},
onHighlight = function(self)
highlightIfOver(self:GetParent():GetChild("Label"))
end,
alpha = 0,
border = {
color = color("#00000000"),
}
},
selectionParams = {
height = tzoom*32,
width = 64,
font = {
scale = tzoom,
name = "Common Large",
color = Color.White,
padding = {
x = 10,
y = 10
}
},
border = {
color = color("#ffffffFF"),
width = 1
},
highlight = {
color = color("#330044FF"),
alpha = false
}
},
x = c5x - 89, -- needs to be thought out for design purposes
y = headeroff
}

return o

0 comments on commit c03f8e5

Please sign in to comment.