View Single Post
08-29-11, 06:52 PM   #23
dreamcatcher
A Black Drake
 
dreamcatcher's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2010
Posts: 82
If there is a way I can tie in all the skinning to one Then maybe I can do it like you say. I don't know. Still learning this stuff.

This is the whole code for the buttons.
Code:
function Style(self)  
	local name = self:GetName()
	local action = self.action
	local Button = self
	local Count = _G[name.."Count"]
	local HotKey = _G[name.."HotKey"]
	local Border  = _G[name.."Border"]
	local Btname = _G[name.."Name"]
	local Normal  = _G[name.."NormalTexture"]

	Button:SetNormalTexture[[Interface\AddOns\DreamTweaks\Media\button]]
	Border:Hide()
	
end

function StyleShapeshift()
	for i = 1, NUM_SHAPESHIFT_SLOTS do
	local name = "ShapeshiftButton"..i
	local Button = _G[name]
	local Border  = _G[name.."Border"]
	Button:SetNormalTexture[[Interface\AddOns\DreamTweaks\Media\button]]
	Border:Hide()
	end
end

function StylePet()
	for i = 1, NUM_PET_ACTION_SLOTS do
	local name = "PetActionButton"..i
	local Button = _G[name]
	local Border  = _G[name.."Border"]
	Button:SetNormalTexture[[Interface\AddOns\DreamTweaks\Media\button]]
	Border:Hide()
	end
end

function ActionButton_OnUpdate(self, elapsed)
	local rangeTimer = self.rangeTimer
	if (rangeTimer) then
	rangeTimer = rangeTimer - elapsed
	if (rangeTimer <= 0) then
	local isInRange = false
	if (ActionHasRange(self.action) and IsActionInRange(self.action) == 0) then
	_G[self:GetName()..'Icon']:SetVertexColor( 0.9, 0, 0 )
	isInRange = true
	end
	if (self.isInRange ~= isInRange) then
	self.isInRange = isInRange
	ActionButton_UpdateUsable(self)
	end
	rangeTimer = TOOLTIP_UPDATE_TIME
	end
	self.rangeTimer = rangeTimer
	end
end

hooksecurefunc('ActionButton_Update', function(self)
        for _, icon in pairs({
            self:GetName(),
            'MultiCastRecallSpellButton',
            'MultiCastSummonSpellButton',
        }) do
        local macroname = _G[self:GetName()..'Name']
        if db.HideMacronames then
            macroname:SetAlpha(0)
		else
            macroname:SetAlpha(1)
		end
	end
end)

function DreamTweaks:UpdateStuff()

	hooksecurefunc("ActionButton_Update", Style)
	hooksecurefunc("PetActionBar_Update", StylePet)
	hooksecurefunc("ShapeshiftBar_Update", StyleShapeshift)

end
  Reply With Quote