use of io.xol.chunkstories.gui.layer.ingame.ConnectionOverlay in project chunkstories by Hugobros3.
the class ServerSelection method login.
// Takes care of connecting to a server
private void login() {
String ip = ipForm.getText();
int port = 30410;
if (ip.length() == 0)
return;
Client.getInstance().getConfiguration().getOption("client.game.last-server").trySetting(ip);
Client.getInstance().getConfiguration().save();
if (ip.contains(":")) {
port = Integer.parseInt(ip.split(":")[1]);
ip = ip.split(":")[0];
}
// Client.world = null;
gameWindow.setLayer(new ConnectionOverlay(gameWindow, this, ip, port));
}
use of io.xol.chunkstories.gui.layer.ingame.ConnectionOverlay 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