loading screen
This commit is contained in:
parent
987ed4059e
commit
d4f6d3e4f9
6 changed files with 139 additions and 95 deletions
|
@ -147,7 +147,6 @@ import game.window.WindowEvent;
|
|||
import game.world.BlockPos;
|
||||
import game.world.BoundingBox;
|
||||
import game.world.Chunk;
|
||||
import game.world.Converter;
|
||||
import game.world.Facing;
|
||||
import game.world.HitPosition;
|
||||
import game.world.HitPosition.ObjectType;
|
||||
|
@ -427,7 +426,7 @@ public class Game implements IThreadListener {
|
|||
|
||||
public void connectToIntegrated(Server server, String user) {
|
||||
this.debugWorld = server.getFolder() == null;
|
||||
this.displayGuiScreen(null);
|
||||
// this.displayGuiScreen(null);
|
||||
SocketAddress socket = server.setLocalEndpoint();
|
||||
NetConnection connection = NetConnection.provideLocalClient(socket);
|
||||
connection.setNetHandler(new NetHandlerLoginClient(connection, this));
|
||||
|
@ -2083,7 +2082,7 @@ public class Game implements IThreadListener {
|
|||
}
|
||||
|
||||
Log.SYSTEM.info("Beende ...");
|
||||
unload();
|
||||
unload(false);
|
||||
this.getSoundManager().unload();
|
||||
Region.killIO();
|
||||
this.renderGlobal.stopChunkBuilders();
|
||||
|
@ -2107,7 +2106,7 @@ public class Game implements IThreadListener {
|
|||
|
||||
public void disconnected(String msg) {
|
||||
Log.SYSTEM.info("Getrennt: %s", msg);
|
||||
this.unload();
|
||||
this.unload(true);
|
||||
this.displayGuiScreen(new GuiInfo("Von Server getrennt", TextColor.RED + "Verbindung zum Server wurde getrennt\n\n" + TextColor.RESET + msg));
|
||||
}
|
||||
|
||||
|
@ -2263,7 +2262,7 @@ public class Game implements IThreadListener {
|
|||
return this.theWorld != null && server == null;
|
||||
}
|
||||
|
||||
public void unload() {
|
||||
public void unload(boolean loading) {
|
||||
if(this.theWorld != null) {
|
||||
if(server == null && this.getNetHandler() != null)
|
||||
this.getNetHandler().getNetworkManager().closeChannel("Quitting");
|
||||
|
@ -2271,11 +2270,18 @@ public class Game implements IThreadListener {
|
|||
if(server != null)
|
||||
server.shutdown();
|
||||
}
|
||||
while(server != null && !server.isStopped()) {
|
||||
try {
|
||||
Thread.sleep(10L);
|
||||
if(server != null) {
|
||||
if(loading) {
|
||||
this.displayGuiScreen(GuiLoading.makeSaveTask(server));
|
||||
}
|
||||
catch(InterruptedException e) {
|
||||
else {
|
||||
while(!server.isStopped()) {
|
||||
try {
|
||||
Thread.sleep(10L);
|
||||
}
|
||||
catch(InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
server = null;
|
||||
|
@ -2284,17 +2290,16 @@ public class Game implements IThreadListener {
|
|||
public void startServer(File dir, String user) {
|
||||
server = new Server(dir);
|
||||
server.start();
|
||||
while(server != null && !server.isStarted()) {
|
||||
try {
|
||||
Thread.sleep(10L);
|
||||
}
|
||||
catch(InterruptedException e) {
|
||||
}
|
||||
}
|
||||
if(server != null) {
|
||||
server.setVar("viewDistance", "" + this.renderDistance);
|
||||
this.connectToIntegrated(server, user);
|
||||
}
|
||||
this.displayGuiScreen(GuiLoading.makeLoadTask(server, user));
|
||||
// while(server != null && !server.isStarted()) {
|
||||
// try {
|
||||
// Thread.sleep(10L);
|
||||
// }
|
||||
// catch(InterruptedException e) {
|
||||
// }
|
||||
// }
|
||||
// if(server != null) {
|
||||
// }
|
||||
}
|
||||
|
||||
private void startSound(boolean load) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue