Compare commits
3 Commits
32b6b4c819
...
0907591e8e
Author | SHA1 | Date |
---|---|---|
Marvin Dalheimer | 0907591e8e | |
Marvin Dalheimer | e874ee4ffe | |
Marvin Dalheimer | c1663e3d4a |
|
@ -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,
|
||||
|
@ -46,4 +100,4 @@ for i = 1, MAX_TABLES do
|
|||
})
|
||||
end
|
||||
|
||||
Poker_TableBrowser.Update()
|
||||
Poker_TableBrowser.Update()
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue