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