added changes

This commit is contained in:
dscarpac 2024-08-31 18:15:36 -05:00
parent 52551373c7
commit e08b0cfed4
3 changed files with 33 additions and 10 deletions

View File

@ -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": "",

View File

@ -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

View File

@ -1,25 +1,26 @@
<Defaults>
<Panel rotation="0 0 180"></Panel>
<ToggleButton class="optionButton" font="font_teutonic-arkham" color="#88e3cf" colors="#88e3cf|#4f8478|#303836" fontSize="65" isOn="0" textAlignment="MiddleLeft" padding="30 30 0 0"></ToggleButton>
<Button class="optionButton" font="font_teutonic-arkham" colors="#88e3cf|#4f8478|#303836" fontSize="64" isOn="0" textAlignment="MiddleLeft" padding="20 20 0 0"></Button>
<Button font="font_teutonic-arkham" colors="#88e3cf|#4f8478|#303836"></Button>
</Defaults>
<Panel id="Buttons" offsetXY="0 285">
<TableLayout height="150" width="500" cellSpacing="10">
<TableLayout height="150" width="545" cellSpacing="10">
<Row>
<Cell columnSpan="3">
<Button onClick="startReset" colors="#88e3cf|#4f8478|#303836" font="font_teutonic-arkham" fontSize="110">Reset</Button>
<Button onClick="startReset" fontSize="125">Reset</Button>
</Cell>
<Cell>
<ToggleButton color="#88e3cf" colors="#88e3cf|#4f8478|#303836" onClick="toggleOptions" fontSize="60"></ToggleButton>
<Button onClick="toggleOptions" fontSize="65"></Button>
</Cell>
</Row>
</TableLayout>
</Panel>
<Panel id="Options" offsetXY="0 535" active="false" showAnimation="Grow" hideAnimation="Shrink">
<VerticalLayout height="300" width="500" spacing="10" childAlignment="MiddleCenter">
<ToggleButton class="optionButton" id="optionAgenda" onClick="optionClick(Agenda)">Doom on Agenda</ToggleButton>
<ToggleButton class="optionButton" id="optionPlayarea" onClick="optionClick(Playarea)">Doom in Playarea</ToggleButton>
<ToggleButton class="optionButton" id="optionPlayermats" onClick="optionClick(Playermats)">Doom on Playermats</ToggleButton>
<Panel id="Options" offsetXY="0 545" active="false" showAnimation="Grow" hideAnimation="Shrink">
<VerticalLayout height="300" width="545" spacing="10" childAlignment="MiddleCenter">
<Button class="optionButton" id="optionAgenda" text="☑ Doom on Agenda" onClick="optionClick(Agenda)"></Button>
<Button class="optionButton" id="optionPlayarea" text="☑ Doom in Play Area" onClick="optionClick(Playarea)"></Button>
<Button class="optionButton" id="optionPlayermats" text="☑ Doom on Playermats" onClick="optionClick(Playermats)"></Button>
</VerticalLayout>
</Panel>