Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New NUI widgets (EmptyIfInvisibleContainer, UIBackingBox and UILabelledIcon) #664

Conversation

BenjaminAmos
Copy link
Contributor

@BenjaminAmos BenjaminAmos commented Sep 18, 2022

Description

This pull request adds some now NUI widgets that will be used in when porting the remaining built-in UI screens to use NUI. It also makes some minor changes to the default UILoadBar style, which was unnecesarily constraining the size of load bars.

EmptyIfInvisibleContainer

This widget acts like a standard wrapper container, with the special case that if either its contents is empty or invisible, then it will report its own size as zero.

UIBackingBox

This widget acts like a standard UIBox, with the added functionality of consuming all mouse click events targeted within its area. This prevents mouse click events from propagating to layers beneath the box.

UILabelledIcon

This widget allows the user to display an icon alongside a descriptive label, such as might be used in a HUD to display brief player statistics, The icon can be placed either to the left or the right of the label.

Testing

  • There are some basic test screens for this in my temporary nuiExperiments module. You'll need to fetch that into your workspace first. When asked to open a screen, open it using the showNUIScreen <screenUrn> command.

EmptyIfInvisibleContainer

  • Open the nuiExperiments:emptyIfInvisibleContainers screen.
  • Toggle the Show checkbox off.
  • One of the buttons should become invisible.
  • When the button is invisible, all adjacent buttons should shift along to fill the space previously occupied by that button.
  • Toggle the Show checkbox on.
  • One of the buttons should become visible again.

UIBackingBox

  • Open the nuiExperiments:uiBackingBoxes screen.
  • Try clicking on the background (outside of any boxes). The background click counter should increase.
  • Try clicking on the blue box. The background click counter should still increase.
  • Try clicking on the black box. The background click counter should not increase.

UILabelledIcon

  • Open the nuiExperiments:uiLabelledIcons screen.
  • There should be three labels present. One with an icon to the left of it, the other with an icon to its right and at the top a label with no icon associated.

Notes

  • The UIBackingBox test is unlikely to succeed without General NUI Fixes #663, since it fixes mouse events previously not being consumed.
  • The game may crash when closing a screen with the escape key. This is an unrelated issue regarding NUI screens outside of the engine not being correctly injected.

This widget will return an empty size for itself if its wrapped child is invisible.
The UIBackingBox widget will consume all click/double-click events it receives, to prevent propagating those events to screens behind it.
This widget displays a label with an associated icon next to it.
@BenjaminAmos BenjaminAmos changed the title Nui screen conversion/new widgets New NUI widgets (EmptyIfInvisibleContainer, UIBackingBox and UILabelledIcon) Sep 18, 2022
@BenjaminAmos BenjaminAmos merged commit 100f122 into MovingBlocks:develop Oct 16, 2022
@BenjaminAmos BenjaminAmos deleted the nui-screen-conversion/new-widgets branch October 16, 2022 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant