1
0
Fork 0

Compare commits

...

3 Commits

2 changed files with 57 additions and 3 deletions

View File

@ -35,6 +35,60 @@ function Poker_TableBrowser.Update()
end
end
do
local currSort = 1
local currOrder = "asc"
function Poker_TableBrowser.SortTables(id)
if currSort == id then
if currOrder == "desc" then
currOrder = "asc"
else
currOrder = "desc"
end
elseif id then
currSort = id
currOrder = "asc"
end
table.sort(Poker_TableBrowser.Tables, function (v1, v2)
if currOrder == "desc" then
return v1[currSort] > v2[currSort]
else
return v1[currSort] < v2[currSort]
end
end)
Poker_TableBrowser.Update()
end
end
do
local selection = nil
function Poker_TableBrowser.SelectEntry(id)
if selection then
for i = 1, MAX_TABLES do
getglobal("Poker_TableBrowserTableListEntry"..i.."BG"):Hide()
end
selection.isSelected = nil
end
selection = Poker_TableBrowser.Tables[id]
selection.isSelected = true
end
function Poker_TableBrowser.IsSelected(id)
return Poker_TableBrowser.Tables[id] == selection
end
function Poker_TableBrowser.JoinSelectedTable()
if not selection then
return
end
print(string.format("Joining %s's table %s", selection[2], selection[1]))
end
end
for i = 1, MAX_TABLES do
table.insert(Poker_TableBrowser.Tables, {
"Test Table "..i,

View File

@ -5,8 +5,8 @@
<Button name="Poker_TableBrowserHeader" virtual="true">
<Scripts>
<OnClick>
Poker_TableBrowser.SortTables(this:GetID())
PlaySound("igMainMenuOptionCheckBoxOn")
Poker_TableBrowser.SortTables(self:GetID())
PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON)
</OnClick>
<OnEnter>
getglobal(self:GetName().."BG"):SetVertexColor(1, 1, 1, 1)