WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Multiple styles in one layout (https://www.wowinterface.com/forums/showthread.php?t=21865)

zork 04-08-09 07:33 AM

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)


haste 04-09-09 08:12 AM

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.


All times are GMT -6. The time now is 07:14 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI