use of io.xol.chunkstories.world.WorldClientCommon in project chunkstories by Hugobros3.
the class Client method changeWorld.
@Override
public void changeWorld(WorldClient world2) {
WorldClientCommon world = (WorldClientCommon) world2;
Runnable job = new Runnable() {
@Override
public void run() {
// Setup the new world and make a controller for it
Client.this.world = world;
player = new PlayerClientImplementation(Client.this, world);
// Change the scene
Ingame ingameScene = new Ingame(gameWindow, world);
// We want to keep the connection overlay when getting into a server
if (gameWindow.getLayer() instanceof ConnectionOverlay) {
ConnectionOverlay overlay = (ConnectionOverlay) gameWindow.getLayer();
// If that happen, we want this connection overlay to forget he was originated from a server browser or whatever
overlay.setParentScene(ingameScene);
} else
gameWindow.setLayer(ingameScene);
// Switch scene but keep the overlay
// ingameScene.changeOverlay(overlay);
// Start only the logic after all that
world.startLogic();
}
};
if (gameWindow.isInstanceMainGLWindow())
job.run();
else {
Fence fence = gameWindow.queueSynchronousTask(job);
fence.traverse();
}
}
Aggregations