Thread Tools Display Modes
09/30/19, 10:10 PM   #1
chatrat12
Join Date: Sep 2019
Posts: 4
How to I create a top level ui element that will disable player input when visible?

I want to stop the player from being able to run around and cast spells while interacting with my UI

This is the behavior in menus. I also noticed the error frame behaves this way. I can't figure out what makes it special.

Edit: Just noticed the typo in the title, no idea how to change it xD

Last edited by chatrat12 : 09/30/19 at 10:27 PM.
  Reply With Quote
10/01/19, 07:18 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
The keywords, you are looking for, are "scene" and "fragment".

You create a new scene there your top level window (as part of a fragment) is shown. If you add additional built-in fragments, you get the behavior like the menus.

Or you register a new "dialog" (ZO_Dialogs_RegisterCustomDialog) and call ZO_Dialogs_ShowDialog

Last edited by votan : 10/01/19 at 07:25 AM.
  Reply With Quote
10/01/19, 07:23 AM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,903
Maybe th modal underlay at dialogs is also what you are looking for:
https://github.com/esoui/esoui/blob/...dialog.xml#L72

It creates something like a black transparent overlay below the modal and you cannot click anything except the shown dialog.

The code is an animation and maybe you can use it as well (self = the dialog int his case, so it could be your TopLevelControl or fragment control here):
Lua Code:
  1. if not self.animation then
  2.                 self.animation = ANIMATION_MANAGER:CreateTimelineFromVirtual("DialogModalUnderlay", self)
  3.                 end
  4.                 self.animation:PlayFromStart()
  Reply With Quote
10/01/19, 12:17 PM   #4
chatrat12
Join Date: Sep 2019
Posts: 4
Thanks for the tips!

If you add additional built-in fragments, you get the behavior like the menus.
This can't be done from a custom fragment? Is there a particular fragment I should be looking for? I'll investigate the dialog route, but I think the scene solution is probably what I'll want.

Maybe th modal underlay at dialogs is also what you are looking for:
https://github.com/esoui/esoui/blob/...dialog.xml#L72

It creates something like a black transparent overlay below the modal and you cannot click anything except the shown dialog.
Great solution, however I'm not concerned with the player clicking on other UI elements, I'm focused on the gamepad for this particular use case. I need controller inputs to only interact with UI.
  Reply With Quote
10/01/19, 12:30 PM   #5
chatrat12
Join Date: Sep 2019
Posts: 4
After looking at the scene/fragment model, I see that fragments wrap around your control. So, I don't necessarily need a custom fragment.
  Reply With Quote
10/02/19, 02:53 AM   #6
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by chatrat12 View Post
After looking at the scene/fragment model, I see that fragments wrap around your control. So, I don't necessarily need a custom fragment.
All the fragment "classes" you need are already there. For you own top level you need your own ZO_FadeSceneFragment "instance".
To stop all movement you can re-use STOP_MOVEMENT_FRAGMENT instance.
  Reply With Quote
10/03/19, 05:27 PM   #7
chatrat12
Join Date: Sep 2019
Posts: 4
Thanks for the help! I've been trying to add the ability to press a button while a redial menu is open to quickly set the selected entry. Adding some of the standard UI fragments got me the behavior I wanted

Lua Code:
  1. -- Create scenes
  2. local gamepadSceneName = "pw_radial_menu_keybind_strip_gamepad"
  3. local gamepadScene = ZO_Scene:New(gamepadSceneName, SCENE_MANAGER)
  4.  
  5. local keyboardSceneName = "pw_radial_menu_keybind_strip_keyboard"
  6. local keyboardScene = ZO_Scene:New(keyboardSceneName, SCENE_MANAGER)
  7.  
  8.  
  9. -- Add fragments to scenes
  10. gamepadScene:AddFragment(GAMEPAD_UI_MODE_FRAGMENT)
  11. gamepadScene:AddFragment(UI_SHORTCUTS_ACTION_LAYER_FRAGMENT)
  12. gamepadScene:AddFragmentGroup(FRAGMENT_GROUP.GAMEPAD_KEYBIND_STRIP_GROUP)
  13.  
  14. keyboardScene:AddFragment(HIDE_MOUSE_FRAGMENT)
  15. keyboardScene:AddFragment(UI_SHORTCUTS_ACTION_LAYER_FRAGMENT)
  16. keyboardScene:AddFragmentGroup(FRAGMENT_GROUP.KEYBOARD_KEYBIND_STRIP_GROUP)
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » How to I create a top level ui element that will disable player input when visible?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off