From 1deae2ef46d042c1c6b77c038b82161a3f795dc5 Mon Sep 17 00:00:00 2001 From: Aviana Date: Thu, 17 Mar 2016 18:51:59 +0100 Subject: [PATCH] Combat text options, expanded tag areas --- LunaUnitFrames.lua | 6 +++- modules/Options.lua | 80 ++++++++++++++++++++++++++++++++++++++++++++- modules/health.lua | 4 +-- modules/power.lua | 4 +-- 4 files changed, 88 insertions(+), 6 deletions(-) diff --git a/LunaUnitFrames.lua b/LunaUnitFrames.lua index 8b8d36cc..866a7f40 100644 --- a/LunaUnitFrames.lua +++ b/LunaUnitFrames.lua @@ -2,7 +2,7 @@ LunaUF = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0", "AceDB LunaUF:RegisterDB("LunaDB") -- Assets ---------------------------------------------------------------------------------- -LunaUF.Version = 2000 +LunaUF.Version = 2002 LunaUF.BS = AceLibrary("Babble-Spell-2.2") LunaUF.Banzai = AceLibrary("Banzai-1.0") LunaUF.HealComm = AceLibrary("HealComm-1.0") @@ -377,6 +377,7 @@ LunaUF.defaults = { auras = { enabled = false, AurasPerRow = 8, position = "BOTTOM" }, highlight = { enabled = true, ontarget = false, ondebuff = true, onmouse = false }, fader = { enabled = false, inactiveAlpha = 0.2, combatAlpha = 1 }, + combatText = { enabled = false, xoffset = 0, yoffset = 0, size = 2 }, tags = { enabled = true, bartags = { @@ -427,6 +428,7 @@ LunaUF.defaults = { auras = { enabled = false, AurasPerRow = 8, position = "BOTTOM" }, highlight = { enabled = true, ontarget = false, ondebuff = true, onmouse = false }, fader = { enabled = false, inactiveAlpha = 0.2, combatAlpha = 1 }, + combatText = { enabled = false, xoffset = 0, yoffset = 0, size = 2 }, tags = { enabled = true, bartags = { @@ -545,6 +547,7 @@ LunaUF.defaults = { auras = { enabled = false, AurasPerRow = 8, position = "BOTTOM" }, highlight = { enabled = true, ontarget = false, ondebuff = true, onmouse = false }, fader = { enabled = false, inactiveAlpha = 0.2, combatAlpha = 1 }, + combatText = { enabled = false, xoffset = 0, yoffset = 0, size = 2 }, tags = { enabled = true, bartags = { @@ -591,6 +594,7 @@ LunaUF.defaults = { auras = { enabled = false, AurasPerRow = 8, position = "BOTTOM" }, highlight = { enabled = true, ontarget = false, ondebuff = true, onmouse = false }, fader = { enabled = false, inactiveAlpha = 0.2, combatAlpha = 1 }, + combatText = { enabled = false, xoffset = 0, yoffset = 0, size = 2 }, tags = { enabled = true, bartags = { diff --git a/modules/Options.lua b/modules/Options.lua index 24caeaf9..c3fa80cd 100644 --- a/modules/Options.lua +++ b/modules/Options.lua @@ -552,6 +552,10 @@ function LunaUF:LoadOptions() LunaOptionsFrame.pages[i].enableFader:SetChecked(LunaUF.db.profile.units[unit].fader.enabled) LunaOptionsFrame.pages[i].FaderCombatslider:SetValue(LunaUF.db.profile.units[unit].fader.combatAlpha) LunaOptionsFrame.pages[i].FaderNonCombatslider:SetValue(LunaUF.db.profile.units[unit].fader.inactiveAlpha) + LunaOptionsFrame.pages[i].enableCtext:SetChecked(LunaUF.db.profile.units[unit].combatText.enabled) + LunaOptionsFrame.pages[i].ctextscaleslider:SetValue(LunaUF.db.profile.units[unit].combatText.size) + LunaOptionsFrame.pages[i].ctextXslider:SetValue(LunaUF.db.profile.units[unit].combatText.xoffset) + LunaOptionsFrame.pages[i].ctextYslider:SetValue(LunaUF.db.profile.units[unit].combatText.yoffset) LunaOptionsFrame.pages[i].enablePortrait:SetChecked(LunaUF.db.profile.units[unit].portrait.enabled) SetDropDownValue(LunaOptionsFrame.pages[i].portraitType,LunaUF.db.profile.units[unit].portrait.type) SetDropDownValue(LunaOptionsFrame.pages[i].portraitSide,LunaUF.db.profile.units[unit].portrait.side) @@ -1324,8 +1328,82 @@ function LunaUF:CreateOptionsMenu() LunaOptionsFrame.pages[i].FaderNonCombatslider:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].faderheader, "BOTTOMLEFT", 220, -50) LunaOptionsFrame.pages[i].FaderNonCombatslider:SetWidth(200) + ---- + + LunaOptionsFrame.pages[i].ctextheader = LunaOptionsFrame.pages[i]:CreateFontString(nil, "OVERLAY", "GameFontHighlight") + LunaOptionsFrame.pages[i].ctextheader:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].faderheader, "BOTTOMLEFT", 0, -100) + LunaOptionsFrame.pages[i].ctextheader:SetHeight(24) + LunaOptionsFrame.pages[i].ctextheader:SetJustifyH("LEFT") + LunaOptionsFrame.pages[i].ctextheader:SetTextColor(1,1,0) + LunaOptionsFrame.pages[i].ctextheader:SetText(L["Combat text"]) + + LunaOptionsFrame.pages[i].enableCtext = CreateFrame("CheckButton", "Enable"..LunaUF.unitList[i-1].."CombatText", LunaOptionsFrame.pages[i], "UICheckButtonTemplate") + LunaOptionsFrame.pages[i].enableCtext:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].ctextheader, "BOTTOMLEFT", 0, -10) + LunaOptionsFrame.pages[i].enableCtext:SetHeight(30) + LunaOptionsFrame.pages[i].enableCtext:SetWidth(30) + LunaOptionsFrame.pages[i].enableCtext:SetScript("OnClick", function() + local unit = this:GetParent().id + LunaUF.db.profile.units[unit].combatText.enabled = not LunaUF.db.profile.units[unit].combatText.enabled + for _,frame in pairs(LunaUF.Units.frameList) do + if frame.unitGroup == unit then + LunaUF.Units:SetupFrameModules(frame) + end + end + end) + getglobal("Enable"..LunaUF.unitList[i-1].."CombatTextText"):SetText(L["Enable"]) + + LunaOptionsFrame.pages[i].ctextscaleslider = CreateFrame("Slider", "CtextScale"..LunaUF.unitList[i-1], LunaOptionsFrame.pages[i], "OptionsSliderTemplate") + LunaOptionsFrame.pages[i].ctextscaleslider:SetMinMaxValues(1,5) + LunaOptionsFrame.pages[i].ctextscaleslider:SetValueStep(0.1) + LunaOptionsFrame.pages[i].ctextscaleslider:SetScript("OnValueChanged", function() + local unit = this:GetParent().id + LunaUF.db.profile.units[unit].combatText.size = math.floor(this:GetValue()*10)/10 + getglobal("CtextScale"..unit.."Text"):SetText("Size: "..LunaUF.db.profile.units[unit].combatText.size) + for _,frame in pairs(LunaUF.Units.frameList) do + if frame.unitGroup == unit then + LunaUF.Units:SetupFrameModules(frame) + end + end + end) + LunaOptionsFrame.pages[i].ctextscaleslider:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].ctextheader, "BOTTOMLEFT", 220, -10) + LunaOptionsFrame.pages[i].ctextscaleslider:SetWidth(200) + + LunaOptionsFrame.pages[i].ctextXslider = CreateFrame("Slider", "CtextXSlider"..LunaUF.unitList[i-1], LunaOptionsFrame.pages[i], "OptionsSliderTemplate") + LunaOptionsFrame.pages[i].ctextXslider:SetMinMaxValues(-200,200) + LunaOptionsFrame.pages[i].ctextXslider:SetValueStep(2) + LunaOptionsFrame.pages[i].ctextXslider:SetScript("OnValueChanged", function() + local unit = this:GetParent().id + LunaUF.db.profile.units[unit].combatText.xoffset = math.floor(this:GetValue()) + getglobal("CtextXSlider"..unit.."Text"):SetText("X: "..LunaUF.db.profile.units[unit].combatText.xoffset) + for _,frame in pairs(LunaUF.Units.frameList) do + if frame.unitGroup == unit then + LunaUF.Units:SetupFrameModules(frame) + end + end + end) + LunaOptionsFrame.pages[i].ctextXslider:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].ctextheader, "BOTTOMLEFT", 0, -50) + LunaOptionsFrame.pages[i].ctextXslider:SetWidth(200) + + LunaOptionsFrame.pages[i].ctextYslider = CreateFrame("Slider", "CtextYSlider"..LunaUF.unitList[i-1], LunaOptionsFrame.pages[i], "OptionsSliderTemplate") + LunaOptionsFrame.pages[i].ctextYslider:SetMinMaxValues(-200,200) + LunaOptionsFrame.pages[i].ctextYslider:SetValueStep(2) + LunaOptionsFrame.pages[i].ctextYslider:SetScript("OnValueChanged", function() + local unit = this:GetParent().id + LunaUF.db.profile.units[unit].combatText.yoffset = math.floor(this:GetValue()) + getglobal("CtextYSlider"..unit.."Text"):SetText("Y: "..LunaUF.db.profile.units[unit].combatText.yoffset) + for _,frame in pairs(LunaUF.Units.frameList) do + if frame.unitGroup == unit then + LunaUF.Units:SetupFrameModules(frame) + end + end + end) + LunaOptionsFrame.pages[i].ctextYslider:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].ctextheader, "BOTTOMLEFT", 220, -50) + LunaOptionsFrame.pages[i].ctextYslider:SetWidth(200) + + ---- + LunaOptionsFrame.pages[i].portraitheader = LunaOptionsFrame.pages[i]:CreateFontString(nil, "OVERLAY", "GameFontHighlight") - LunaOptionsFrame.pages[i].portraitheader:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].faderheader, "BOTTOMLEFT", 0, -100) + LunaOptionsFrame.pages[i].portraitheader:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].ctextheader, "BOTTOMLEFT", 0, -100) LunaOptionsFrame.pages[i].portraitheader:SetHeight(24) LunaOptionsFrame.pages[i].portraitheader:SetJustifyH("LEFT") LunaOptionsFrame.pages[i].portraitheader:SetTextColor(1,1,0) diff --git a/modules/health.lua b/modules/health.lua index c412f76c..b2ed5cb4 100644 --- a/modules/health.lua +++ b/modules/health.lua @@ -205,13 +205,13 @@ function Health:FullUpdate(frame) fontstring:SetHeight(frame.healthBar:GetHeight()) if align == "left" then fontstring:SetPoint("TOPLEFT", frame.healthBar, "TOPLEFT", 2, 0) - fontstring:SetWidth(frame.healthBar:GetWidth()/2) + fontstring:SetWidth(frame.healthBar:GetWidth()-4) elseif align == "center" then fontstring:SetAllPoints(frame.healthBar) fontstring:SetWidth(frame.healthBar:GetWidth()) else fontstring:SetPoint("TOPRIGHT", frame.healthBar, "TOPRIGHT", -2 , 0) - fontstring:SetWidth(frame.healthBar:GetWidth()/2) + fontstring:SetWidth(frame.healthBar:GetWidth()-4) end end Health:Update(frame) diff --git a/modules/power.lua b/modules/power.lua index b58a48a7..f19df5c2 100644 --- a/modules/power.lua +++ b/modules/power.lua @@ -179,13 +179,13 @@ function Power:FullUpdate(frame) fontstring:SetHeight(frame.powerBar:GetHeight()) if align == "left" then fontstring:SetPoint("TOPLEFT", frame.powerBar, "TOPLEFT", 2, 0) - fontstring:SetWidth(frame.powerBar:GetWidth()/2) + fontstring:SetWidth(frame.powerBar:GetWidth()-4) elseif align == "center" then fontstring:SetAllPoints(frame.powerBar) fontstring:SetWidth(frame.powerBar:GetWidth()) else fontstring:SetPoint("TOPRIGHT", frame.powerBar, "TOPRIGHT", -2 , 0) - fontstring:SetWidth(frame.powerBar:GetWidth()/2) + fontstring:SetWidth(frame.powerBar:GetWidth()-4) end end if frame.powerBar.ticker then