UpdateHealth(this.unit, this.uf) |
end |
|
local StufDD = CreateFrame("Frame", "StufDD", UIParent, "UIDropDownMenuTemplate") |
StufDD:SetHeight(10) |
StufDD:SetWidth(10) |
StufDD:SetPoint("TOP") |
tinsert(UnitPopupFrames, "StufDD") |
local function StufDDInit() |
local unitid = StufDD.unit or "player" |
local menu, name, id |
|
if UnitIsUnit(unitid, "player") then |
menu = "SELF" |
elseif UnitIsUnit(unitid, "pet") then |
menu = "PET" |
elseif UnitIsPlayer(unitid) then |
id = UnitInRaid(unitid) |
if id then |
menu = "RAID_PLAYER" |
elseif UnitInParty(unitid) then |
menu = "PARTY" |
else |
menu = "PLAYER" |
end |
else |
menu = "RAID_TARGET_ICON" |
name = RAID_TARGET_ICON |
end |
if menu then |
UnitPopup_ShowMenu(StufDD, menu, unitid, name, id) |
end |
end |
local function ShowUnitMenu(self, unit, button, actionType) |
unit = unit or SecureButton_GetUnit(self) |
StufDD.unit = unit |
|
if unit then |
HideDropDownMenu(1) |
StufDD.id = strmatch(unit, "(%d+)") |
StufDD.displayMode = "MENU" |
|
StufDD.initialize = StufDDInit |
|
if not anchor then |
if self.statsFrame then |
anchor = self.statsFrame:GetName() |
elseif self:GetParent().statsFrame then |
anchor = self:GetParent().statsFrame:GetName() |
end |
end |
|
local parent = self |
if self:GetParent() and self:GetParent().nameFrame == self then |
parent = self:GetParent() |
end |
|
ToggleDropDownMenu(1, nil, StufDD, parent, 0, 0) |
end |
end |
local function postClick(self) |
if UIDROPDOWNMENU_OPEN_MENU == self.dropdownMenu and DropDownList1:IsShown() then |
local parent = self |
if self:GetParent() and self:GetParent().nameFrame == self then |
parent = self:GetParent() |
end |
local point, relativePoint |
if (parent:GetTop() * parent:GetEffectiveScale() > UIParent:GetHeight() * UIParent:GetEffectiveScale() / 2) then |
point, relativePoint = "TOPLEFT", "BOTTOMLEFT" |
else |
point, relativePoint = "BOTTOMLEFT", "TOPLEFT" |
end |
|
DropDownList1:ClearAllPoints() |
DropDownList1:SetPoint(point, parent, relativePoint, 0, 0) |
end |
end |
|
--------------------------------------------- |
function Stuf:CreateUnitFrame(unit, fromshow) -- creates entire unit frame and updates its settings |
--------------------------------------------- |