View Single Post
08/17/20, 06:10 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
If you ONLY need to detect if someone got the main menu opened (the one at the left if you press ESC) I think you need to do it like you did with the explicit check for the scene / or a fragment.
Lua Code:
  1. local function sceneChange(sceneName, oldState, newState)
  2.     if (newState == SCENE_SHOWN) then
  3.         -- do stuff
  4.     elseif (newState == SCENE_HIDDEN) then
  5.         -- do stuff
  6.     end
  7. end
  8.  
  9. local scene = SCENE_MANAGER:GetScene("gameMenuInGame")
  10. scene:RegisterCallback("StateChange", sceneChange)
Or directly use the global GAME_MENU_SCENE (https://github.com/esoui/esoui/blob/...ngame.lua#L132) to register the StateChange callback function.


If you want to detect if ANY menu was opened (e.g. also if you open the inventory and the top bar menu is shown) you'd need to register a callback function to the HUD_SCENE and/or HUD_UI_SCENE 's "StateChange" like described here:
https://wiki.esoui.com/Scene_Manager:_On_scene_change

Last edited by Baertram : 08/17/20 at 06:14 AM.
  Reply With Quote