Search in sources :

Example 6 with UIScreenLayer

use of org.terasology.engine.rendering.nui.UIScreenLayer in project Terasology by MovingBlocks.

the class NUIManagerInternal method invalidate.

@Override
public void invalidate() {
    assetManager.getLoadedAssets(UIElement.class).forEach(UIElement::dispose);
    boolean hudVisible = isHUDVisible();
    if (hudVisible) {
        setHUDVisible(false);
    }
    Deque<ResourceUrn> reverseUrns = new LinkedList<>();
    Map<UIScreenLayer, ResourceUrn> inverseLookup = screenLookup.inverse();
    for (UIScreenLayer screen : screens) {
        screen.onClosed();
        reverseUrns.addFirst(inverseLookup.get(screen));
    }
    screens.clear();
    screenLookup.clear();
    reverseUrns.forEach(this::pushScreen);
    if (hudVisible) {
        setHUDVisible(true);
    }
}
Also used : UIElement(org.terasology.nui.asset.UIElement) ResourceUrn(org.terasology.gestalt.assets.ResourceUrn) UIScreenLayer(org.terasology.engine.rendering.nui.UIScreenLayer) LinkedList(java.util.LinkedList)

Aggregations

UIScreenLayer (org.terasology.engine.rendering.nui.UIScreenLayer)6 ResourceUrn (org.terasology.gestalt.assets.ResourceUrn)2 ControlWidget (org.terasology.nui.ControlWidget)2 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 InputSystem (org.terasology.engine.input.InputSystem)1 UIElement (org.terasology.nui.asset.UIElement)1