first shot at xml creation

This commit is contained in:
Chr1Z93 2024-06-29 15:55:27 +02:00
parent 40908aa78f
commit f71b1d16a6

View File

@ -7,6 +7,19 @@ local searchLib = require("util/SearchLib")
local tokenChecker = require("core/token/TokenChecker") local tokenChecker = require("core/token/TokenChecker")
local tokenManager = require("core/token/TokenManager") local tokenManager = require("core/token/TokenManager")
-- option panel data
local availableOptions = {
["Personal Settings"] = {
{
id = "slotEditing",
title = "Enable Slot Edit Mode",
tooltip = "Makes each slot clickable to change the symbol.",
type = "toggle",
data = "false"
}
}
}
-- we use this to turn off collision handling until onLoad() is complete -- we use this to turn off collision handling until onLoad() is complete
local collisionEnabled = false local collisionEnabled = false
local currentlyEditingSlots = false local currentlyEditingSlots = false
@ -646,6 +659,148 @@ function createXML()
end end
-- create the personal option panel -- create the personal option panel
local defaultsXML = {
tag = "Defaults",
children = {
{
tag = "Text",
attributes = { color = "#FFFFFF", alignment = "MiddleLeft" }
},
{
tag = "Dropdown",
attributes = { rectAlignment = "MiddleCenter" }
},
{
tag = "Cell",
attributes = { dontUseTableCellBackground = "true", outlineSize = "0 1", outline = "grey" }
}
}
}
table.insert(xml, defaultsXML)
-- main window
local optionPanelXML = {
tag = "TableLayout",
attributes = {
width = "100",
height = "100",
rotation = "0 0 180",
position = "300 0 -100",
--active = "false",
color = "#000000",
outlineSize = "2 2",
outline = "grey",
showAnimation = "SlideIn_Right",
hideAnimation = "SlideOut_Right",
animationDuration = "0.2"
},
children = {
-- header
{
tag = "Row",
attributes = { preferredHeight = "60" },
children = {
{
tag = "Cell",
children = {
{
tag = "Panel",
attributes = { padding = "10 0 0 0", scale = "0.3 0.3" },
children = {
{
tag = "Text",
attributes = { font = "font_teutonic-arkham", fontSize = "35", text = "Options" }
}
}
}
}
}
}
}
}
}
-- add options groups
for groupName, groupData in pairs(availableOptions) do
-- group header
local groupXML = {
tag = "Row",
attributes = { preferredHeight = "44" },
children = {
{
tag = "Cell",
attributes = { padding = "10 10 0 0", columnSpan = "3", color = "#222222" },
children = {
{
tag = "Panel",
attributes = { padding = "5 0 0 0" },
children = {
{
tag = "Text",
attributes = { fontSize = "28", font = "font_teutonic-arkham", text = groupName }
}
}
}
}
}
}
}
-- options
for i, optionData in ipairs(groupData) do
local optionXML = {
{
tag = "Row",
attributes = { preferredHeight = "50", tooltip = optionData.tooltip, tooltipPosition = "Left", tooltipBackgroundColor = "rgba(0,0,0,1)" },
children = {
-- option title
{
tag = "Cell",
attributes = { padding = "10 10 5 5", color = "#333333", columnSpan = "2" },
children = {
{
tag = "Panel",
attributes = { padding = "10 0 0 0" },
children = {
{
tag = "Text",
attributes = { fontSize = "22", font = "font_teutonic-arkham", text = optionData.title }
}
}
}
}
},
-- option button
{
tag = "Cell",
attributes = { padding = "10 10 5 5", color = "#333333" },
children = {
{
tag = "Button",
attributes = {
id = optionData.id,
image = "option-off",
onClick="onClick_toggleOption",
rectAlignment = "MiddleRight",
offsetXY = "-30 0",
colors = "#FFFFFF|#dfdfdf",
height = "36",
width = "65",
ignoreLayout = "True"
}
}
}
}
}
}
}
table.insert(groupXML, optionXML)
end
table.insert(optionPanelXML, groupXML)
end
table.insert(xml, optionPanelXML)
-- create buttons at the bottom
self.UI.setXmlTable(xml) self.UI.setXmlTable(xml)
end end