player: clean up dropdown code

This commit is contained in:
shagu
2017-07-07 18:02:55 +02:00
parent 13272adc85
commit 587b175e91
2 changed files with 8 additions and 7 deletions
+3 -1
View File
@@ -991,7 +991,9 @@ function pfUI.uf:ClickAction(button)
-- dropdown menues
if button == "RightButton" then
if label == "player" then
ToggleDropDownMenu(1, nil, pfUI.uf.player.Dropdown,"cursor")
UIDropDownMenu_Initialize(PlayerFrameDropDown, pfUI.uf.player.dropdown.Init, "MENU")
pfUI.uf.player.dropdown.rebuild = true
ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "cursor")
elseif label == "target" then
ToggleDropDownMenu(1, nil, TargetFrameDropDown, "cursor")
elseif label == "pet" then
+5 -6
View File
@@ -40,15 +40,14 @@ pfUI:RegisterModule("player", function ()
pfUI.uf.player:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOM", -75, 125)
UpdateMovable(pfUI.uf.player)
pfUI.uf.player.Dropdown = getglobal("PlayerFrameDropDown")
function pfUI.uf.player.Dropdowni()
-- add reset button when alone
if not (UnitInRaid("player") or GetNumPartyMembers() > 0) then
pfUI.uf.player.dropdown = {}
function pfUI.uf.player.dropdown:Init()
UnitPopup_ShowMenu(PlayerFrameDropDown, "SELF", "player")
if pfUI.uf.player.dropdown.rebuild and not CanShowResetInstances() then
UIDropDownMenu_AddButton({text = RESET_INSTANCES, func = ResetInstances, notCheckable = 1}, 1)
pfUI.uf.player.dropdown.rebuild = nil
end
UnitPopup_ShowMenu(pfUI.uf.player.Dropdown, "SELF", "player")
end
UIDropDownMenu_Initialize(pfUI.uf.player.Dropdown, pfUI.uf.player.Dropdowni, "MENU")
pfUI.uf.player:RegisterEvent("UPDATE_FACTION") -- pvp icon
pfUI.uf.player:RegisterEvent("UNIT_FACTION") -- pvp icon