vikinghug / VikingUI

A fork of VikingUI
3 stars 5 forks source link

Unit Frame - hook into interface options for visibility #27

Open sevelev opened 9 years ago

sevelev commented 9 years ago

Also, when "show in combat" is chosen, show the player frame when casting as well so you can see your cast bar when interacting with objects or mounting. I added this code to have the player frame only show when in combat and casting. it also stays visible after combat until the health bar is full:

function VikingUnitFrames:UpdateUnitFrame(tFrame, unit)

tFrame.wndUnitFrame:Show(unit ~= nil)

if unit ~= nil then self:SetUnit(tFrame, unit) self:SetUnitName(tFrame, unit:GetName()) self:SetClass(tFrame) end

local unitPlayer = GameLib.GetPlayerUnit() local nCasting = unitPlayer:ShouldShowCastBar() local bInCombat = unitPlayer:IsInCombat()

if unitPlayer == nil then return end

if unitPlayer:GetMaxHealth() == unitPlayer:GetHealth() and not bInCombat and not nCasting then self.tPlayerFrame.wndUnitFrame:Show(false) else self.tPlayerFrame.wndUnitFrame:Show(true) end end

mkaito commented 9 years ago

I have yet to look at the settings pane. It's kind of scary :stuck_out_tongue:

If you could put that in a pull request we can look at getting it in.

sevelev commented 9 years ago

I can't get it hooked into the default interface settings for visibility or the Viking settings. I have only figured out how to have it set to show in combat, during casting and when the health isn't full. So, it's not really ready for a pull until someone can figure out how to get the hook working.

mkaito commented 9 years ago

I will see if I can figure out how Settings and Library work, to give you a config option to hook into.