Merge pull request #995 from argonui/flipped-tokens

Updated damage/horror XML to detect if object spawns flipped
This commit is contained in:
dscarpac 2024-11-18 08:03:06 -06:00 committed by GitHub
commit ac8d5ace69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,6 +44,13 @@ function createXml()
if not params then return end
local uiColor, uiFontSize, uiVal = getUiColorSizeAndVal()
local pos = params.posX .. " " .. params.posY .. " -6"
local rot = "0 0 180"
if self.is_face_down then
pos = params.posX .. " " .. params.posY .. " 6"
rot = "0 180 180"
end
local xml = {
{
tag = "Button",
@ -53,12 +60,12 @@ function createXml()
onClick = "addOrSubtract",
scale = "0.35 0.35 1",
colors = uiColor,
position = params.posX .. " " .. params.posY .. " -6",
rotation = "0 0 180",
position = pos,
rotation = rot,
height = params.size,
width = params.size
},
children = {
children = {
{
tag = "Text",
attributes = {
@ -77,7 +84,7 @@ end
function onRotate(_, flip, _, _, oldFlip)
if flip == oldFlip then return end
if flip == 180 then
self.UI.setAttribute("xmlBtn", "position", params.posX .. " " .. params.posY .. " 6")
self.UI.setAttribute("xmlBtn", "rotation", "0 180 180")
@ -99,7 +106,7 @@ function getUiColorSizeAndVal()
end
function getColorBlock(hexColor)
return table.concat({hexColor, hexColor, hexColor}, "|")
return table.concat({ hexColor, hexColor, hexColor }, "|")
end
function updateLabel()