Merge pull request #319 from argonui/option-panel
Option Panel: added dropdown list to select language
This commit is contained in:
commit
576cec1f88
@ -1 +1 @@
|
||||
{"acknowledgedUpgradeVersions":[],"optionPanel":{"playAreaSnapTags":true,"showAttachmentHelper":false,"showChaosBagManager":false,"showCleanUpHelper":false,"showCustomPlaymatImages":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":[],"showSearchAssistant":[],"showTitleSplash":true,"showTokenArranger":false,"useClueClickers":false,"useSnapTags":true}}
|
||||
{"acknowledgedUpgradeVersions":[],"optionPanel":{"cardLanguage":"en","playAreaSnapTags":true,"showAttachmentHelper":false,"showChaosBagManager":false,"showCleanUpHelper":false,"showCustomPlaymatImages":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":[],"showSearchAssistant":[],"showTitleSplash":true,"showTokenArranger":false,"useClueClickers":false,"useSnapTags":true}}
|
||||
|
@ -47,6 +47,16 @@ local SOURCE_REPO = 'https://raw.githubusercontent.com/chr1z93/loadable-objects/
|
||||
local library, requestObj, modMeta, notificationVisible
|
||||
local acknowledgedUpgradeVersions = {}
|
||||
|
||||
local LANGUAGES = {
|
||||
{ code = "zh_CN", name = "简体中文" },
|
||||
{ code = "zh_TW", name = "繁體中文" },
|
||||
{ code = "de", name = "Deutsch" },
|
||||
{ code = "en", name = "English" },
|
||||
{ code = "es", name = "Español" },
|
||||
{ code = "fr", name = "Français" },
|
||||
{ code = "it", name = "Italiano" }
|
||||
}
|
||||
|
||||
---------------------------------------------------------
|
||||
-- data for tokens
|
||||
---------------------------------------------------------
|
||||
@ -847,15 +857,32 @@ function onClick_toggleOption(_, id)
|
||||
applyOptionPanelChange(id, state)
|
||||
end
|
||||
|
||||
-- called by the language selection dropdown
|
||||
function languageSelected(_, selectedIndex, id)
|
||||
optionPanel[id] = LANGUAGES[tonumber(selectedIndex) + 1].code
|
||||
end
|
||||
|
||||
-- returns the ID (position in the table) for a provided language code
|
||||
function returnLanguageId(code)
|
||||
for index, tbl in ipairs(LANGUAGES) do
|
||||
if tbl.code == code then
|
||||
return index
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- sets the option panel to the correct state (corresponding to 'optionPanel')
|
||||
function updateOptionPanelState()
|
||||
for id, enabled in pairs(optionPanel) do
|
||||
if (type(enabled) == "boolean" and enabled)
|
||||
or (type(enabled) == "string" and enabled)
|
||||
or (type(enabled) == "table" and #enabled ~= 0) then
|
||||
self.UI.setAttribute(id, "isOn", true)
|
||||
for id, optionValue in pairs(optionPanel) do
|
||||
if id == "cardLanguage" and type(optionValue) == "string" then
|
||||
local dropdownId = returnLanguageId(optionValue) - 1
|
||||
UI.setAttribute(id, "value", dropdownId)
|
||||
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
|
||||
self.UI.setAttribute(id, "isOn", "False")
|
||||
UI.setAttribute(id, "isOn", "False")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -6,6 +6,8 @@
|
||||
<Toggle isOn="False"
|
||||
rectAlignment="MiddleRight" />
|
||||
|
||||
<Dropdown rectAlignment="MiddleCenter" />
|
||||
|
||||
<Cell dontUseTableCellBackground="true"
|
||||
outlineSize="0 1"
|
||||
outline="grey" />
|
||||
@ -26,7 +28,7 @@
|
||||
<Row class="group-header"
|
||||
preferredHeight="54" />
|
||||
<Cell class="group-header"
|
||||
columnSpan="2"
|
||||
columnSpan="3"
|
||||
color="#222222" />
|
||||
<Panel class="group-header"
|
||||
padding="5 0 0 0" />
|
||||
@ -38,9 +40,16 @@
|
||||
<Row class="option-text"
|
||||
preferredHeight="70"/>
|
||||
<Cell class="option-text"
|
||||
color="#333333"/>
|
||||
color="#333333"
|
||||
columnSpan="2"/>
|
||||
<Cell class="option-button"
|
||||
color="#333333"/>
|
||||
<Cell class="option-dropdowntext"
|
||||
color="#333333"
|
||||
columnSpan="1"/>
|
||||
<Cell class="option-dropdown"
|
||||
color="#333333"
|
||||
columnSpan="2"/>
|
||||
<VerticalLayout class="text-column"
|
||||
padding="10 0 0 0"
|
||||
spacing="5"/>
|
||||
@ -87,9 +96,9 @@
|
||||
<Row>
|
||||
<Cell>
|
||||
<VerticalScrollView horizontalScrollbarVisibility="AutohideAndExpandViewport">
|
||||
<TableLayout columnWidths="0 75"
|
||||
<TableLayout columnWidths="0 100 75"
|
||||
autoCalculateHeight="1"
|
||||
cellPadding="10 0 5 5">
|
||||
cellPadding="10 5 5 5">
|
||||
|
||||
<!-- Group: general settings -->
|
||||
<Row class="group-header">
|
||||
@ -101,6 +110,30 @@
|
||||
</Cell>
|
||||
</Row>
|
||||
|
||||
<!-- Option: card language -->
|
||||
<Row class="option-text">
|
||||
<Cell class="option-dropdowntext">
|
||||
<VerticalLayout class="text-column">
|
||||
<Text class="option-header">Card language</Text>
|
||||
<Text class="description">Downloading a campaign or importing a deck will use this language for cards (if available).</Text>
|
||||
</VerticalLayout>
|
||||
</Cell>
|
||||
<Cell class="option-dropdown">
|
||||
<Panel padding="0 17 13 13">
|
||||
<Dropdown id="cardLanguage"
|
||||
onValueChanged="languageSelected(selectedIndex)">
|
||||
<Option>简体中文</Option>
|
||||
<Option>繁體中文</Option>
|
||||
<Option>Deutsch</Option>
|
||||
<Option>English</Option>
|
||||
<Option>Español</Option>
|
||||
<Option>Français</Option>
|
||||
<Option>Italiano</Option>
|
||||
</Dropdown>
|
||||
</Panel>
|
||||
</Cell>
|
||||
</Row>
|
||||
|
||||
<!-- Option: play area snap tags -->
|
||||
<Row class="option-text">
|
||||
<Cell class="option-text">
|
||||
@ -171,7 +204,7 @@
|
||||
<Row class="option-text">
|
||||
<Cell class="option-text">
|
||||
<VerticalLayout class="text-column">
|
||||
<Text class="option-header">Use clickable clue-counters</Text>
|
||||
<Text class="option-header">Use clickable clue counters</Text>
|
||||
<Text class="description">Instead of automatically counting clues in the respective area on your playermat, this displays a clickable counter for clues.</Text>
|
||||
</VerticalLayout>
|
||||
</Cell>
|
||||
@ -185,7 +218,7 @@
|
||||
<Row class="option-text">
|
||||
<Cell class="option-text">
|
||||
<VerticalLayout class="text-column">
|
||||
<Text class="option-header">Use clickable resource counters</Text>
|
||||
<Text class="option-header">Use clickable resource tokens</Text>
|
||||
<Text class="description">This enables spawning of clickable resource tokens for player cards.</Text>
|
||||
</VerticalLayout>
|
||||
</Cell>
|
||||
|
Loading…
Reference in New Issue
Block a user