Thread Tools Display Modes
04-08-09, 07:33 AM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Multiple styles in one layout?

I a not sure, is this the correct way to implement multiple styles in one layout? Under the premission I want to use one style func for each spawn. I know that I could just use one style func with unit conditions, but I want to split the unit spawn in different style funcs that might call the same functions (create_me_a_castbar etc.) or not, depending on how I set up the style.

Code:
  
  local function CreatePlayerStyle(self, unit)
    --do stuff
  end
  
  local function CreateTargetStyle(self, unit)
    --do stuff
  end
  
  local function CreateTargetTargetStyle(self, unit)
    --do stuff
  end
  
  local function CreateFocusStyle(self, unit)
    --do stuff
  end

  local function CreatePetStyle(self, unit)
    --do stuff
  end
  
  oUF:RegisterStyle("player", CreatePlayerStyle)
  oUF:RegisterStyle("target", CreateTargetStyle)
  oUF:RegisterStyle("tot", CreateTargetTargetStyle)
  oUF:RegisterStyle("focus", CreateFocusStyle)
  oUF:RegisterStyle("pet", CreatePetStyle)  
  
  oUF:SetActiveStyle("player")
  oUF:Spawn("player", "oUF_player"):SetPoint("CENTER", 0, 0)
  
  oUF:SetActiveStyle("target")
  oUF:Spawn("target", "oUF_target"):SetPoint("CENTER", 0, 0)
  
  oUF:SetActiveStyle("tot")
  oUF:Spawn("targettarget", "ouf_tot"):SetPoint("CENTER", 0, 0)
  
  oUF:SetActiveStyle("focus")
  oUF:Spawn("focus", "oUF_focus"):SetPoint("CENTER", 0, 0)
  
  oUF:SetActiveStyle("pet")
  oUF:Spawn("pet", "oUF_pet"):SetPoint("CENTER", 0, 0)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 04-08-09 at 08:10 AM.
  Reply With Quote
04-09-09, 08:12 AM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Yes, that's how it should be done .

I would recommend you to use a less general name however. It wouldn't surprise me if you got a collision with another layout with those style names.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Multiple styles in one layout


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off