loading screen
This commit is contained in:
parent
987ed4059e
commit
d4f6d3e4f9
6 changed files with 139 additions and 95 deletions
|
@ -18,14 +18,27 @@ public class GuiLoading extends Gui {
|
|||
private Bar progressBar1;
|
||||
private Bar progressBar2;
|
||||
|
||||
public static GuiLoading makeLoadTask(final Server server) {
|
||||
public static GuiLoading makeLoadTask(final Server server, final String user) {
|
||||
return new GuiLoading("Lade Welt ...", new Callback() {
|
||||
boolean started = false;
|
||||
|
||||
public void poll(Game gm, GuiLoading gui) {
|
||||
if(server.isStarted()) {
|
||||
gm.displayGuiScreen(null);
|
||||
return;
|
||||
if(!this.started && server.isStarted()) {
|
||||
this.started = true;
|
||||
// gm.displayGuiScreen(null);
|
||||
server.setVar("viewDistance", "" + gm.renderDistance);
|
||||
gm.connectToIntegrated(server, user);
|
||||
// return;
|
||||
}
|
||||
|
||||
int progress = server.getProgress();
|
||||
if(progress < 0) {
|
||||
gui.resetBar();
|
||||
}
|
||||
else {
|
||||
gui.setBar(null, "Chunks", Math.max(1, server.getTotal()));
|
||||
gui.setProgress(progress);
|
||||
}
|
||||
gui.setTask(server.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -37,7 +50,15 @@ public class GuiLoading extends Gui {
|
|||
gm.displayGuiScreen(GuiMenu.INSTANCE);
|
||||
return;
|
||||
}
|
||||
|
||||
int progress = server.getProgress();
|
||||
if(progress < 0) {
|
||||
gui.resetBar();
|
||||
}
|
||||
else {
|
||||
gui.setBar(null, "Dimensionen", Math.max(1, server.getTotal()));
|
||||
gui.setProgress(progress);
|
||||
}
|
||||
gui.setTask(server.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -62,7 +83,7 @@ public class GuiLoading extends Gui {
|
|||
}
|
||||
|
||||
public void setTask(String task) {
|
||||
this.taskLabel.setText(task);
|
||||
this.taskLabel.setText(task == null ? "" : task);
|
||||
}
|
||||
|
||||
public void setBar(String desc) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue