Steam cleanup

This commit is contained in:
Anuken
2019-08-30 17:25:37 -04:00
parent 7aafa8b150
commit 4e2d2ee378
5 changed files with 42 additions and 42 deletions

View File

@@ -10,8 +10,7 @@ import io.anuke.mindustry.net.Net;
import java.io.IOException;
import static io.anuke.mindustry.Vars.player;
import static io.anuke.mindustry.Vars.ui;
import static io.anuke.mindustry.Vars.*;
public class HostDialog extends FloatingDialog{
float w = 300;
@@ -50,23 +49,29 @@ public class HostDialog extends FloatingDialog{
return;
}
ui.loadfrag.show("$hosting");
Time.runTask(5f, () -> {
try{
Net.host(Vars.port);
player.isAdmin = true;
}catch(IOException e){
ui.showError(Core.bundle.format("server.error", Strings.parseException(e, true)));
}
ui.loadfrag.hide();
hide();
});
runHost();
}).width(w).height(70f);
cont.addButton("?", () -> ui.showInfo("$host.info")).size(65f, 70f).padLeft(6f);
shown(() -> {
Core.app.post(() -> Core.settings.getBoolOnce("hostinfo", () -> ui.showInfo("$host.info")));
if(!steam){
Core.app.post(() -> Core.settings.getBoolOnce("hostinfo", () -> ui.showInfo("$host.info")));
}
});
}
public void runHost(){
ui.loadfrag.show("$hosting");
Time.runTask(5f, () -> {
try{
Net.host(Vars.port);
player.isAdmin = true;
}catch(IOException e){
ui.showError(Core.bundle.format("server.error", Strings.parseException(e, true)));
}
ui.loadfrag.hide();
hide();
});
}
}

View File

@@ -57,7 +57,13 @@ public class PausedDialog extends FloatingDialog{
cont.row();
cont.addButton("$hostserver", ui.host::show).disabled(b -> Net.active()).colspan(2).width(dw * 2 + 20f);
cont.addButton("$hostserver", () -> {
if(steam){
ui.host.runHost();
}else{
ui.host.show();
}
}).disabled(b -> Net.active()).colspan(2).width(dw * 2 + 20f);
}
cont.row();