ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   How to I create a top level ui element that will disable player input when visible? (https://www.esoui.com/forums/showthread.php?t=8781)

chatrat12 09/30/19 10:10 PM

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

votan 10/01/19 07:18 AM

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

Baertram 10/01/19 07:23 AM

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()

chatrat12 10/01/19 12:17 PM

Thanks for the tips!

Quote:

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.

Quote:

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.

chatrat12 10/01/19 12:30 PM

After looking at the scene/fragment model, I see that fragments wrap around your control. So, I don't necessarily need a custom fragment.

votan 10/02/19 02:53 AM

Quote:

Originally Posted by chatrat12 (Post 39328)
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.

chatrat12 10/03/19 05:27 PM

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 :D

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)


All times are GMT -6. The time now is 12:03 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI