Search in sources :

Example 1 with LoadingScreen

use of org.terasology.rendering.nui.layers.mainMenu.loadingScreen.LoadingScreen in project Terasology by MovingBlocks.

the class StateLoading method init.

@Override
public void init(GameEngine engine) {
    this.context = engine.createChildContext();
    CoreRegistry.setContext(context);
    this.nuiManager = new NUIManagerInternal(context.get(CanvasRenderer.class), context);
    context.put(NUIManager.class, nuiManager);
    EngineTime time = (EngineTime) context.get(Time.class);
    time.setPaused(true);
    time.setGameTime(gameManifest.getTime());
    context.get(Game.class).load(gameManifest);
    switch(netMode) {
        case CLIENT:
            initClient();
            break;
        default:
            initHost();
            break;
    }
    progress = 0;
    maxProgress = 0;
    for (LoadProcess process : loadProcesses) {
        maxProgress += process.getExpectedCost();
    }
    popStep();
    loadingScreen = nuiManager.pushScreen("engine:loadingScreen", LoadingScreen.class);
    loadingScreen.updateStatus(current.getMessage(), current.getProgress());
}
Also used : Game(org.terasology.game.Game) EngineTime(org.terasology.engine.EngineTime) Time(org.terasology.engine.Time) EngineTime(org.terasology.engine.EngineTime) LoadingScreen(org.terasology.rendering.nui.layers.mainMenu.loadingScreen.LoadingScreen) NUIManagerInternal(org.terasology.rendering.nui.internal.NUIManagerInternal)

Aggregations

EngineTime (org.terasology.engine.EngineTime)1 Time (org.terasology.engine.Time)1 Game (org.terasology.game.Game)1 NUIManagerInternal (org.terasology.rendering.nui.internal.NUIManagerInternal)1 LoadingScreen (org.terasology.rendering.nui.layers.mainMenu.loadingScreen.LoadingScreen)1