xml cleanup

This commit is contained in:
Chr1Z93 2022-12-06 20:57:33 +01:00
parent 12a71894d8
commit ce8e6815a5
2 changed files with 78 additions and 68 deletions

View File

@ -135,9 +135,7 @@ function onLoad(savedData)
if savedData then if savedData then
optionPanel = JSON.decode(savedData) optionPanel = JSON.decode(savedData)
for id, enabled in pairs(optionPanel) do for id, enabled in pairs(optionPanel) do
if enabled then if enabled then self.UI.setAttribute("toggle" .. id, "isOn", true) end
self.UI.setAttribute("toggle" .. id, "isOn", true)
end
end end
else else
for i = 1, 8 do for i = 1, 8 do
@ -613,11 +611,13 @@ function onClick_toggleOption(_, id)
self.UI.setAttribute("toggle" .. id, "isOn", state) self.UI.setAttribute("toggle" .. id, "isOn", state)
optionPanel[id] = state optionPanel[id] = state
print("Option no. " .. id .. ": " .. tostring(optionPanel[id]))
end end
function onClick_applySettings() function onClick_applySettings()
print("Dummy: Apply settings") print("Enabling following settings:")
for id, value in pairs(optionPanel) do
if value then print(id) end
end
end end
function onClick_toggleUi(_, title) function onClick_toggleUi(_, title)

View File

@ -11,20 +11,14 @@
<Text class="headerText" minWidth="200" flexibleWidth="100" fontSize="32"/> <Text class="headerText" minWidth="200" flexibleWidth="100" fontSize="32"/>
<!-- Window layouting --> <!-- Window layouting -->
<VerticalLayout class="window" active="false" visibility="Admin" width="800" height="780" color="black" outlineSize="1 1" outline="#303030"/> <VerticalLayout color="black" visibility="Admin" outlineSize="1 1" outline="#303030"/>
<VerticalLayout class="window" active="false" width="800" height="780"/>
<Row class="tblRow" preferredHeight="75"/> <Row class="tblRow" preferredHeight="75"/>
</Defaults> </Defaults>
<!-- Buttons in the bottom right of the screen --> <!-- Buttons in the bottom right of the screen -->
<VerticalLayout <VerticalLayout rectAlignment="LowerRight" width="40" height="240" offsetXY="-1 70">
visibility="Admin"
color="black"
outlineSize="1 1"
outline="#303030"
rectAlignment="LowerRight"
width="40"
height="240"
offsetXY="-1 70">
<Button color="#000000" icon="cthulhu" tooltip="Campaigns" onClick="onClick_toggleUi(Campaigns)"/> <Button color="#000000" icon="cthulhu" tooltip="Campaigns" onClick="onClick_toggleUi(Campaigns)"/>
<Button color="#000000" icon="dark-cult" tooltip="Standalone Scenarios" onClick="onClick_toggleUi(Standalone Scenarios)"/> <Button color="#000000" icon="dark-cult" tooltip="Standalone Scenarios" onClick="onClick_toggleUi(Standalone Scenarios)"/>
<Button color="#000000" icon="yog-sothoth" tooltip="Extras" onClick="onClick_toggleUi(Extras)"/> <Button color="#000000" icon="yog-sothoth" tooltip="Extras" onClick="onClick_toggleUi(Extras)"/>
@ -67,20 +61,36 @@
<VerticalScrollView color="transparent" minHeight="100" flexibleHeight="100"> <VerticalScrollView color="transparent" minHeight="100" flexibleHeight="100">
<TableLayout padding="20" cellPadding="10" cellSpacing="10"> <TableLayout padding="20" cellPadding="10" cellSpacing="10">
<Row class="tblRow"> <Row class="tblRow">
<Cell><Toggle id="toggle1" onValueChanged="onClick_toggleOption(1)">Toggle Text 1</Toggle></Cell> <Cell>
<Cell><Toggle id="toggle2" onValueChanged="onClick_toggleOption(2)">Toggle Text 2</Toggle></Cell> <Toggle id="toggle1" onValueChanged="onClick_toggleOption(1)">Toggle Text 1</Toggle>
</Cell>
<Cell>
<Toggle id="toggle2" onValueChanged="onClick_toggleOption(2)">Toggle Text 2</Toggle>
</Cell>
</Row> </Row>
<Row class="tblRow"> <Row class="tblRow">
<Cell><Toggle id="toggle3" onValueChanged="onClick_toggleOption(3)">Toggle Text 3</Toggle></Cell> <Cell>
<Cell><Toggle id="toggle4" onValueChanged="onClick_toggleOption(4)">Toggle Text 4</Toggle></Cell> <Toggle id="toggle3" onValueChanged="onClick_toggleOption(3)">Toggle Text 3</Toggle>
</Cell>
<Cell>
<Toggle id="toggle4" onValueChanged="onClick_toggleOption(4)">Toggle Text 4</Toggle>
</Cell>
</Row> </Row>
<Row class="tblRow"> <Row class="tblRow">
<Cell><Toggle id="toggle5" onValueChanged="onClick_toggleOption(5)">Toggle Text 5</Toggle></Cell> <Cell>
<Cell><Toggle id="toggle6" onValueChanged="onClick_toggleOption(6)">Toggle Text 6</Toggle></Cell> <Toggle id="toggle5" onValueChanged="onClick_toggleOption(5)">Toggle Text 5</Toggle>
</Cell>
<Cell>
<Toggle id="toggle6" onValueChanged="onClick_toggleOption(6)">Toggle Text 6</Toggle>
</Cell>
</Row> </Row>
<Row class="tblRow"> <Row class="tblRow">
<Cell><Toggle id="toggle7" onValueChanged="onClick_toggleOption(7)">Toggle Text 7</Toggle></Cell> <Cell>
<Cell><Toggle id="toggle8" onValueChanged="onClick_toggleOption(8)">Toggle Text 8</Toggle></Cell> <Toggle id="toggle7" onValueChanged="onClick_toggleOption(7)">Toggle Text 7</Toggle>
</Cell>
<Cell>
<Toggle id="toggle8" onValueChanged="onClick_toggleOption(8)">Toggle Text 8</Toggle>
</Cell>
</Row> </Row>
</TableLayout> </TableLayout>
</VerticalScrollView> </VerticalScrollView>