target: add option to bypass initial animation

This commit is contained in:
shagu
2016-12-31 18:08:02 +01:00
parent de5e62f731
commit 79ab3ee0b3
3 changed files with 11 additions and 7 deletions
+1
View File
@@ -56,6 +56,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "player", "buffs", "top")
pfUI:UpdateConfig("unitframes", "player", "energy", "1")
pfUI:UpdateConfig("unitframes", "target", "animation", "0")
pfUI:UpdateConfig("unitframes", "target", "width", "200")
pfUI:UpdateConfig("unitframes", "target", "height", "50")
pfUI:UpdateConfig("unitframes", "target", "pheight", "10")
+1
View File
@@ -865,6 +865,7 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Show energy ticks", pfUI_config.unitframes.player, "energy", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target", nil, nil, "header")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable target switch animation", pfUI_config.unitframes.target, "animation")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health width", pfUI_config.unitframes.target, "width")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health height", pfUI_config.unitframes.target, "height")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Powerbar height", pfUI_config.unitframes.target, "pheight")
+9 -7
View File
@@ -232,6 +232,13 @@ pfUI:RegisterModule("target", function ()
pfUI.uf.target.hpReal = hp
pfUI.uf.target.powerReal = power
pfUI.uf.target.tapped = nil
-- bypass animation
if event == "PLAYER_TARGET_CHANGED" and (pfUI.uf.target.noanim == "yes" or pfUI_config.unitframes.target.animation == "0") then
pfUI.uf.target.hp.bar:SetValue(hp)
pfUI.uf.target.power.bar:SetValue(power)
pfUI.uf.target.noanim = "no"
end
end
end)
@@ -242,9 +249,7 @@ pfUI:RegisterModule("target", function ()
local hpReal = pfUI.uf.target.hpReal
local hpDiff = abs(hpReal - hpDisplay)
if pfUI.uf.target.noanim == "yes" then
pfUI.uf.target.hp.bar:SetValue(hpReal)
elseif hpDisplay < hpReal then
if hpDisplay < hpReal then
pfUI.uf.target.hp.bar:SetValue(hpDisplay + ceil(hpDiff / pfUI_config.unitframes.animation_speed))
elseif hpDisplay > hpReal then
pfUI.uf.target.hp.bar:SetValue(hpDisplay - ceil(hpDiff / pfUI_config.unitframes.animation_speed))
@@ -254,15 +259,12 @@ pfUI:RegisterModule("target", function ()
local powerReal = pfUI.uf.target.powerReal
local powerDiff = abs(powerReal - powerDisplay)
if pfUI.uf.target.noanim == "yes" then
pfUI.uf.target.power.bar:SetValue(powerReal)
elseif powerDisplay < powerReal then
if powerDisplay < powerReal then
pfUI.uf.target.power.bar:SetValue(powerDisplay + ceil(powerDiff / pfUI_config.unitframes.animation_speed))
elseif powerDisplay > powerReal then
pfUI.uf.target.power.bar:SetValue(powerDisplay - ceil(powerDiff / pfUI_config.unitframes.animation_speed))
end
pfUI.uf.target.noanim = "no"
if not pfUI.uf.target.tapped and UnitIsTapped("target") and not UnitIsTappedByPlayer("target") then
pfUI.uf.target.hp.bar:SetStatusBarColor(.5,.5,.5,.5)