Merge pull request #869 from dscarpac/flipped-tokens

Added new font and flippable capability to damage / horror tokens
This commit is contained in:
Chr1Z 2024-09-18 17:54:24 +02:00 committed by GitHub
commit c20d747921
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 67 additions and 48 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

@ -48,7 +48,7 @@
"posZ": 29.089,
"rotX": 0,
"rotY": 10,
"rotZ": 1,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3

View File

@ -48,7 +48,7 @@
"posZ": -29.078,
"rotX": 0,
"rotY": 190,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3

View File

@ -48,7 +48,7 @@
"posZ": -22.894,
"rotX": 0,
"rotY": 280,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3

View File

@ -48,7 +48,7 @@
"posZ": 9.273,
"rotX": 0,
"rotY": 280,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3

View File

@ -28,7 +28,7 @@
"SpecularIntensity": 0.05,
"SpecularSharpness": 3.000001
},
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357113311/C9A5F7E450A6845D0D09D7407AA38E9319697D74/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2424714310447304520/C242946D58154EB5F81733A922408623660BE86A/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1615094763857974350/E16168497E847B690A16F1C0914E4F5C872555B6/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"WidthScale": 0
},
"CustomUIAssets": [

View File

@ -28,7 +28,7 @@
"SpecularIntensity": 0.05,
"SpecularSharpness": 3.000001
},
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357113311/C9A5F7E450A6845D0D09D7407AA38E9319697D74/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2424714310447304520/C242946D58154EB5F81733A922408623660BE86A/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1615094763857974350/E16168497E847B690A16F1C0914E4F5C872555B6/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"WidthScale": 0
},
"CustomUIAssets": [

View File

@ -28,7 +28,7 @@
"SpecularIntensity": 0.05,
"SpecularSharpness": 3.000001
},
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357113311/C9A5F7E450A6845D0D09D7407AA38E9319697D74/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2424714310447304520/C242946D58154EB5F81733A922408623660BE86A/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1615094763857974350/E16168497E847B690A16F1C0914E4F5C872555B6/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"WidthScale": 0
},
"CustomUIAssets": [

View File

@ -48,7 +48,7 @@
"posZ": -24.928,
"rotX": 0,
"rotY": 280,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3

View File

@ -48,7 +48,7 @@
"posZ": 7.229,
"rotX": 0,
"rotY": 280,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3

View File

@ -48,7 +48,7 @@
"posZ": 29.487,
"rotX": 0,
"rotY": 10,
"rotZ": 1,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3

View File

@ -48,7 +48,7 @@
"posZ": -29.42,
"rotX": 0,
"rotY": 190,
"rotZ": 0,
"rotZ": 180,
"scaleX": 0.3,
"scaleY": 1,
"scaleZ": 0.3

View File

@ -18,7 +18,7 @@
"CastShadows": true,
"ColliderURL": "",
"Convex": true,
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357109766/6D35F3D98A4C89696895FACA788F54005B1688D3/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2505779553882482465/D5E50127E1B511C7944940D62586973A66F87046/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396423416/9CC783AD03275AAB3443A1DACA7A58A892AAB632/",
"WidthScale": 0
},
"CustomUIAssets": [

View File

@ -18,7 +18,7 @@
"CastShadows": true,
"ColliderURL": "",
"Convex": true,
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357109766/6D35F3D98A4C89696895FACA788F54005B1688D3/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2505779553882482465/D5E50127E1B511C7944940D62586973A66F87046/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396423416/9CC783AD03275AAB3443A1DACA7A58A892AAB632/",
"WidthScale": 0
},
"CustomUIAssets": [

View File

@ -18,7 +18,7 @@
"CastShadows": true,
"ColliderURL": "",
"Convex": true,
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357109766/6D35F3D98A4C89696895FACA788F54005B1688D3/",
"DiffuseURL": "https://steamusercontent-a.akamaihd.net/ugc/2505779553882482465/D5E50127E1B511C7944940D62586973A66F87046/",
"MaterialIndex": 1,
"MeshURL": "https://pastebin.com/raw/ALrYhQGb",
"NormalURL": "",

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396423416/9CC783AD03275AAB3443A1DACA7A58A892AAB632/",
"WidthScale": 0
},
"CustomUIAssets": [

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1615094763857974350/E16168497E847B690A16F1C0914E4F5C872555B6/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/",
"WidthScale": 0
},
"CustomUIAssets": [

View File

@ -19,7 +19,7 @@
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/",
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396423416/9CC783AD03275AAB3443A1DACA7A58A892AAB632/",
"WidthScale": 0
},
"CustomUIAssets": [

View File

@ -22,17 +22,17 @@ function getXmlParameters()
local tokenType = self.getMemo()
if tokenType == "damage" then
return {
size = 550,
fontSize = 700,
offsetXY = "-5 5",
color = "#fe1b17fc"
size = 600,
posX = "10",
posY = "5",
color = "#FA2A19FC"
}
elseif tokenType == "horror" then
return {
size = 550,
fontSize = 700,
offsetXY = "30 -5",
color = "#273784fc"
size = 600,
posX = "-18",
posY = "-5",
color = "#302F6DFC"
}
else
printToAll("Invalid token type")
@ -43,7 +43,7 @@ function createXml()
params = getXmlParameters()
if not params then return end
local uiColor, uiVal = getUiColorAndVal()
local uiColor, uiFontSize, uiVal = getUiColorSizeAndVal()
local xml = {
{
tag = "Button",
@ -53,20 +53,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",
fontSize = uiFontSize,
font = "font_arkham-numbers",
text = uiVal,
color = "#FFFFFF"
}
@ -77,17 +75,26 @@ 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
function getUiColorAndVal()
-- value == 1 -> no label/background
function getUiColorSizeAndVal()
if val == 1 then
return getColorBlock("#00000000"), ""
return getColorBlock("#00000000"), "700", ""
elseif val < 10 then
return getColorBlock(params.color), "700", val
else
return getColorBlock(params.color), val
return getColorBlock(params.color), "350", val
end
end
@ -96,8 +103,10 @@ function getColorBlock(hexColor)
end
function updateLabel()
local uiColor, uiVal = getUiColorAndVal()
local uiColor, uiFontSize, uiVal = getUiColorSizeAndVal()
self.UI.setAttribute("xmlBtn", "colors", uiColor)
self.UI.setAttribute("xmlTxt", "fontSize", uiFontSize)
self.UI.setAttribute("xmlTxt", "text", uiVal)
end

View File

@ -14,10 +14,14 @@ function onLoad(savedData)
local position = { 0, 0.06, 0 }
-- set position of label depending on object
if tokenType == "damage" or tokenType == "resource" or tokenType == "resourceCounter" then
position = { 0, 0.06, 0.1 }
if tokenType == "damage" then
position = { 0.1, -0.07, 0.1 }
rotation = { 180, 180, 0}
elseif tokenType == "horror" then
position = { -0.025, 0.06, -0.025 }
position = { -0.025, -0.07, 0.025 }
rotation = { 180, 180, 0}
elseif tokenType == "resource" or tokenType == "resourceCounter" then
position = { 0, 0.06, 0.1 }
elseif tokenType == "ElderSignCounter" or tokenType == "AutofailCounter" then
position = { 0, 0.1, 0 }
end
@ -27,6 +31,7 @@ function onLoad(savedData)
click_function = "addOrSubtract",
function_owner = self,
position = position,
rotation = rotation or { 0, 0, 0 },
height = 600,
width = 1000,
scale = { 1.5, 1.5, 1.5 },