moved xml to dedicated folder, save function added

This commit is contained in:
Chr1Z93 2022-12-06 20:10:09 +01:00
parent 5a71eda9a7
commit 12a71894d8
3 changed files with 23 additions and 4 deletions

View File

@ -22,7 +22,7 @@
},
"Lighting_path": "Lighting.json",
"LuaScript": "require(\"core/Global\")",
"LuaScriptState": "",
"LuaScriptState": "[]",
"MusicPlayer_path": "MusicPlayer.json",
"Note": "",
"ObjectStates_order": [
@ -266,5 +266,5 @@
"Tags": [],
"Turns_path": "Turns.json",
"VersionNumber": "v13.2.2",
"XmlUI_path": "Root.xml"
"XmlUI": "<Include src=\"Global.xml\"/>"
}

View File

@ -5,6 +5,9 @@
ENCOUNTER_DECK_POS = {-3.93, 1, 5.76}
ENCOUNTER_DECK_DISCARD_POSITION = {-3.85, 1, 10.38}
-- optionPanel data
optionPanel = {}
-- GUID of data helper
DATA_HELPER_GUID = "708279"
@ -125,10 +128,27 @@ local overallStats = {
-- general code
---------------------------------------------------------
function onLoad()
-- saving state of optionPanel to restore later
function onSave() return JSON.encode(optionPanel) end
function onLoad(savedData)
if savedData then
optionPanel = JSON.decode(savedData)
for id, enabled in pairs(optionPanel) do
if enabled then
self.UI.setAttribute("toggle" .. id, "isOn", true)
end
end
else
for i = 1, 8 do
optionPanel[i] = false
end
end
for _, guid in ipairs(NOT_INTERACTABLE) do
getObjectFromGUID(guid).interactable = false
end
math.randomseed(os.time())
end
@ -581,7 +601,6 @@ function onClick_defaultSettings()
print("Dummy: Load default settings")
end
local optionPanel = {}
function onClick_toggleOption(_, id)
local state = self.UI.getAttribute("toggle" .. id, "isOn")