updated option panel buttons

This commit is contained in:
Chr1Z93 2024-04-29 12:23:49 +02:00
parent e1428547b5
commit aa49fdae94
3 changed files with 72 additions and 52 deletions

View File

@ -29,6 +29,16 @@
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/2026086584372569912/5CB461AEAE2E59D3064D90A776EB86C46081EC78/"
},
{
"Name": "option-on",
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/2462982115668997008/2178787B67B3C96F3419EDBAB8420E39893756BC/"
},
{
"Name": "option-off",
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/2462982115668996901/D6438ECBB11DECC6DB9987589FF526FBAD4D2368/"
},
{
"Name": "font_arkhamicons",
"Type": 1,

View File

@ -1328,18 +1328,12 @@ end
-- Option Panel related functionality
---------------------------------------------------------
-- called by toggling an option
function onClick_toggleOption(_, id)
local toggleState = self.UI.getAttribute(id, "isOn")
-- flip state (and handle stupid "False" values)
if toggleState == "False" then
self.UI.setAttribute(id, "isOn", true)
applyOptionPanelChange(id, true)
else
self.UI.setAttribute(id, "isOn", "False")
applyOptionPanelChange(id, false)
end
-- changes the UI state and the internal variable for the togglebuttons
function onClick_toggleOption(_, _, id)
local currentState = optionPanel[id]
local newState = not currentState
applyOptionPanelChange(id, newState)
self.UI.setAttribute(id, "image", newState and "option-on" or "option-off")
end
-- color selection for playArea
@ -1430,9 +1424,7 @@ function updateOptionPanelState()
elseif (type(optionValue) == "boolean" and optionValue)
or (type(optionValue) == "string" and optionValue)
or (type(optionValue) == "table" and #optionValue ~= 0) then
UI.setAttribute(id, "isOn", true)
else
UI.setAttribute(id, "isOn", "False")
UI.setAttribute(id, "image", "option-on")
end
end
end

View File

@ -1,16 +1,13 @@
<!-- Default formatting -->
<Defaults>
<Text color="#FFFFFF"
alignment="MiddleLeft" />
alignment="MiddleLeft"/>
<Toggle isOn="False"
rectAlignment="MiddleRight" />
<Dropdown rectAlignment="MiddleCenter" />
<Dropdown rectAlignment="MiddleCenter"/>
<Cell dontUseTableCellBackground="true"
outlineSize="0 1"
outline="grey" />
outline="grey"/>
<!-- main window -->
<TableLayout class="window"
@ -22,20 +19,20 @@
outline="grey"
showAnimation="SlideIn_Right"
hideAnimation="SlideOut_Right"
animationDuration="0.2" />
animationDuration="0.2"/>
<!-- group headers -->
<Row class="group-header"
preferredHeight="44" />
preferredHeight="44"/>
<Cell class="group-header"
padding="10 10 0 0"
columnSpan="3"
color="#222222" />
color="#222222"/>
<Panel class="group-header"
padding="5 0 0 0" />
padding="5 0 0 0"/>
<Text class="group-header"
fontSize="28"
font="font_teutonic-arkham" />
font="font_teutonic-arkham"/>
<!-- options -->
<Row class="option-text"
@ -64,6 +61,14 @@
font="font_teutonic-arkham"/>
<Panel class="doubleColumn-wrapper"
padding="0 17 3 3"/>
<Button class="optionToggle"
image="option-off"
rectAlignment="MiddleRight"
offsetXY="-30 0"
colors="#FFFFFF|#dfdfdf"
height="36"
width="65"
ignoreLayout="True"/>
<!-- buttons at the bottom -->
<Button class="bottomButtons"
@ -150,8 +155,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="showTitleSplash"
onValueChanged="onClick_toggleOption(showTitleSplash)"/>
<Button class="optionToggle"
id="showTitleSplash"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -174,8 +180,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="playAreaSnapTags"
onValueChanged="onClick_toggleOption(playAreaSnapTags)"/>
<Button class="optionToggle"
id="playAreaSnapTags"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -188,8 +195,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="playAreaConnections"
onValueChanged="onClick_toggleOption(playAreaConnections)"/>
<Button class="optionToggle"
id="playAreaConnections"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -219,8 +227,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="changePlayAreaImage"
onValueChanged="onClick_toggleOption(changePlayAreaImage)"/>
<Button class="optionToggle"
id="changePlayAreaImage"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -243,8 +252,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="useSnapTags"
onValueChanged="onClick_toggleOption(useSnapTags)"/>
<Button class="optionToggle"
id="useSnapTags"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -257,8 +267,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="showDrawButton"
onValueChanged="onClick_toggleOption(showDrawButton)"/>
<Button class="optionToggle"
id="showDrawButton"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -271,8 +282,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="useClueClickers"
onValueChanged="onClick_toggleOption(useClueClickers)"/>
<Button class="optionToggle"
id="useClueClickers"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -337,8 +349,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="showAttachmentHelper"
onValueChanged="onClick_toggleOption(showAttachmentHelper)"/>
<Button class="optionToggle"
id="showAttachmentHelper"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -351,8 +364,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="showCleanUpHelper"
onValueChanged="onClick_toggleOption(showCleanUpHelper)"/>
<Button class="optionToggle"
id="showCleanUpHelper"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -365,8 +379,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="showCYOA"
onValueChanged="onClick_toggleOption(showCYOA)"/>
<Button class="optionToggle"
id="showCYOA"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -379,8 +394,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="showDisplacementTool"
onValueChanged="onClick_toggleOption(showDisplacementTool)"/>
<Button class="optionToggle"
id="showDisplacementTool"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -393,8 +409,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="showHandHelper"
onValueChanged="onClick_toggleOption(showHandHelper)"/>
<Button class="optionToggle"
id="showHandHelper"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
@ -407,8 +424,9 @@
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="showSearchAssistant"
onValueChanged="onClick_toggleOption(showSearchAssistant)"/>
<Button class="optionToggle"
id="showSearchAssistant"
onClick="onClick_toggleOption"/>
</Cell>
</Row>
</TableLayout>