153 lines
4.9 KiB
Lua
153 lines
4.9 KiB
Lua
|
local _, addon = ...
|
||
|
|
||
|
local Options = {}
|
||
|
addon.Options = Options
|
||
|
|
||
|
local function RegisterAddOnSettings(name, title)
|
||
|
return Settings.RegisterAddOnSetting(
|
||
|
Options.category,
|
||
|
"CzechQuestsAddon__" .. name,
|
||
|
name,
|
||
|
CzechQuestsAddon_Store.config,
|
||
|
type(CzechQuestsAddon_Store.config[name]),
|
||
|
title,
|
||
|
CzechQuestsAddon_Store.config[name]
|
||
|
)
|
||
|
end
|
||
|
|
||
|
local function RegisterProxySettings(name, title, setter)
|
||
|
return Settings.RegisterProxySetting(
|
||
|
Options.category,
|
||
|
"CzechQuestsAddon__" .. name,
|
||
|
type(CzechQuestsAddon_Store.config[name]),
|
||
|
title,
|
||
|
CzechQuestsAddon_Store.config[name],
|
||
|
function()
|
||
|
return CzechQuestsAddon_Store.config[name]
|
||
|
end,
|
||
|
setter
|
||
|
)
|
||
|
end
|
||
|
|
||
|
local function CreateCheckbox(name, title)
|
||
|
Settings.CreateCheckbox(
|
||
|
Options.category,
|
||
|
RegisterAddOnSettings(name, title)
|
||
|
)
|
||
|
end
|
||
|
|
||
|
local function CreateDropdown(name, title, items, setter)
|
||
|
Settings.CreateDropdown(
|
||
|
Options.category,
|
||
|
RegisterProxySettings(name, title, setter),
|
||
|
items
|
||
|
)
|
||
|
end
|
||
|
|
||
|
local function CreateSlider(name, title, min, max, step, setter)
|
||
|
local options = Settings.CreateSliderOptions(min, max, step)
|
||
|
options:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
|
||
|
Settings.CreateSlider(
|
||
|
Options.category,
|
||
|
RegisterProxySettings(name, title, setter),
|
||
|
options
|
||
|
)
|
||
|
end
|
||
|
|
||
|
local function CreateButton(title, label, setter)
|
||
|
Options.layout:AddInitializer(
|
||
|
CreateSettingsButtonInitializer(title, label, setter, nil, title)
|
||
|
)
|
||
|
end
|
||
|
|
||
|
local function InitQuests()
|
||
|
local function CreateQuestDropdown(name, title, items)
|
||
|
CreateDropdown(name, title, items, function (value)
|
||
|
CzechQuestsAddon_Store.config[name] = value
|
||
|
addon.QuestFrame:UpdateSettings()
|
||
|
end)
|
||
|
end
|
||
|
|
||
|
local function CreateQuestSlider(name, title, min, max, step)
|
||
|
CreateSlider(name, title, min, max, step, function (value)
|
||
|
CzechQuestsAddon_Store.config[name] = value
|
||
|
addon.QuestFrame:UpdateSettings()
|
||
|
end)
|
||
|
end
|
||
|
|
||
|
local layout = Options.layout
|
||
|
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Questy"))
|
||
|
|
||
|
CreateCheckbox("QUEST_ENABLED", "Zapnout")
|
||
|
|
||
|
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
|
||
|
CreateCheckbox("QUEST_DARK_MODE", "Pouzit tmavy rezim")
|
||
|
end
|
||
|
|
||
|
CreateQuestDropdown("QUEST_HEADER_FONT_NAME", "Pismo nadpisu", addon.API.GetFontContainer)
|
||
|
CreateQuestDropdown("QUEST_TEXT_FONT_NAME", "Pismo textu", addon.API.GetFontContainer)
|
||
|
|
||
|
CreateQuestSlider("QUEST_HEADER_FONT_SIZE", "Velikost nadpisu", 10, 30, 1)
|
||
|
CreateQuestSlider("QUEST_TEXT_FONT_SIZE", "Velikost textu", 10, 30, 1)
|
||
|
|
||
|
CreateSlider("QUEST_TEXTURE_ALPHA", "Pruhlednost pozadi", 10, 100, 10)
|
||
|
CreateCheckbox("QUEST_TEXTURE_ALPHA_ONLY_MOVING", "Pruhlednost pouze pri chuzi")
|
||
|
end
|
||
|
|
||
|
local function InitSpeeches()
|
||
|
local function CreateSpeechDropdown(name, title, items)
|
||
|
CreateDropdown(name, title, items, function (value)
|
||
|
CzechQuestsAddon_Store.config[name] = value
|
||
|
addon.SpeechFrame:UpdateSettings()
|
||
|
end)
|
||
|
end
|
||
|
|
||
|
local function CreateSpeechSlider(name, title, min, max, step)
|
||
|
CreateSlider(name, title, min, max, step, function (value)
|
||
|
CzechQuestsAddon_Store.config[name] = value
|
||
|
addon.SpeechFrame:UpdateSettings()
|
||
|
end)
|
||
|
end
|
||
|
|
||
|
local layout = Options.layout
|
||
|
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Bubliny"))
|
||
|
|
||
|
CreateCheckbox("SPEECH_ENABLED", "Zapnout")
|
||
|
|
||
|
CreateSpeechDropdown("SPEECH_TEXT_FONT_NAME", "Pismo *", addon.API.GetFontContainer)
|
||
|
CreateSpeechSlider("SPEECH_TEXT_FONT_SIZE", "Velikost pisma *", 10, 30, 1)
|
||
|
|
||
|
CreateSpeechSlider("SPEECH_FRAME_WIDTH", "Sirka okna", 200, 1000, 10)
|
||
|
|
||
|
CreateCheckbox("SPEECH_ORIGINAL_WHEN_MISSING", "Original pokud není preklad ")
|
||
|
|
||
|
CreateButton('Resetovat pozici okna', "RESET", function()
|
||
|
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION = { x = 0, y = 0}
|
||
|
addon.SpeechFrame:SetPoint(
|
||
|
"TOPLEFT", UIParent, "TOPLEFT",
|
||
|
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION.x,
|
||
|
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION.y
|
||
|
)
|
||
|
end)
|
||
|
end
|
||
|
|
||
|
local function InitOthers()
|
||
|
local layout = Options.layout
|
||
|
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Ostatni"))
|
||
|
|
||
|
CreateCheckbox("DEBUG_MODE", "Zapnout DEBUG")
|
||
|
end
|
||
|
|
||
|
local function InitOptions()
|
||
|
local category, layout = Settings.RegisterVerticalLayoutCategory("CzechQuests")
|
||
|
Options.category = category
|
||
|
Options.layout = layout
|
||
|
|
||
|
InitQuests()
|
||
|
InitSpeeches()
|
||
|
InitOthers()
|
||
|
|
||
|
Settings.RegisterAddOnCategory(category)
|
||
|
end
|
||
|
addon.API.InitOptions = InitOptions
|