Lua Code:
--create scene which I can add to the main menu:
local tlw, texture
tlw = WINDOW_MANAGER:CreateTopLevelWindow()
tlw:SetDimensions(128,128)
tlw:SetAnchor(CENTER, GuiRoot, CENTER, 0, 0)
tlw:SetHidden(true)
texture = WINDOW_MANAGER:CreateControl(nil, tlw, CT_TEXTURE)
texture:SetTexture("/esoui/art/icons/poi/poi_groupboss_complete.dds")
texture:SetAnchorFill(tlw)
local fragment = ZO_FadeSceneFragment:New(tlw)
local myAddonScene = ZO_Scene:New("myAddonScene", SCENE_MANAGER)
myAddonScene:AddFragmentGroup(FRAGMENT_GROUP.UI_WINDOW) --standard UI elements such as mouse or keybind strap
myAddonScene:AddFragment(fragment)
--code for main menu category starts here:
local binding = "TOGGLE_MY_ADDON"
local categoryIndex = #MAIN_MENU.categoryInfo + 1
local categoryName = "MY_CATEGORY_NAME"
--create string indexes
ZO_CreateStringId("SI_BINDING_NAME_" .. binding, "Toggle my category")
ZO_CreateStringId(categoryName, "My addon category")
--layout for category button
local categoryLayoutInfo = {
binding = binding,
categoryName = categoryName,
callback = function() MAIN_MENU:OnCategoryClicked(categoryIndex) end,
descriptor = categoryIndex,
normal = "EsoUI/Art/WorldMap/map_indexIcon_key_up.dds",
pressed = "EsoUI/Art/WorldMap/map_indexIcon_key_down.dds",
disabled = "EsoUI/Art/WorldMap/map_indexIcon_key_up.dds", --I do not have disabled icon :-(
highlight = "EsoUI/Art/WorldMap/map_indexIcon_key_over.dds",
}
--add category button
ZO_MenuBar_AddButton(MAIN_MENU.categoryBar, categoryLayoutInfo)
--create subcategory bar, support for function MAIN_MENU:AddSceneGroup(categoryIndex, sceneGroupName, iconData)
local subcategoryBar = CreateControlFromVirtual("ZO_MainMenuSubcategoryBar", MAIN_MENU.control, "ZO_MainMenuSubcategoryBar", i)
subcategoryBar:SetAnchor(TOP, MAIN_MENU.categoryBar, BOTTOM, 0, 7)
local subcategoryBarFragment = ZO_FadeSceneFragment:New(subcategoryBar)
MAIN_MENU.categoryInfo[categoryIndex] = {
barControls = {},
subcategoryBar = subcategoryBar,
subcategoryBarFragment = subcategoryBarFragment,
}
--add scene to the main menu category
MAIN_MENU:AddScene(categoryIndex, "myAddonScene")