cleaner labels
This commit is contained in:
parent
b2bd2fe8fc
commit
ea2d57eccb
@ -1 +1 @@
|
||||
{"includeDrawnTokens":true,"percentage":false,"tokenPrecedence":{"":[0,11],"Auto-fail":[-100,7],"Bless":[101,8],"Cultist":[-2,4],"Curse":[-101,9],"Elder Sign":[100,2],"Elder Thing":[-4,6],"Frost":[-99,10],"Skull":[-1,3],"Tablet":[-3,5]}}
|
||||
{"includeDrawnTokens":true,"percentage":false,"tokenPrecedence":{"":[0,11],"Auto-fail":[-100,7],"Bless":[110,8],"Cultist":[-2,4],"Curse":[-110,9],"Elder Sign":[100,2],"Elder Thing":[-4,6],"Frost":[-105,10],"Skull":[-1,3],"Tablet":[-3,5]}}
|
||||
|
@ -12,16 +12,18 @@ buttonParameters.height = 325
|
||||
|
||||
local inputParameters = {}
|
||||
inputParameters.function_owner = self
|
||||
inputParameters.font_size = 100
|
||||
inputParameters.width = 250
|
||||
inputParameters.height = inputParameters.font_size + 23
|
||||
inputParameters.font_size = 200
|
||||
inputParameters.width = 500
|
||||
inputParameters.height = inputParameters.font_size + 46
|
||||
inputParameters.alignment = 3
|
||||
inputParameters.validation = 2
|
||||
inputParameters.tab = 2
|
||||
inputParameters.scale = { 0.5, 0.5, 0.5 }
|
||||
|
||||
local percentageLabel = {}
|
||||
percentageLabel.function_owner = self
|
||||
percentageLabel.click_function = "none"
|
||||
percentageLabel.font_size = 200
|
||||
percentageLabel.width = 0
|
||||
percentageLabel.height = 0
|
||||
|
||||
@ -153,9 +155,9 @@ function loadDefaultValues()
|
||||
["Tablet"] = { -3, 5},
|
||||
["Elder Thing"] = { -4, 6},
|
||||
["Auto-fail"] = { -100, 7},
|
||||
["Bless"] = { 101, 8},
|
||||
["Curse"] = { -101, 9},
|
||||
["Frost"] = { -99, 10},
|
||||
["Bless"] = { 110, 8},
|
||||
["Curse"] = { -110, 9},
|
||||
["Frost"] = { -105, 10},
|
||||
[""] = { 0, 11}
|
||||
}
|
||||
end
|
||||
@ -195,9 +197,11 @@ function createButtonsAndInputs()
|
||||
click_function = "layout",
|
||||
tooltip = "Left-Click: Update!\nRight-Click: Hide Tokens!",
|
||||
position = { 0.725, 0.1, 2.025 },
|
||||
scale = { 0.5, 0.5, 0.5 },
|
||||
color = { 1, 1, 1 },
|
||||
width = 675,
|
||||
height = 175
|
||||
font_size = 200,
|
||||
width = 1350,
|
||||
height = 325
|
||||
})
|
||||
end
|
||||
|
||||
@ -238,14 +242,14 @@ function deleteCopiedTokens()
|
||||
end
|
||||
|
||||
-- creates buttons as labels as display for percentage values
|
||||
function createPercentageButton(tokenCount, valueCount, tokenName)
|
||||
local startPos = Vector(2.3, -0.04, 0.875 * valueCount)
|
||||
function createPercentageButton(tokenCount, rowCount, tokenName)
|
||||
local startPos = Vector(2.3, -0.04, 0.875 * rowCount)
|
||||
|
||||
if percentage == "cumulative" then
|
||||
percentageLabel.scale = { 1.5, 1.5, 1.5 }
|
||||
percentageLabel.scale = { 0.75, 0.75, 0.75 }
|
||||
percentageLabel.position = startPos - Vector(0, 0, 2.85)
|
||||
else
|
||||
percentageLabel.scale = { 2, 2, 2 }
|
||||
percentageLabel.scale = { 1, 1, 1 }
|
||||
percentageLabel.position = startPos - Vector(0, 0, 2.675)
|
||||
end
|
||||
|
||||
@ -254,8 +258,8 @@ function createPercentageButton(tokenCount, valueCount, tokenName)
|
||||
percentageLabel.font_color = { 0.35, 0.71, 0.85 }
|
||||
elseif tokenName == "Auto-fail" then
|
||||
percentageLabel.font_color = { 0.86, 0.1, 0.1 }
|
||||
-- check if the tokenName contains letters (e.g. symbol token)
|
||||
elseif string.match(tokenName, "%a") ~= nil then
|
||||
-- tokenName contains letters (e.g. symbol token)
|
||||
percentageLabel.font_color = { 0.68, 0.53, 0.86 }
|
||||
else
|
||||
percentageLabel.font_color = { 0.85, 0.67, 0.33 }
|
||||
@ -355,21 +359,21 @@ function layout(_, _, isRightClick)
|
||||
local rotation = self.getRotation()
|
||||
local currentValue = data[1].value
|
||||
local tokenCount = { row = 0, sum = 0, total = #data }
|
||||
local valueCount = 1
|
||||
local tokenName = false
|
||||
local rowCount = 1
|
||||
local tokenName
|
||||
|
||||
for _, item in ipairs(data) do
|
||||
-- this is true for the first token in a new row
|
||||
if item.value ~= currentValue then
|
||||
if percentage then
|
||||
tokenCount.sum = tokenCount.sum + tokenCount.row
|
||||
createPercentageButton(tokenCount, valueCount, tokenName)
|
||||
createPercentageButton(tokenCount, rowCount, tokenName)
|
||||
end
|
||||
|
||||
location.x = location.x - 1.75
|
||||
location.z = pos.z
|
||||
currentValue = item.value
|
||||
valueCount = valueCount + 1
|
||||
rowCount = rowCount + 1
|
||||
tokenCount.row = 0
|
||||
end
|
||||
|
||||
@ -386,7 +390,7 @@ function layout(_, _, isRightClick)
|
||||
-- this is repeated to create the button for the last token
|
||||
if percentage then
|
||||
tokenCount.sum = tokenCount.sum + tokenCount.row
|
||||
createPercentageButton(tokenCount, valueCount, tokenName)
|
||||
createPercentageButton(tokenCount, rowCount, tokenName)
|
||||
end
|
||||
|
||||
-- small delay to limit update calls
|
||||
|
Loading…
x
Reference in New Issue
Block a user