Commit 1338da84 authored by Ivaria's avatar Ivaria
Browse files

Changed the logic around the custom debuff color setting again - not perfect...

Changed the logic around the custom debuff color setting again - not perfect but as close as I can get without a major rewrite of this whole setting saving code
parent 4dfb2c6b
......@@ -121,19 +121,30 @@ local tColor = { };
local tEmpty = { };
function _VUHDO_getDebuffColor(anInfo)
if anInfo["charmed"] then return VUHDO_PANEL_SETUP["BAR_COLORS"]["CHARMED"]; end
if anInfo["charmed"] then
return VUHDO_PANEL_SETUP["BAR_COLORS"]["CHARMED"];
end
tDebuff = anInfo["debuff"];
if not anInfo["mibucateg"] and (tDebuff or 0) == 0 then return tEmpty; end-- VUHDO_DEBUFF_TYPE_NONE
if not anInfo["mibucateg"] and (tDebuff or 0) == 0 then -- VUHDO_DEBUFF_TYPE_NONE
return tEmpty;
end
if (tDebuff or 6) ~= 6 and VUHDO_DEBUFF_COLORS[tDebuff] then -- VUHDO_DEBUFF_TYPE_CUSTOM
return VUHDO_DEBUFF_COLORS[tDebuff];
end
tDebuffSettings = sAllDebuffSettings[anInfo["debuffName"]];
if tDebuff == 6 and tDebuffSettings ~= nil -- VUHDO_DEBUFF_TYPE_CUSTOM
and tDebuffSettings["isColor"] and tDebuffSettings["color"] ~= nil then
tSourceColor = tDebuffSettings["color"];
and tDebuffSettings["isColor"] then
if tDebuffSettings["color"] ~= nil then
tSourceColor = tDebuffSettings["color"];
else
tSourceColor = VUHDO_DEBUFF_COLORS[tDebuff];
end
twipe(tColor);
if VUHDO_DEBUFF_COLORS[6]["useBackground"] then
......
......@@ -106,21 +106,17 @@ function VUHDO_customDebuffUpdateEditBox(anEditBox)
VUHDO_setComboModel(tComboBox, "VUHDO_CONFIG.CUSTOM_DEBUFF.STORED_SETTINGS." .. tValue .. ".SOUND", VUHDO_SOUNDS);
VUHDO_lnfComboBoxInitFromModel(tComboBox);
tColorSwatch = _G[tPanelName .. "ColorTexture"];
if (VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].isColor) then
if (VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color == nil) then
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color
= VUHDO_deepCopyTable(VUHDO_PANEL_SETUP.BAR_COLORS["DEBUFF" .. VUHDO_DEBUFF_TYPE_CUSTOM]);
end
VUHDO_lnfSetModel(tColorSwatch, "VUHDO_CONFIG.CUSTOM_DEBUFF.STORED_SETTINGS." .. tValue .. ".color");
else
if (not VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].isColor) then
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color = nil;
end
VUHDO_lnfSetModel(tColorSwatch, "VUHDO_PANEL_SETUP.BAR_COLORS.DEBUFF" .. VUHDO_DEBUFF_TYPE_CUSTOM);
if (VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color == nil) then
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color
= VUHDO_deepCopyTable(VUHDO_PANEL_SETUP.BAR_COLORS["DEBUFF" .. VUHDO_DEBUFF_TYPE_CUSTOM]);
end
tColorSwatch = _G[tPanelName .. "ColorTexture"];
VUHDO_lnfSetModel(tColorSwatch, "VUHDO_CONFIG.CUSTOM_DEBUFF.STORED_SETTINGS." .. tValue .. ".color");
VUHDO_lnfInitColorSwatch(tColorSwatch, VUHDO_I18N_COLOR, VUHDO_I18N_COLOR);
VUHDO_lnfColorSwatchInitFromModel(tColorSwatch);
......@@ -199,28 +195,31 @@ end
--
function VUHDO_custonDebuffisColorClicked()
VUHDO_customDebuffUpdateEditBox(VuhDoNewOptionsDebuffsCustomStorePanelEditBox);
end
--
local tEditBox;
local tValue;
local tIndex;
local tCheckButton;
local tPanelName;
local tComboBox;
local tSoundName;
local tColor;
function VUHDO_saveCustomDebuffOnClick(aButton)
local tEditBox = _G[aButton:GetParent():GetName() .. "EditBox"];
local tValue = strtrim(tEditBox:GetText());
local tIndex = VUHDO_tableGetKeyFromValue(VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED"], tValue);
tEditBox = _G[aButton:GetParent():GetName() .. "EditBox"];
tValue = strtrim(tEditBox:GetText());
tIndex = VUHDO_tableGetKeyFromValue(VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED"], tValue);
if (tIndex == nil and #tValue > 0) then
tinsert(VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED"], tValue);
VuhDoNewOptionsDebuffsCustomStorePanelEditBox:SetText(tValue);
VuhDoNewOptionsDebuffsCustomStorePanelEditBox:SetTextColor(1, 1, 1);
end
local tCheckButton;
local tPanelName;
tPanelName = aButton:GetParent():GetName();
if (VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue] == nil) then
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue] = { };
end
tCheckButton = _G[tPanelName .. "IconCheckButton"];
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].isIcon = VUHDO_forceBooleanValue(tCheckButton:GetChecked());
......@@ -243,25 +242,26 @@ function VUHDO_saveCustomDebuffOnClick(aButton)
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].isFullDuration = VUHDO_forceBooleanValue(tCheckButton:GetChecked());
tComboBox = _G[tPanelName .. "SoundCombo"];
local tSoundName = _G[tComboBox:GetName() .. "Text"]:GetText();
tSoundName = _G[tComboBox:GetName() .. "Text"]:GetText();
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].SOUND = VUHDO_LibSharedMedia:Fetch("sound", tSoundName);
VUHDO_lnfComboBoxInitFromModel(tComboBox);
tColorSwatch = _G[tPanelName .. "ColorTexture"];
if (VUHDO_COLOR_SWATCH_MODEL == nil) then
if (VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color == nil) then
if (VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].isColor) then
if (VUHDO_COLOR_SWATCH_MODEL ~= nil) then
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color
= VUHDO_deepCopyTable(VUHDO_PANEL_SETUP.BAR_COLORS["DEBUFF" .. VUHDO_DEBUFF_TYPE_CUSTOM]);
= VUHDO_deepCopyTable(VUHDO_COLOR_SWATCH_MODEL);
VUHDO_COLOR_SWATCH_MODEL = nil;
end
else
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color
= VUHDO_deepCopyTable(VUHDO_COLOR_SWATCH_MODEL);
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color = nil;
end
VUHDO_CONFIG["CUSTOM_DEBUFF"]["SELECTED"] = tValue;
VUHDO_initCustomDebuffComboModel();
VUHDO_customDebuffUpdateEditBox(VuhDoNewOptionsDebuffsCustomStorePanelEditBox);
VuhDoNewOptionsDebuffsCustom:Hide();
VuhDoNewOptionsDebuffsCustom:Show();
end
......@@ -310,3 +310,4 @@ function VUHDO_applyToAllCustomDebuffOnClick()
VuhDoNewOptionsDebuffsCustomStorePanel:Hide();
VuhDoNewOptionsDebuffsCustomStorePanel:Show();
end
......@@ -219,11 +219,6 @@
<OnLoad>
VUHDO_lnfSetTooltip(self, VUHDO_I18N_TT.K274);
</OnLoad>
<OnClick>
VUHDO_lnfCheckButtonUpdateModel(self);
VUHDO_lnfCheckButtonClicked(self);
VUHDO_custonDebuffisColorClicked();
</OnClick>
</Scripts>
</CheckButton>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment