1
0
Fork 0

Improve UI

This commit is contained in:
Marvin Dalheimer 2023-04-28 22:27:04 +02:00
parent 54aa2db691
commit 32b6b4c819
Signed by: Rinma
GPG Key ID: 44CAD3A9F1679D8D
3 changed files with 284 additions and 14 deletions

View File

@ -1 +1,49 @@
print("Texas Holdem - Table Browser")
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()

View File

@ -2,7 +2,112 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<Frame name="Poker_TableBrowser" parent="UIParent" hidden="true" movable="true" enableMouse="true" clampedToScreen="true">
<Button name="Poker_TableBrowserHeader" virtual="true">
<Scripts>
<OnClick>
Poker_TableBrowser.SortTables(this:GetID())
PlaySound("igMainMenuOptionCheckBoxOn")
</OnClick>
<OnEnter>
getglobal(self:GetName().."BG"):SetVertexColor(1, 1, 1, 1)
</OnEnter>
<OnLeave>
getglobal(self:GetName().."BG"):SetVertexColor(0.7, 0.7, 0.7, 0.7)
</OnLeave>
<OnLoad>
self:GetScript("OnLeave")(self)
</OnLoad>
</Scripts>
<ButtonText>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="4" y="0"/>
</Offset>
</Anchor>
</Anchors>
</ButtonText>
<NormalFont style="GameFontHighlight"/>
<HighlightFont style="GameFontNormal"/>
<NormalTexture name="$parentBG">
<Color r="0.4" g="0.4" b="0.4" a="0.4"/>
</NormalTexture>
</Button>
<Button name="Poker_TableBrowserEntry" hidden="true" virtual="true">
<Size>
<AbsDimension x="328" y="24"/>
</Size>
<Layers>
<Layer>
<FontString name="$parentName" justifyH="LEFT"
inherits="GameFontNormalSmall">
<Size>
<AbsDimension x="138" y="24"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="4" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentHost" justifyH="LEFT"
inherits="GameFontNormalSmall">
<Size>
<AbsDimension x="80" y="24"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="$parentName"/>
</Anchors>
</FontString>
<FontString name="$parentPlayers" justifyH="LEFT"
inherits="GameFontNormalSmall">
<Size>
<AbsDimension x="50" y="24"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="$parentHost"/>
</Anchors>
</FontString>
<FontString name="$parentBlinds" justifyH="LEFT"
inherits="GameFontNormalSmall">
<Size>
<AbsDimension x="60" y="24"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT"
relativeTo="$parentPlayers"/>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
getglobal(self:GetName().."BG"):Hide()
</OnLoad>
<OnClick>
if not Poker_TableBrowser.IsSelected(self:GetID()) then
Poker_TableBrowser.SelectEntry(self:GetID())
end
</OnClick>
<OnDoubleClick>
Poker_TableBrowser.JoinSelectedTable()
</OnDoubleClick>
<OnEnter>
getglobal(self:GetName().."BG"):Show()
</OnEnter>
<OnLeave>
if not Poker_TableBrowser.IsSelected(self:GetID()) then
getglobal(self:GetName().."BG"):Hide()
end
</OnLeave>
</Scripts>
<NormalTexture name="$parentBG">
<Color r="0" g="0" b="0.5" a="0.25"/>
</NormalTexture>
</Button>
<Frame name="Poker_TableBrowser" parent="UIParent" hidden="false" movable="true" enableMouse="true" clampedToScreen="true">
<Scripts>
<OnLoad>
self:RegisterForDrag("LeftButton")
@ -113,26 +218,138 @@
</Layer>
</Layers>
<Frames>
<Button name="$parentTestButton" text="Test :)" inherits="UIPanelButtonTemplate">
<Button name="$parentClose" text="POKER_BROWSER_CLOSE"
inherits="UIPanelButtonTemplate">
<Size>
<AbsDimension x="96" y="32"/>
<AbsDimension x="64" y="24"/>
</Size>
<Anchors>
<Anchor point="CENTER"/>
<Anchor point="BOTTOM">
<Offset>
<AbsDimension x="0" y="15"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
self:RegisterForClicks(
"LeftButtonUp",
"RightButtonUp",
"MiddleButtonDown"
)
</OnLoad>
<OnClick>
print("Clicked with", button)
self:GetParent():Hide()
</OnClick>
</Scripts>
</Button>
<Frame name="$parentTableList">
<Size>
<AbsDimension x="354" y="225"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="-26"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BORDER">
<Texture parentKey="TopLeft" parentArray="Textures" file="Interface\Common\ThinBorder2-Corner">
<Size x="8" y="8"/>
<Anchors>
<Anchor point="TOPLEFT" x="-3" y="3"/>
</Anchors>
</Texture>
<Texture parentKey="TopRight" parentArray="Textures" file="Interface\Common\ThinBorder2-Corner">
<Size x="8" y="8"/>
<Anchors>
<Anchor point="TOPRIGHT" x="3" y="3"/>
</Anchors>
<TexCoords left="1" right="0" top="0" bottom="1"/>
</Texture>
<Texture parentKey="BottomLeft" parentArray="Textures" file="Interface\Common\ThinBorder2-Corner">
<Size x="8" y="8"/>
<Anchors>
<Anchor point="BOTTOMLEFT" x="-3" y="-3"/>
</Anchors>
<TexCoords left="0" right="1" top="1" bottom="0"/>
</Texture>
<Texture parentKey="BottomRight" parentArray="Textures" file="Interface\Common\ThinBorder2-Corner">
<Size x="8" y="8"/>
<Anchors>
<Anchor point="BOTTOMRIGHT" x="3" y="-3"/>
</Anchors>
<TexCoords left="1" right="0" top="1" bottom="0"/>
</Texture>
<Texture parentKey="Top" parentArray="Textures" file="Interface\Common\ThinBorder2-Top">
<Anchors>
<Anchor point="TOPLEFT" relativeKey="$parent.TopLeft" relativePoint="TOPRIGHT"/>
<Anchor point="BOTTOMRIGHT" relativeKey="$parent.TopRight" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Texture>
<Texture parentKey="Bottom" parentArray="Textures" file="Interface\Common\ThinBorder2-Top">
<Anchors>
<Anchor point="TOPLEFT" relativeKey="$parent.BottomLeft" relativePoint="TOPRIGHT"/>
<Anchor point="BOTTOMRIGHT" relativeKey="$parent.BottomRight" relativePoint="BOTTOMLEFT"/>
</Anchors>
<TexCoords left="0" right="1" top="1" bottom="0"/>
</Texture>
<Texture parentKey="Left" parentArray="Textures" file="Interface\Common\ThinBorder2-Left">
<Anchors>
<Anchor point="TOPLEFT" relativeKey="$parent.TopLeft" relativePoint="BOTTOMLEFT"/>
<Anchor point="BOTTOMRIGHT" relativeKey="$parent.BottomLeft" relativePoint="TOPRIGHT"/>
</Anchors>
</Texture>
<Texture parentKey="Right" parentArray="Textures" file="Interface\Common\ThinBorder2-Left">
<Anchors>
<Anchor point="TOPLEFT" relativeKey="$parent.TopRight" relativePoint="BOTTOMLEFT"/>
<Anchor point="BOTTOMRIGHT" relativeKey="$parent.BottomRight" relativePoint="TOPRIGHT"/>
</Anchors>
<TexCoords left="1" right="0" top="0" bottom="1"/>
</Texture>
</Layer>
</Layers>
<Frames>
<Button inherits="Poker_TableBrowserHeader" name="$parentHeaderName" id="1"
text="POKER_BROWSER_NAME">
<Size>
<AbsDimension x="138" y="24"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="4" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button inherits="Poker_TableBrowserHeader" name="$parentHeaderHost" id="2"
text="POKER_BROWSER_HOST">
<Size>
<AbsDimension x="90" y="24"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="$parentHeaderName"/>
</Anchors>
</Button>
<Button inherits="Poker_TableBrowserHeader" name="$parentHeaderPlayers" id="3"
text="POKER_BROWSER_PLAYERS">
<Size>
<AbsDimension x="50" y="24"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="$parentHeaderHost"/>
</Anchors>
</Button>
<Button inherits="Poker_TableBrowserHeader" name="$parentHeaderBlinds" id="5"
text="POKER_BROWSER_BLINDS">
<Size>
<AbsDimension x="50" y="24"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT"
relativeTo="$parentHeaderPlayers"/>
</Anchors>
</Button>
</Frames>
</Frame>
</Frames>
</Frame>
</Ui>

View File

@ -1 +1,6 @@
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"