View Single Post
12-01-14, 01:04 PM   #12
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 328
Originally Posted by Phanx View Post
You should just be able to set the scale once anywhere, even in the main chunk of your addon:
I tried this before and it threw up errors. I will try once more.

Originally Posted by Phanx View Post
(On a side note, that's a very specific scale value. o_O)
This seems to be the size NeavUi was and it seems to work for me

would I be able to put all this:
Code:
-- Player Frame
PlayerFrame:SetScale(ns.unitframesPlayerScale)
CastingBarFrame:SetScale(ns.unitframesCastbarScale)
hooksecurefunc("PlayerFrame_UpdateLevelTextAnchor", function(level)
  if ( level >= 100 ) then
    PlayerLevelText:SetPoint("CENTER", PlayerFrameTexture, "CENTER", -61, -15);
  else
    PlayerLevelText:SetPoint("CENTER", PlayerFrameTexture, "CENTER", -61, -15);
  end
end)

-- Target Frame
TargetFrame:SetScale(ns.unitframesTargetScale)
hooksecurefunc("TargetFrame_UpdateLevelTextAnchor",  function(self, targetLevel)
  if ( targetLevel >= 100 ) then
    self.levelText:SetPoint("CENTER", 62, -15);
  else
    self.levelText:SetPoint("CENTER", 62, -15);
  end
end)

-- Focus Frame
FocusFrame:SetScale(ns.unitframesFocusScale)


-- Party
hooksecurefunc("PartyMemberFrame_UpdateMember", function(self)
	if self:IsShown() then
		for i = 1, MAX_PARTY_MEMBERS do
			_G["PartyMemberFrame"..i]:SetScale(ns.unitframesPartyScale)
		end	
		PartyMemberFrame1:SetPoint(db.unitframes.party.position.relAnchor, UIParent, db.unitframes.party.position.offSetX, db.unitframes.party.position.offSetY);
	end
end)
	
if not ArenaEnemyFrame1 then
	return true
end

-- Arena
for i = 1, MAX_ARENA_ENEMIES do
	_G["ArenaPrepFrame"..i]:SetScale(ns.unitframesArenaScale)
	_G["ArenaEnemyFrame"..i]:SetScale(ns.unitframesArenaScale)
end	

-- Boss
if (event == "INSTANCE_ENCOUNTER_ENGAGE_UNIT") then
	for i = 1, MAX_BOSS_FRAMES do
		_G["Boss"..i.."TargetFrame"]:SetScale(ns.unitframesBossScale)
	end
end
Into a hooksecurfunc like
Code:
hooksecurefunc("UnitFrame_Update",  function(self, level, targetLevel, isParty, isBossFrame)
 -- code here
end)
Just wondering if it would make things work smoother?

Coke
  Reply With Quote