ESOUI SVN TaosGroupUltimate

[/] [trunk/] [TaosGroupUltimate/] [ui/] [UltimateGroupMenu.lua] - Rev 27

Go to most recent revision | Compare with Previous | Blame | View Log

--[[
        Addon: Taos Group Ultimate
        Author: TProg Taonnor
        Created by @Taonnor
]]--

--[[
        Global variables
]]--
local LOG_ACTIVE = false

--[[
        Class UltimateGroupMenu
]]--
UltimateGroupMenu = {}
UltimateGroupMenu.__index = UltimateGroupMenu

--[[
        Class Members
]]--

--[[
        SetUltimateGroup shows ultimate group menu
]]--
function UltimateGroupMenu.SetUltimateGroup(group, arg)
    if (LOG_ACTIVE) then 
        logTrace("UltimateGroupMenu.ShowUltimateGroupMenu")
        logDebug("group.GroupName: " .. group.GroupName, arg)
    end

    CALLBACK_MANAGER:FireCallbacks("TGU-SetUltimateGroup", group, arg)
end

--[[
        ShowUltimateGroupMenu shows ultimate group menu
]]--
function UltimateGroupMenu.ShowUltimateGroupMenu(control, arg)
    if (LOG_ACTIVE) then 
        logTrace("UltimateGroupMenu.ShowUltimateGroupMenu")
        logDebug(control, arg)
    end

    if (control ~= nil) then
        ClearMenu()

        local ultimateGroups = UltimateGroupHandler.GetUltimateGroups()

        for i, group in pairs(ultimateGroups) do
            AddMenuItem(group.GroupName .. " - " .. group.GroupDescription, function() UltimateGroupMenu.SetUltimateGroup(group, arg) end)
        end

        ShowMenu(control)
    else
        logError("UltimateGroupMenu.ShowUltimateGroupMenu, control nil")
    end
end

--[[
        Initialize initializes UltimateGroupMenu
]]--
function UltimateGroupMenu.Initialize()
    if (LOG_ACTIVE) then 
        logTrace("UltimateGroupMenu.Initialize")
    end

    CALLBACK_MANAGER:RegisterCallback("TGU-ShowUltimateGroupMenu", UltimateGroupMenu.ShowUltimateGroupMenu)
end

Go to most recent revision | Compare with Previous | Blame