diff --git a/objects/DoomCounter.85c4c6.json b/objects/DoomCounter.85c4c6.json index 22922a95..e1b4d3bc 100644 --- a/objects/DoomCounter.85c4c6.json +++ b/objects/DoomCounter.85c4c6.json @@ -22,6 +22,13 @@ "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/949592555964782208/CC876694A6684B3C2680CE2FE3259F574AE0AD97/", "WidthScale": 0 }, + "CustomUIAssets": [ + { + "Name": "font_teutonic-arkham", + "Type": 1, + "URL": "https://steamusercontent-a.akamaihd.net/ugc/2027213118467703445/89328E273B4C5180BF491516CE998DE3C604E162/" + } + ], "Description": "", "DragSelectable": true, "GMNotes": "", diff --git a/src/core/DoomCounter.ttslua b/src/core/DoomCounter.ttslua index 3bc07839..decfd636 100644 --- a/src/core/DoomCounter.ttslua +++ b/src/core/DoomCounter.ttslua @@ -10,6 +10,7 @@ local options = { } val = 0 +self.max_typed_number = 99 -- save current value and options function onSave() return JSON.encode({ val, options }) end @@ -22,7 +23,7 @@ function onLoad(savedData) -- restore state for option panel for key, bool in pairs(options) do - self.UI.setAttribute("option" .. key, "isOn", not bool) + if bool == false then changeLabel(key) end end end @@ -65,6 +66,10 @@ function updateVal(number) end end +function onNumberTyped(_, number) + updateVal(number) +end + -- called by updateVal and addVal to broadcast total doom in play, including doom threshold function broadcastDoom(val) local doomInPlayCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomInPlayCounter") @@ -122,6 +127,7 @@ end -- XML UI functions function optionClick(_, optionName) options[optionName] = not options[optionName] + changeLabel(optionName) printToAll("Doom removal of " .. optionName .. (options[optionName] and " enabled" or " disabled")) end @@ -134,3 +140,12 @@ function toggleOptions() self.UI.hide("Options") end end + +function changeLabel(optionName) + local label = self.UI.getAttribute("option" .. optionName, "text") + if options[optionName] == true then + self.UI.setAttribute("option" .. optionName, "text", string.gsub(label, "☐", "☑")) + else + self.UI.setAttribute("option" .. optionName, "text", string.gsub(label, "☑", "☐")) + end +end diff --git a/xml/DoomCounter.xml b/xml/DoomCounter.xml index 75daef0a..c1f26153 100644 --- a/xml/DoomCounter.xml +++ b/xml/DoomCounter.xml @@ -1,25 +1,26 @@ - + + - + - + - + - - - Doom on Agenda - Doom in Playarea - Doom on Playermats + + + + +