Search in sources :

Example 1 with RespawnRequestEvent

use of org.terasology.logic.players.event.RespawnRequestEvent in project Terasology by MovingBlocks.

the class DeathScreen method initialise.

@Override
public void initialise() {
    deathDetails = find("deathDetails", UILabel.class);
    WidgetUtil.trySubscribe(this, "respawn", widget -> {
        CoreRegistry.get(LocalPlayer.class).getClientEntity().send(new RespawnRequestEvent());
        getManager().closeScreen(DeathScreen.this);
    });
    WidgetUtil.trySubscribe(this, "settings", widget -> getManager().pushScreen("settingsMenuScreen"));
    WidgetUtil.trySubscribe(this, "mainMenu", widget -> {
        CoreRegistry.get(LocalPlayer.class).getClientEntity().send(new RespawnRequestEvent());
        CoreRegistry.get(GameEngine.class).changeState(new StateMainMenu());
    });
    WidgetUtil.trySubscribe(this, "exitGame", widget -> CoreRegistry.get(GameEngine.class).shutdown());
}
Also used : UILabel(org.terasology.rendering.nui.widgets.UILabel) RespawnRequestEvent(org.terasology.logic.players.event.RespawnRequestEvent) StateMainMenu(org.terasology.engine.modes.StateMainMenu) GameEngine(org.terasology.engine.GameEngine)

Aggregations

GameEngine (org.terasology.engine.GameEngine)1 StateMainMenu (org.terasology.engine.modes.StateMainMenu)1 RespawnRequestEvent (org.terasology.logic.players.event.RespawnRequestEvent)1 UILabel (org.terasology.rendering.nui.widgets.UILabel)1