Extensive netcode changes, bugfixes
This commit is contained in:
@@ -22,9 +22,7 @@ import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.util.Log;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
import static io.anuke.mindustry.Vars.maxNameLength;
|
||||
import static io.anuke.mindustry.Vars.players;
|
||||
import static io.anuke.mindustry.Vars.ui;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class JoinDialog extends FloatingDialog {
|
||||
Array<Server> servers = new Array<>();
|
||||
@@ -275,6 +273,11 @@ public class JoinDialog extends FloatingDialog {
|
||||
void connect(String ip, int port){
|
||||
ui.loadfrag.show("$text.connecting");
|
||||
|
||||
ui.loadfrag.setButton(() -> {
|
||||
ui.loadfrag.hide();
|
||||
netClient.disconnectQuietly();
|
||||
});
|
||||
|
||||
Timers.runTask(2f, () -> {
|
||||
try{
|
||||
Vars.netClient.beginConnecting();
|
||||
|
||||
@@ -135,7 +135,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
game.sliderPref("saveinterval", 90, 10, 5*120, i -> Bundles.format("setting.seconds", i));
|
||||
|
||||
if(!gwt){
|
||||
graphics.checkPref("multithread", false, threads::setEnabled);
|
||||
graphics.checkPref("multithread", true, threads::setEnabled);
|
||||
|
||||
if(Settings.getBool("multithread")){
|
||||
threads.setEnabled(true);
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.ucore.function.Listenable;
|
||||
import io.anuke.ucore.scene.Group;
|
||||
import io.anuke.ucore.scene.builders.label;
|
||||
import io.anuke.ucore.scene.builders.table;
|
||||
import io.anuke.ucore.scene.event.Touchable;
|
||||
import io.anuke.ucore.scene.ui.Label;
|
||||
import io.anuke.ucore.scene.ui.TextButton;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
public class LoadingFragment implements Fragment {
|
||||
private Table table;
|
||||
private TextButton button;
|
||||
|
||||
@Override
|
||||
public void build(Group parent) {
|
||||
@@ -25,11 +28,22 @@ public class LoadingFragment implements Fragment {
|
||||
row();
|
||||
get().addImage("white").growX()
|
||||
.height(3f).pad(4f).growX().get().setColor(Palette.accent);
|
||||
|
||||
row();
|
||||
|
||||
button = get().addButton("$text.cancel", () -> {}).pad(20).size(250f, 70f).get();
|
||||
button.setVisible(false);
|
||||
}}.end().get();
|
||||
|
||||
table.setVisible(false);
|
||||
}
|
||||
|
||||
public void setButton(Listenable listener){
|
||||
button.setVisible(true);
|
||||
button.getListeners().removeIndex(button.getListeners().size - 1);
|
||||
button.clicked(listener);
|
||||
}
|
||||
|
||||
public void show(){
|
||||
show("$text.loading");
|
||||
}
|
||||
@@ -42,5 +56,6 @@ public class LoadingFragment implements Fragment {
|
||||
|
||||
public void hide(){
|
||||
table.setVisible(false);
|
||||
button.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user