added flippable feature

This commit is contained in:
dscarpac 2024-09-13 23:43:24 -05:00
parent 0478225387
commit b741b83833
6 changed files with 36 additions and 19 deletions

View File

@ -59,6 +59,11 @@
"Type": 1,
"URL": "https://steamusercontent-a.akamaihd.net/ugc/2027213118467703445/89328E273B4C5180BF491516CE998DE3C604E162/"
},
{
"Name": "font_arkham-numbers",
"Type": 1,
"URL": "https://steamusercontent-a.akamaihd.net/ugc/2424714310444718103/C96BEC602A96F3D302A6442B2EB8129AA4F814A1/"
},
{
"Name": "header_cover",
"Type": 0,

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/949599153663402915/D881A5A0D8A370851B9A0055DD7834CDCE0F72BE/",
"WidthScale": 0
},
"Description": "Left- or right-click to change the value or type numbers while hovering.",

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/949599153663402915/D881A5A0D8A370851B9A0055DD7834CDCE0F72BE/",
"WidthScale": 0
},
"Description": "Left- or right-click to change the value or type numbers while hovering.",

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/949599153663402915/D881A5A0D8A370851B9A0055DD7834CDCE0F72BE/",
"WidthScale": 0
},
"Description": "Left- or right-click to change the value or type numbers while hovering.",

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/949599153663402915/D881A5A0D8A370851B9A0055DD7834CDCE0F72BE/",
"WidthScale": 0
},
"Description": "Left- or right-click to change the value or type numbers while hovering.",

View File

@ -22,17 +22,19 @@ function getXmlParameters()
local tokenType = self.getMemo()
if tokenType == "damage" then
return {
size = 550,
size = 600,
fontSize = 700,
offsetXY = "5 5",
color = "#fe1b17fc"
posX = "10",
posY = "5",
color = "#FA2A19FC"
}
elseif tokenType == "horror" then
return {
size = 550,
size = 600,
fontSize = 700,
offsetXY = "-30 -5",
color = "#273784fc"
posX = "-18",
posY = "-5",
color = "#302F6DFC"
}
else
printToAll("Invalid token type")
@ -53,20 +55,18 @@ function createXml()
onClick = "addOrSubtract",
scale = "0.35 0.35 1",
colors = uiColor,
position = "0 0 -6",
position = params.posX .. " " .. params.posY .. " -6",
rotation = "0 0 180",
height = params.size,
width = params.size,
offsetXY = params.offsetXY
width = params.size
},
children = {
{
tag = "Text",
attributes = {
id = "xmlTxt",
fontStyle = "Bold",
fontSize = params.fontSize,
font = "font_teutonic-arkham",
font = "font_arkham-numbers",
text = uiVal,
color = "#FFFFFF"
}
@ -77,12 +77,19 @@ function createXml()
self.UI.setXmlTable(xml)
end
-- rotate to face-up when dropped
function onDrop()
self.setRotation(self.getRotation():setAt("z", 0))
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")
else
self.UI.setAttribute("xmlBtn", "position", params.posX .. " " .. params.posY .. " -6")
self.UI.setAttribute("xmlBtn", "rotation", "0 0 180")
end
end
-- value == 1 and unlocked -> no label/background
-- value == 1 -> no label/background
function getUiColorAndVal()
if val == 1 then
return getColorBlock("#00000000"), ""
@ -97,6 +104,11 @@ end
function updateLabel()
local uiColor, uiVal = getUiColorAndVal()
if val > 9 then
self.UI.setAttribute("xmlTxt", "fontSize", "350")
else
self.UI.setAttribute("xmlTxt", "fontSize", "700")
end
self.UI.setAttribute("xmlBtn", "colors", uiColor)
self.UI.setAttribute("xmlTxt", "text", uiVal)
end