Slowly descending into a branchy mess
This commit is contained in:
@@ -10,7 +10,17 @@ text.level.select=Level Select
|
|||||||
text.level.mode=Gamemode:
|
text.level.mode=Gamemode:
|
||||||
text.savegame=Save Game
|
text.savegame=Save Game
|
||||||
text.loadgame=Load Game
|
text.loadgame=Load Game
|
||||||
|
text.joingame=Join Game
|
||||||
text.quit=Quit
|
text.quit=Quit
|
||||||
|
text.hostserver=Host Server
|
||||||
|
text.joingame.title=Join Game
|
||||||
|
text.joingame.ip=IP:
|
||||||
|
text.connecting=[accent]Connecting...
|
||||||
|
text.connecting.data=[accent]Loading world data...
|
||||||
|
text.connectfail=[crimson]Failed to connect to server: [orange]{0}
|
||||||
|
text.server.port=Port:
|
||||||
|
text.server.invalidport=Invalid port number!
|
||||||
|
text.server.error=[crimson]Error hosting server: [orange]{0}
|
||||||
text.tutorial.back=< Prev
|
text.tutorial.back=< Prev
|
||||||
text.tutorial.next=Next >
|
text.tutorial.next=Next >
|
||||||
text.save.new=New Save
|
text.save.new=New Save
|
||||||
|
|||||||
31
core/src/io/anuke/mindustry/core/NetClient.java
Normal file
31
core/src/io/anuke/mindustry/core/NetClient.java
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
package io.anuke.mindustry.core;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import io.anuke.mindustry.Vars;
|
||||||
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
|
import io.anuke.mindustry.net.Net;
|
||||||
|
import io.anuke.mindustry.net.Packets.Connect;
|
||||||
|
import io.anuke.ucore.modules.Module;
|
||||||
|
|
||||||
|
public class NetClient extends Module {
|
||||||
|
|
||||||
|
public NetClient(){
|
||||||
|
|
||||||
|
Net.handle(Connect.class, packet -> {
|
||||||
|
Gdx.app.postRunnable(() -> {
|
||||||
|
Vars.ui.hideLoading();
|
||||||
|
Vars.ui.showLoading("$text.connecting.data");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(){
|
||||||
|
if(!Net.client()) return;
|
||||||
|
|
||||||
|
if(!GameState.is(State.menu) && Net.active()){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
Net.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
core/src/io/anuke/mindustry/net/Packets.java
Normal file
20
core/src/io/anuke/mindustry/net/Packets.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package io.anuke.mindustry.net;
|
||||||
|
|
||||||
|
/**Class for storing all packets.*/
|
||||||
|
public class Packets {
|
||||||
|
|
||||||
|
public static class Connect {
|
||||||
|
public int id;
|
||||||
|
public String addressTCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Disconnect {
|
||||||
|
public int id;
|
||||||
|
public String addressTCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class WorldData {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user