from retail
This commit is contained in:
@@ -178,15 +178,13 @@ local function modify(parent, region, parentData, data, first)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not containsCustomText then
|
||||
if type(parentData.conditions) == "table" then
|
||||
for _, condition in ipairs(parentData.conditions) do
|
||||
if type(condition.changes) == "table" then
|
||||
for _, change in ipairs(condition.changes) do
|
||||
if type(change.property) == "string"
|
||||
and change.property:match("sub%.%d+%.text_text")
|
||||
and type(change.value) == "string"
|
||||
and Private.ContainsCustomPlaceHolder(change.value)
|
||||
then
|
||||
containsCustomText = true
|
||||
break
|
||||
@@ -195,7 +193,7 @@ local function modify(parent, region, parentData, data, first)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
if containsCustomText and parentData.customText and parentData.customText ~= "" then
|
||||
parent.customTextFunc = WeakAuras.LoadFunction("return "..parentData.customText)
|
||||
else
|
||||
@@ -205,20 +203,49 @@ local function modify(parent, region, parentData, data, first)
|
||||
parent.values.lastCustomTextUpdate = nil
|
||||
end
|
||||
|
||||
function region:ConfigureTextUpdate()
|
||||
local UpdateText
|
||||
if region.text_text and Private.ContainsAnyPlaceHolders(region.text_text) then
|
||||
local texts = {}
|
||||
local textStr = data.text_text or ""
|
||||
if textStr ~= "" then
|
||||
tinsert(texts, textStr)
|
||||
end
|
||||
|
||||
local subRegionIndex = 1
|
||||
for index, subRegion in ipairs(parentData.subRegions) do
|
||||
if subRegion == data then
|
||||
subRegionIndex = index
|
||||
break;
|
||||
end
|
||||
end
|
||||
if type(parentData.conditions) == "table" then
|
||||
local conditionName = "sub."..subRegionIndex..".text_text"
|
||||
for _, condition in ipairs(parentData.conditions) do
|
||||
if type(condition.changes) == "table" then
|
||||
for _, change in ipairs(condition.changes) do
|
||||
if type(change.property) == "string" and change.property == conditionName then
|
||||
if type(change.value ) == "string" and change.value ~= "" then
|
||||
tinsert(texts, change.value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local getter = function(key, default)
|
||||
local fullKey = "text_text_format_" .. key
|
||||
if data[fullKey] == nil then
|
||||
if (data[fullKey] == nil) then
|
||||
data[fullKey] = default
|
||||
end
|
||||
return data[fullKey]
|
||||
end
|
||||
local formatters = Private.CreateFormatters(region.text_text, getter)
|
||||
region.subTextFormatters = Private.CreateFormatters(texts, getter)
|
||||
|
||||
function region:ConfigureTextUpdate()
|
||||
local UpdateText
|
||||
if region.text_text and Private.ContainsAnyPlaceHolders(region.text_text) then
|
||||
UpdateText = function()
|
||||
local textStr = region.text_text or ""
|
||||
textStr = Private.ReplacePlaceHolders(textStr, parent, nil, false, formatters)
|
||||
textStr = Private.ReplacePlaceHolders(textStr, parent, nil, false, self.subTextFormatters)
|
||||
|
||||
if text:GetFont() then
|
||||
text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(textStr))
|
||||
|
||||
@@ -465,30 +465,42 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
options["text_text_format_" .. key] = option
|
||||
end
|
||||
|
||||
if parentData.controlledChildren then
|
||||
local list = {}
|
||||
for child in OptionsPrivate.Private.TraverseLeafs(parentData) do
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
if child.subRegions then
|
||||
local childSubRegion = child.subRegions[index]
|
||||
if childSubRegion then
|
||||
tinsert(list, childSubRegion)
|
||||
tinsert(list, child)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for listIndex, childSubRegion in ipairs(list) do
|
||||
for listIndex, child in ipairs(list) do
|
||||
local childSubRegion = child.subRegions[index]
|
||||
local get = function(key)
|
||||
return childSubRegion["text_text_format_" .. key]
|
||||
end
|
||||
local input = childSubRegion["text_text"]
|
||||
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden, false, listIndex, #list)
|
||||
local texts = {}
|
||||
if type(childSubRegion.text_text) == "string" and childSubRegion.text_text ~= "" then
|
||||
-- found text of subregion
|
||||
tinsert(texts, childSubRegion.text_text)
|
||||
end
|
||||
else
|
||||
local get = function(key)
|
||||
return data["text_text_format_" .. key]
|
||||
|
||||
for _, condition in ipairs(child.conditions) do
|
||||
if type(condition.changes) == "table" then
|
||||
for _, change in ipairs(condition.changes) do
|
||||
if change.property == "sub."..index..".text_text"
|
||||
and type(change.value) == "string"
|
||||
and change.value ~= ""
|
||||
then
|
||||
-- found a condition editing text of that subregion
|
||||
tinsert(texts, change.value)
|
||||
end
|
||||
local input = data["text_text"]
|
||||
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
OptionsPrivate.AddTextFormatOption(texts, true, get, addOption, hidden, setHidden, false, listIndex, #list)
|
||||
end
|
||||
|
||||
addOption("footer", {
|
||||
|
||||
Reference in New Issue
Block a user