added global xml for bless curse manager

This commit is contained in:
Chr1Z93 2024-09-27 15:47:44 +02:00
parent 0ce5add82f
commit 8f51447e59
5 changed files with 110 additions and 3 deletions

View File

@ -104,6 +104,16 @@
"Type": 0,
"URL": "https://steamusercontent-a.akamaihd.net/ugc/2450610458480705628/FE3FD9F32E8704BEB7DD6327225D9D8244115A48/"
},
{
"Name": "arrow-down",
"Type": 0,
"URL": "https://steamusercontent-a.akamaihd.net/ugc/2448359292156394304/63B2D48BB94DD4CD4F897D8528E049D521298B02/"
},
{
"Name": "caret",
"Type": 0,
"URL": "https://steamusercontent-a.akamaihd.net/ugc/2448359292156394421/CFAF0262FEDE662D399A5D786E7450B49B952C99/"
},
{
"Name": "Exit",
"Type": 0,

View File

@ -89,12 +89,23 @@ function initializeState()
end
end
updateButtonLabels()
-- delay this update to make sure the XML is ready
Wait.time(updateButtonLabels, 2)
end
-- updates the Lua and XML labels with the current bless / curse count
function updateButtonLabels()
self.editButton({ index = 2, label = formatTokenCount("Bless", true) })
self.editButton({ index = 3, label = formatTokenCount("Curse", true) })
-- get formatted labels
local blessLabel = formatTokenCount("Bless", true)
local curseLabel = formatTokenCount("Curse", true)
-- edit Lua buttons on the helper
self.editButton({ index = 2, label = blessLabel })
self.editButton({ index = 3, label = curseLabel })
-- edit global XML buttons
Global.UI.setAttribute("countBless", "text", blessLabel)
Global.UI.setAttribute("countCurse", "text", curseLabel)
end
function broadcastCount(token)
@ -186,6 +197,13 @@ end
-- click functions
---------------------------------------------------------
function xmlClick(player, clickType, id)
playerColor = player.color
local isRightClick = (clickType == "-2")
local tokenType = string.sub(id, 6)
callFunctions(tokenType, isRightClick)
end
function clickBless(_, color, isRightClick)
playerColor = color
callFunctions("Bless", isRightClick)

View File

@ -1172,6 +1172,13 @@ function onClick_spawnPlaceholder(player)
changeWindowVisibilityForColor(player.color, "downloadWindow", false)
end
-- toggles the visbility of the bless / curse manager UI
function showHideBlurse(player)
local visibility = changeWindowVisibilityForColor(player.color, "blessCurseManager")
changeWindowVisibilityForColor(player.color, "hideBlurse", visibility)
changeWindowVisibilityForColor(player.color, "showBlurse", not visibility)
end
-- toggles the visibility of the respective UI
---@param player tts__Player Player that triggered this
---@param windowId string Name of the UI to toggle

View File

@ -0,0 +1,71 @@
<Defaults>
<Text font="font_teutonic-arkham"
alignment="MiddleCenter"
rectAlignment="MiddleCenter"/>
<Panel class="showHide"
color="black"
height="30"
width="30"
rectAlignment="MiddleRight"
offsetXY="0 72"
outlineSize="2 2"
outline="#303030"/>
</Defaults>
<!-- hide button for the Bless / Curse Manager -->
<Panel class="showHide"
active="false"
id="hideBlurse">
<Button onClick="showHideBlurse"
color="White"
image="caret"/>
</Panel>
<!-- show button for the Bless / Curse Manager -->
<Panel class="showHide"
active="true"
id="showBlurse">
<Button onClick="showHideBlurse"
color="White"
image="arrow-down"/>
</Panel>
<!-- window to control bless / curse tokens in chaos bag -->
<!-- height = row heights + 2x outline + spacing -->
<TableLayout id="blessCurseManager"
color="black"
active="false"
height="110"
width="150"
rectAlignment="MiddleRight"
raycastTarget="true"
cellSpacing="5"
outlineSize="2 2"
outline="#303030">
<!-- token counts -->
<Row preferredHeight="31">
<Cell>
<Text id="countBless"
fontSize="25"
text="0 + 0"/>
</Cell>
<Cell>
<Text id="countCurse"
fontSize="25"
text="0 + 0"/>
</Cell>
</Row>
<!-- token buttons -->
<Row preferredHeight="70">
<Cell>
<Button image="token-bless"
id="imageBless"
onClick="5933fb/xmlClick"/>
</Cell>
<Cell>
<Button image="token-curse"
id="imageCurse"
onClick="5933fb/xmlClick"/>
</Cell>
</Row>
</TableLayout>

View File

@ -11,3 +11,4 @@
<Include src="Global/NavigationOverlay.xml"/>
<Include src="Global/OptionPanel.xml"/>
<Include src="Global/UpdateNotification.xml"/>
<Include src="Global/BlessCurseManager.xml"/>