Search in sources :

Example 1 with LoadingScreen

use of org.terasology.engine.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();
    headless = context.get(DisplayDevice.class).isHeadless();
    CoreRegistry.setContext(context);
    systemConfig = context.get(SystemConfig.class);
    if (!headless) {
        this.nuiManager = new NUIManagerInternal((TerasologyCanvasRenderer) 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();
    if (nuiManager != null) {
        loadingScreen = nuiManager.pushScreen("engine:loadingScreen", LoadingScreen.class);
        loadingScreen.updateStatus(current.getMessage(), current.getProgress());
    }
    chunkGenerationStarted = false;
}
Also used : SystemConfig(org.terasology.engine.config.SystemConfig) Game(org.terasology.engine.game.Game) CanvasRenderer(org.terasology.nui.canvas.CanvasRenderer) TerasologyCanvasRenderer(org.terasology.engine.rendering.nui.internal.TerasologyCanvasRenderer) EngineTime(org.terasology.engine.core.EngineTime) EngineTime(org.terasology.engine.core.EngineTime) Time(org.terasology.engine.core.Time) LoadingScreen(org.terasology.engine.rendering.nui.layers.mainMenu.loadingScreen.LoadingScreen) TerasologyCanvasRenderer(org.terasology.engine.rendering.nui.internal.TerasologyCanvasRenderer) NUIManagerInternal(org.terasology.engine.rendering.nui.internal.NUIManagerInternal)

Aggregations

SystemConfig (org.terasology.engine.config.SystemConfig)1 EngineTime (org.terasology.engine.core.EngineTime)1 Time (org.terasology.engine.core.Time)1 Game (org.terasology.engine.game.Game)1 NUIManagerInternal (org.terasology.engine.rendering.nui.internal.NUIManagerInternal)1 TerasologyCanvasRenderer (org.terasology.engine.rendering.nui.internal.TerasologyCanvasRenderer)1 LoadingScreen (org.terasology.engine.rendering.nui.layers.mainMenu.loadingScreen.LoadingScreen)1 CanvasRenderer (org.terasology.nui.canvas.CanvasRenderer)1