diff --git a/TableBrowser.lua b/TableBrowser.lua index 65eb578..5f8c1e4 100755 --- a/TableBrowser.lua +++ b/TableBrowser.lua @@ -1 +1,49 @@ -print("Texas Holdem - Table Browser") \ No newline at end of file +local MAX_TABLES = 8 + +do + local entry = CreateFrame("Button", "$parentEntry1", Poker_TableBrowserTableList, "Poker_TableBrowserEntry") + entry:SetID(1) + entry:SetPoint("TOPLEFT", 4, -28) + for i = 2, MAX_TABLES do + local entry = CreateFrame("Button", "$parentEntry"..i, Poker_TableBrowserTableList, "Poker_TableBrowserEntry") + entry:SetID(i) + entry:SetPoint("TOP", "$parentEntry"..(i-1), "BOTTOM") + end +end + +Poker_TableBrowser = {} +Poker_TableBrowser.Tables = {} + +function Poker_TableBrowser.Update() + for i = 1, MAX_TABLES do + local entry = Poker_TableBrowser.Tables[i] + local frame = getglobal("Poker_TableBrowserTableListEntry"..i) + if entry then + frame:Show() + getglobal(frame:GetName().."Name"):SetText(entry[1]) + getglobal(frame:GetName().."Host"):SetText(entry[2]) + getglobal(frame:GetName().."Players"):SetText(entry[3].."/"..entry[4]) + getglobal(frame:GetName().."Blinds"):SetText(entry[5].."-"..entry[6]) + if entry.isSelected then + getglobal(frame:GetName().."BG"):Show() + else + getglobal(frame:GetName().."BG"):Hide() + end + else + frame:Hide() + end + end +end + +for i = 1, MAX_TABLES do + table.insert(Poker_TableBrowser.Tables, { + "Test Table "..i, + "Host "..(MAX_TABLES - i), + i % 3 + 1, -- just dummy values + 10, + i * 10, + i * 20 + }) + end + + Poker_TableBrowser.Update() \ No newline at end of file diff --git a/TableBrowser.xml b/TableBrowser.xml index ef40582..b563a2a 100755 --- a/TableBrowser.xml +++ b/TableBrowser.xml @@ -2,7 +2,112 @@ - + + + self:RegisterForDrag("LeftButton") @@ -113,26 +218,138 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/localization.en.lua b/localization.en.lua index cb7dd4e..92b0322 100755 --- a/localization.en.lua +++ b/localization.en.lua @@ -1 +1,6 @@ -POKER_BROWSER_TITLE = "Texas Holdem Table Browser" \ No newline at end of file +POKER_BROWSER_TITLE = "Texas Holdem Table Browser" +POKER_BROWSER_CLOSE = "Close" +POKER_BROWSER_NAME = "Table Name" +POKER_BROWSER_HOST = "Host" +POKER_BROWSER_PLAYERS = "Players" +POKER_BROWSER_BLINDS = "Blinds" \ No newline at end of file