Switched to different Kryonet fork; full Android support
This commit is contained in:
@@ -7,6 +7,7 @@ import android.os.Bundle;
|
|||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||||
|
import com.esotericsoftware.minlog.Log;
|
||||||
import io.anuke.kryonet.KryoClient;
|
import io.anuke.kryonet.KryoClient;
|
||||||
import io.anuke.kryonet.KryoServer;
|
import io.anuke.kryonet.KryoServer;
|
||||||
import io.anuke.mindustry.io.PlatformFunction;
|
import io.anuke.mindustry.io.PlatformFunction;
|
||||||
@@ -64,6 +65,8 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
|
|
||||||
config.hideStatusBar = true;
|
config.hideStatusBar = true;
|
||||||
|
|
||||||
|
Log.set(Log.LEVEL_DEBUG);
|
||||||
|
|
||||||
Net.setClientProvider(new KryoClient());
|
Net.setClientProvider(new KryoClient());
|
||||||
Net.setServerProvider(new KryoServer());
|
Net.setServerProvider(new KryoServer());
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ project(":kryonet") {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
compile "com.esotericsoftware:kryonet:2.22.0-RC1"
|
compile 'com.github.crykn:kryonet:2.22.1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
core/assets-raw/sprites/ui/icons/icon-host.png
Normal file
BIN
core/assets-raw/sprites/ui/icons/icon-host.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 193 B |
@@ -13,8 +13,9 @@ text.loadgame=Load Game
|
|||||||
text.joingame=Join Game
|
text.joingame=Join Game
|
||||||
text.quit=Quit
|
text.quit=Quit
|
||||||
text.server.connected=A player has joined.
|
text.server.connected=A player has joined.
|
||||||
text.server.disconnected=A player has disconnected.
|
text.server.disconnected={0} has disconnected.
|
||||||
text.hostserver=Host Server
|
text.hostserver=Host Server
|
||||||
|
text.host=Host
|
||||||
text.joingame.title=Join Game
|
text.joingame.title=Join Game
|
||||||
text.joingame.ip=IP:
|
text.joingame.ip=IP:
|
||||||
text.disconnect=Disconnected.
|
text.disconnect=Disconnected.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 80 KiB |
@@ -43,6 +43,7 @@ public class Vars{
|
|||||||
public static final int zoomScale = Math.round(Unit.dp.scl(1));
|
public static final int zoomScale = Math.round(Unit.dp.scl(1));
|
||||||
//if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available
|
//if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available
|
||||||
public static boolean debug = false;
|
public static boolean debug = false;
|
||||||
|
public static boolean debugNet = false;
|
||||||
//whether the player can clip through walls
|
//whether the player can clip through walls
|
||||||
public static boolean noclip = false;
|
public static boolean noclip = false;
|
||||||
//whether to draw chunk borders
|
//whether to draw chunk borders
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ public class Control extends Module{
|
|||||||
}
|
}
|
||||||
|
|
||||||
player = new Player();
|
player = new Player();
|
||||||
|
player.isAndroid = Vars.android;
|
||||||
player.isLocal = true;
|
player.isLocal = true;
|
||||||
|
|
||||||
spawns = WaveCreator.getSpawns();
|
spawns = WaveCreator.getSpawns();
|
||||||
@@ -397,6 +398,10 @@ public class Control extends Module{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void coreDestroyed(){
|
public void coreDestroyed(){
|
||||||
|
if(Net.active() && Net.server()){
|
||||||
|
Net.closeServer();
|
||||||
|
}
|
||||||
|
|
||||||
Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y);
|
Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y);
|
||||||
Sounds.play("corexplode");
|
Sounds.play("corexplode");
|
||||||
for(int i = 0; i < 16; i ++){
|
for(int i = 0; i < 16; i ++){
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.anuke.mindustry.core;
|
package io.anuke.mindustry.core;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.utils.TimeUtils;
|
||||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||||
import com.badlogic.gdx.utils.reflect.ReflectionException;
|
import com.badlogic.gdx.utils.reflect.ReflectionException;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
@@ -33,7 +34,7 @@ import java.util.Arrays;
|
|||||||
public class NetClient extends Module {
|
public class NetClient extends Module {
|
||||||
boolean connecting = false;
|
boolean connecting = false;
|
||||||
boolean gotEntities = false;
|
boolean gotEntities = false;
|
||||||
float playerSyncTime = 3;
|
float playerSyncTime = 2;
|
||||||
|
|
||||||
public NetClient(){
|
public NetClient(){
|
||||||
|
|
||||||
@@ -44,6 +45,11 @@ public class NetClient extends Module {
|
|||||||
Vars.ui.hideLoading();
|
Vars.ui.hideLoading();
|
||||||
Vars.ui.showLoading("$text.connecting.data");
|
Vars.ui.showLoading("$text.connecting.data");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ConnectPacket c = new ConnectPacket();
|
||||||
|
c.name = UCore.getProperty("user.name");
|
||||||
|
c.android = Vars.android;
|
||||||
|
Net.send(c, SendMode.tcp);
|
||||||
});
|
});
|
||||||
|
|
||||||
Net.handle(Disconnect.class, packet -> {
|
Net.handle(Disconnect.class, packet -> {
|
||||||
@@ -98,7 +104,7 @@ public class NetClient extends Module {
|
|||||||
int id = packet.ids[i];
|
int id = packet.ids[i];
|
||||||
if(id != Vars.player.id){
|
if(id != Vars.player.id){
|
||||||
Entity entity = null;
|
Entity entity = null;
|
||||||
if(id >= packet.enemyStart){
|
if(i >= packet.enemyStart){
|
||||||
entity = Vars.control.enemyGroup.getByID(id);
|
entity = Vars.control.enemyGroup.getByID(id);
|
||||||
}else {
|
}else {
|
||||||
entity = Vars.control.playerGroup.getByID(id);
|
entity = Vars.control.playerGroup.getByID(id);
|
||||||
@@ -106,7 +112,10 @@ public class NetClient extends Module {
|
|||||||
|
|
||||||
Syncable sync = ((Syncable)entity);
|
Syncable sync = ((Syncable)entity);
|
||||||
|
|
||||||
if(sync == null) continue;
|
if(sync == null){
|
||||||
|
Gdx.app.error("Mindustry", "Unknown entity ID: " + id + " " + (i >= packet.enemyStart ? "(enemy)" : "(player)"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//augh
|
//augh
|
||||||
((Interpolator)sync.getInterpolator()).type.read(entity, packet.data[i]);
|
((Interpolator)sync.getInterpolator()).type.read(entity, packet.data[i]);
|
||||||
@@ -136,6 +145,8 @@ public class NetClient extends Module {
|
|||||||
}
|
}
|
||||||
Vars.control.setWaveData(packet.enemies, packet.wave, packet.countdown);
|
Vars.control.setWaveData(packet.enemies, packet.wave, packet.countdown);
|
||||||
|
|
||||||
|
Timers.resetTime(packet.time + (float)(TimeUtils.timeSinceMillis(packet.timestamp) / 1000.0 * 60.0));
|
||||||
|
|
||||||
Gdx.app.postRunnable(() -> {
|
Gdx.app.postRunnable(() -> {
|
||||||
Vars.ui.updateItems();
|
Vars.ui.updateItems();
|
||||||
});
|
});
|
||||||
@@ -217,6 +228,18 @@ public class NetClient extends Module {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Net.handle(DisconnectPacket.class, packet -> {
|
||||||
|
Player player = Vars.control.playerGroup.getByID(packet.playerid);
|
||||||
|
|
||||||
|
if(player != null){
|
||||||
|
player.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Net.handle(Player.class, player -> {
|
||||||
|
player.add();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(){
|
public void update(){
|
||||||
@@ -259,7 +282,7 @@ public class NetClient extends Module {
|
|||||||
if(Timers.get("syncPlayer", playerSyncTime)){
|
if(Timers.get("syncPlayer", playerSyncTime)){
|
||||||
PositionPacket packet = new PositionPacket();
|
PositionPacket packet = new PositionPacket();
|
||||||
packet.data = Vars.player.getInterpolator().type.write(Vars.player);
|
packet.data = Vars.player.getInterpolator().type.write(Vars.player);
|
||||||
Net.send(packet, SendMode.tcp); //TODO udp instead?
|
Net.send(packet, SendMode.udp); //TODO udp instead?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
|
|||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.utils.IntArray;
|
import com.badlogic.gdx.utils.IntArray;
|
||||||
import com.badlogic.gdx.utils.IntMap;
|
import com.badlogic.gdx.utils.IntMap;
|
||||||
|
import com.badlogic.gdx.utils.TimeUtils;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.BulletType;
|
||||||
@@ -24,6 +25,7 @@ import io.anuke.ucore.core.Effects.Effect;
|
|||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.entities.Entity;
|
import io.anuke.ucore.entities.Entity;
|
||||||
import io.anuke.ucore.modules.Module;
|
import io.anuke.ucore.modules.Module;
|
||||||
|
import io.anuke.ucore.util.Bundles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
@@ -39,8 +41,14 @@ public class NetServer extends Module{
|
|||||||
|
|
||||||
public NetServer(){
|
public NetServer(){
|
||||||
|
|
||||||
Net.handleServer(Connect.class, packet -> {
|
Net.handleServer(Connect.class, connect -> {
|
||||||
UCore.log("Sending world data to client (ID="+packet.id+"/"+packet.addressTCP+")");
|
UCore.log("Connection found: " + connect.addressTCP);
|
||||||
|
});
|
||||||
|
|
||||||
|
Net.handleServer(ConnectPacket.class, packet -> {
|
||||||
|
int id = Net.getLastConnection();
|
||||||
|
|
||||||
|
UCore.log("Sending world data to client (ID="+id+")");
|
||||||
|
|
||||||
WorldData data = new WorldData();
|
WorldData data = new WorldData();
|
||||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
@@ -51,7 +59,7 @@ public class NetServer extends Module{
|
|||||||
//TODO compress and uncompress when sending
|
//TODO compress and uncompress when sending
|
||||||
data.stream = new ByteArrayInputStream(stream.toByteArray());
|
data.stream = new ByteArrayInputStream(stream.toByteArray());
|
||||||
|
|
||||||
Net.sendStream(packet.id, data);
|
Net.sendStream(id, data);
|
||||||
|
|
||||||
Gdx.app.postRunnable(() -> {
|
Gdx.app.postRunnable(() -> {
|
||||||
Vars.ui.showInfo("$text.server.connected");
|
Vars.ui.showInfo("$text.server.connected");
|
||||||
@@ -59,25 +67,38 @@ public class NetServer extends Module{
|
|||||||
EntityDataPacket dp = new EntityDataPacket();
|
EntityDataPacket dp = new EntityDataPacket();
|
||||||
|
|
||||||
Player player = new Player();
|
Player player = new Player();
|
||||||
player.clientid = packet.id;
|
player.clientid = id;
|
||||||
|
player.name = packet.name;
|
||||||
|
player.isAndroid = packet.android;
|
||||||
player.set(Vars.control.core.worldx(), Vars.control.core.worldy() - Vars.tilesize*2);
|
player.set(Vars.control.core.worldx(), Vars.control.core.worldy() - Vars.tilesize*2);
|
||||||
player.add();
|
player.add();
|
||||||
connections.put(packet.id, player);
|
connections.put(id, player);
|
||||||
|
|
||||||
dp.playerid = player.id;
|
dp.playerid = player.id;
|
||||||
dp.players = Vars.control.playerGroup.all().toArray(Player.class);
|
dp.players = Vars.control.playerGroup.all().toArray(Player.class);
|
||||||
|
|
||||||
UCore.log("Sending entities: " + Arrays.toString(dp.players));
|
UCore.log("Sending entities: " + Arrays.toString(dp.players));
|
||||||
|
|
||||||
//TODO send pathfind positions
|
Net.sendExcept(id, player, SendMode.tcp);
|
||||||
//TODO save enemy nodes
|
|
||||||
|
|
||||||
Net.sendTo(packet.id, dp, SendMode.tcp);
|
Net.sendTo(id, dp, SendMode.tcp);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Net.handleServer(Disconnect.class, packet -> {
|
Net.handleServer(Disconnect.class, packet -> {
|
||||||
Gdx.app.postRunnable(() -> Vars.ui.showInfo("$text.server.disconnected"));
|
Player player = connections.get(packet.id);
|
||||||
|
|
||||||
|
if(player == null) {
|
||||||
|
Gdx.app.postRunnable(() -> Vars.ui.showInfo(Bundles.format("text.server.disconnected", "<???>")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Gdx.app.postRunnable(() -> Vars.ui.showInfo(Bundles.format("text.server.disconnected", player.name)));
|
||||||
|
|
||||||
|
DisconnectPacket dc = new DisconnectPacket();
|
||||||
|
dc.playerid = player.id;
|
||||||
|
|
||||||
|
Net.send(dc, SendMode.tcp);
|
||||||
});
|
});
|
||||||
|
|
||||||
Net.handleServer(PositionPacket.class, pos -> {
|
Net.handleServer(PositionPacket.class, pos -> {
|
||||||
@@ -200,7 +221,7 @@ public class NetServer extends Module{
|
|||||||
packet.ids = new int[amount];
|
packet.ids = new int[amount];
|
||||||
packet.data = new float[amount][0];
|
packet.data = new float[amount][0];
|
||||||
|
|
||||||
int index = 0;
|
short index = 0;
|
||||||
|
|
||||||
for(Player player : Vars.control.playerGroup.all()){
|
for(Player player : Vars.control.playerGroup.all()){
|
||||||
float[] out = player.getInterpolator().type.write(player);
|
float[] out = player.getInterpolator().type.write(player);
|
||||||
@@ -229,23 +250,24 @@ public class NetServer extends Module{
|
|||||||
packet.countdown = Vars.control.getWaveCountdown();
|
packet.countdown = Vars.control.getWaveCountdown();
|
||||||
packet.enemies = Vars.control.getEnemiesRemaining();
|
packet.enemies = Vars.control.getEnemiesRemaining();
|
||||||
packet.wave = Vars.control.getWave();
|
packet.wave = Vars.control.getWave();
|
||||||
|
packet.time = Timers.time();
|
||||||
|
packet.timestamp = TimeUtils.millis();
|
||||||
|
|
||||||
Net.send(packet, SendMode.udp);
|
Net.send(packet, SendMode.udp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Timers.get("serverBlockSync", blockSyncTime)){
|
if(Timers.get("serverBlockSync", blockSyncTime)){
|
||||||
BlockSyncPacket packet = new BlockSyncPacket();
|
|
||||||
|
|
||||||
IntArray connections = Net.getConnections();
|
IntArray connections = Net.getConnections();
|
||||||
|
|
||||||
for(int i = 0; i < connections.size; i ++){
|
for(int i = 0; i < connections.size; i ++){
|
||||||
int id = connections.get(i);
|
int id = connections.get(i);
|
||||||
Player player = this.connections.get(i);
|
Player player = this.connections.get(id);
|
||||||
if(player == null) continue;
|
if(player == null) continue;
|
||||||
int x = Mathf.scl2(player.x, Vars.tilesize);
|
int x = Mathf.scl2(player.x, Vars.tilesize);
|
||||||
int y = Mathf.scl2(player.y, Vars.tilesize);
|
int y = Mathf.scl2(player.y, Vars.tilesize);
|
||||||
int w = 14;
|
int w = 16;
|
||||||
int h = 10;
|
int h = 12;
|
||||||
sendBlockSync(id, x, y, w, h);
|
sendBlockSync(id, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +292,7 @@ public class NetServer extends Module{
|
|||||||
byte times = 0;
|
byte times = 0;
|
||||||
|
|
||||||
for(; times < tile.entity.timer.getTimes().length; times ++){
|
for(; times < tile.entity.timer.getTimes().length; times ++){
|
||||||
if(tile.entity.timer.getTimes()[times] > 0){
|
if(tile.entity.timer.getTimes()[times] <= 1f){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,7 +300,7 @@ public class NetServer extends Module{
|
|||||||
stream.writeByte(times);
|
stream.writeByte(times);
|
||||||
|
|
||||||
for(int i = 0; i < times; i ++){
|
for(int i = 0; i < times; i ++){
|
||||||
stream.writeFloat(tile.entity.timer.getTimes()[times]);
|
stream.writeFloat(tile.entity.timer.getTimes()[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
tile.entity.write(stream);
|
tile.entity.write(stream);
|
||||||
|
|||||||
@@ -418,10 +418,8 @@ public class Renderer extends RendererModule{
|
|||||||
drawHealth(entity);
|
drawHealth(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Vars.android && Vars.showPlayer) {
|
for(Player player : Vars.control.playerGroup.all()){
|
||||||
for(Player player : Vars.control.playerGroup.all()){
|
if(!player.isDead() && !player.isAndroid) drawHealth(player);
|
||||||
if(!player.isDead()) drawHealth(player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,10 +181,12 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
join = new FloatingDialog("$text.joingame.title");
|
join = new FloatingDialog("$text.joingame.title");
|
||||||
join.content().add("$text.joingame.ip").left();
|
join.content().add("$text.joingame.ip").left();
|
||||||
join.content().addField("localhost", text -> lastip = text).size(180f, 54f);
|
Mindustry.platforms.addDialog(join.content().addField("localhost", text -> lastip = text).size(180f, 54f).get());
|
||||||
join.content().row();
|
join.content().row();
|
||||||
join.content().add("$text.server.port").left();
|
join.content().add("$text.server.port").left();
|
||||||
join.content().addField(Vars.port + "", new DigitsOnlyFilter(), text -> lastport = Strings.parseInt(text)).size(180f, 54f);
|
Mindustry.platforms.addDialog(join.content()
|
||||||
|
.addField(Vars.port + "", new DigitsOnlyFilter(), text -> lastport = Strings.parseInt(text))
|
||||||
|
.size(180f, 54f).get());
|
||||||
join.buttons().defaults().size(140f, 60f).pad(4f);
|
join.buttons().defaults().size(140f, 60f).pad(4f);
|
||||||
join.buttons().addButton("$text.cancel", join::hide);
|
join.buttons().addButton("$text.cancel", join::hide);
|
||||||
join.buttons().addButton("$text.ok", () -> {
|
join.buttons().addButton("$text.ok", () -> {
|
||||||
@@ -472,6 +474,21 @@ public class UI extends SceneModule{
|
|||||||
public void showInfo(String info){
|
public void showInfo(String info){
|
||||||
scene.table().add(info).get().getParent().actions(Actions.fadeOut(4f), Actions.removeActor());
|
scene.table().add(info).get().getParent().actions(Actions.fadeOut(4f), Actions.removeActor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showHostServer(){
|
||||||
|
showTextInput("$text.hostserver", "$text.server.port", Vars.port + "", new DigitsOnlyFilter(), text -> {
|
||||||
|
int result = Strings.parseInt(text);
|
||||||
|
if(result == Integer.MIN_VALUE || result >= 65535){
|
||||||
|
Vars.ui.showError("$text.server.invalidport");
|
||||||
|
}else{
|
||||||
|
try{
|
||||||
|
Net.host(result);
|
||||||
|
}catch (IOException e){
|
||||||
|
Vars.ui.showError(Bundles.format("text.server.error", Strings.parseException(e, false)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void showAbout(){
|
public void showAbout(){
|
||||||
about.show();
|
about.show();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import io.anuke.mindustry.world.Tile;
|
|||||||
import io.anuke.mindustry.world.blocks.Blocks;
|
import io.anuke.mindustry.world.blocks.Blocks;
|
||||||
import io.anuke.ucore.core.*;
|
import io.anuke.ucore.core.*;
|
||||||
import io.anuke.ucore.entities.DestructibleEntity;
|
import io.anuke.ucore.entities.DestructibleEntity;
|
||||||
|
import io.anuke.ucore.entities.SolidEntity;
|
||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
@@ -19,10 +20,14 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
public class Player extends DestructibleEntity implements Syncable{
|
public class Player extends DestructibleEntity implements Syncable{
|
||||||
private static final float speed = 1.1f;
|
private static final float speed = 1.1f;
|
||||||
private static final float dashSpeed = 1.8f;
|
private static final float dashSpeed = 1.8f;
|
||||||
|
|
||||||
|
public String name = "player name";
|
||||||
public transient Weapon weapon = Weapon.blaster;
|
public transient Weapon weapon = Weapon.blaster;
|
||||||
public Mech mech = Mech.standard;
|
public Mech mech = Mech.standard;
|
||||||
public float angle;
|
public float angle;
|
||||||
|
public boolean isAndroid;
|
||||||
|
|
||||||
|
public transient float targetAngle = 0f;
|
||||||
|
|
||||||
public transient int clientid;
|
public transient int clientid;
|
||||||
public transient boolean isLocal = false;
|
public transient boolean isLocal = false;
|
||||||
@@ -43,15 +48,20 @@ public class Player extends DestructibleEntity implements Syncable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Interpolator getInterpolator() {
|
public Interpolator<Player> getInterpolator() {
|
||||||
return inter;
|
return inter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void damage(int amount){
|
public void damage(int amount){
|
||||||
if(!Vars.debug && !Vars.android)
|
if(!Vars.debug)
|
||||||
super.damage(amount);
|
super.damage(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean collides(SolidEntity other){
|
||||||
|
return super.collides(other) && !isAndroid;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDeath(){
|
public void onDeath(){
|
||||||
@@ -79,9 +89,13 @@ public class Player extends DestructibleEntity implements Syncable{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
if((Vars.debug && (!Vars.showPlayer || !Vars.showUI)) || (Vars.android && isLocal)) return;
|
if(isAndroid && isLocal){
|
||||||
|
angle = Mathf.lerpAngDelta(angle, targetAngle, 0.2f);
|
||||||
|
}
|
||||||
|
|
||||||
String part = Vars.android ? "ship" : "mech";
|
if((Vars.debug && (!Vars.showPlayer || !Vars.showUI)) || (isAndroid && isLocal)) return;
|
||||||
|
|
||||||
|
String part = isAndroid ? "ship" : "mech";
|
||||||
|
|
||||||
if(Vars.snapCamera && Settings.getBool("smoothcam") && Settings.getBool("pixelate")){
|
if(Vars.snapCamera && Settings.getBool("smoothcam") && Settings.getBool("pixelate")){
|
||||||
Draw.rect(part+"-"+mech.name(), (int)x, (int)y, angle-90);
|
Draw.rect(part+"-"+mech.name(), (int)x, (int)y, angle-90);
|
||||||
@@ -93,7 +107,7 @@ public class Player extends DestructibleEntity implements Syncable{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
if(!isLocal || android){
|
if(!isLocal || isAndroid){
|
||||||
if(!isDead() && !isLocal) inter.update(this);
|
if(!isDead() && !isLocal) inter.update(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -153,4 +167,9 @@ public class Player extends DestructibleEntity implements Syncable{
|
|||||||
public Player add(){
|
public Player add(){
|
||||||
return add(Vars.control.playerGroup);
|
return add(Vars.control.playerGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Player{" + id + ", android=" + isAndroid + ", local=" + isLocal + ", " + x + ", " + y + "}\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class GestureHandler extends GestureAdapter{
|
|||||||
float dx = deltaX*Core.camera.zoom/Core.cameraScale, dy = deltaY*Core.camera.zoom/Core.cameraScale;
|
float dx = deltaX*Core.camera.zoom/Core.cameraScale, dy = deltaY*Core.camera.zoom/Core.cameraScale;
|
||||||
player.x -= dx;
|
player.x -= dx;
|
||||||
player.y += dy;
|
player.y += dy;
|
||||||
player.angle = Mathf.lerpAngDelta(player.angle, Mathf.atan2(dx, dy), 0.5f);
|
player.targetAngle = Mathf.atan2(dx, -dy);
|
||||||
}else if(player.placeMode.lockCamera && (player.placeMode.pan && player.recipe != null)){
|
}else if(player.placeMode.lockCamera && (player.placeMode.pan && player.recipe != null)){
|
||||||
input.mousex += deltaX;
|
input.mousex += deltaX;
|
||||||
input.mousey += deltaY;
|
input.mousey += deltaY;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package io.anuke.mindustry.io;
|
package io.anuke.mindustry.io;
|
||||||
|
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.utils.Array;
|
|
||||||
import com.badlogic.gdx.utils.TimeUtils;
|
import com.badlogic.gdx.utils.TimeUtils;
|
||||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
@@ -12,8 +11,6 @@ import io.anuke.mindustry.world.Tile;
|
|||||||
import io.anuke.mindustry.world.blocks.Blocks;
|
import io.anuke.mindustry.world.blocks.Blocks;
|
||||||
import io.anuke.mindustry.world.blocks.types.BlockPart;
|
import io.anuke.mindustry.world.blocks.types.BlockPart;
|
||||||
import io.anuke.mindustry.world.blocks.types.Rock;
|
import io.anuke.mindustry.world.blocks.types.Rock;
|
||||||
import io.anuke.mindustry.world.blocks.types.production.Generator;
|
|
||||||
import io.anuke.ucore.UCore;
|
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
|
|
||||||
@@ -141,7 +138,7 @@ public class NetworkIO {
|
|||||||
byte times = 0;
|
byte times = 0;
|
||||||
|
|
||||||
for(; times < tile.entity.timer.getTimes().length; times ++){
|
for(; times < tile.entity.timer.getTimes().length; times ++){
|
||||||
if(tile.entity.timer.getTimes()[times] > 0){
|
if(tile.entity.timer.getTimes()[times] <= 1){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,7 +146,7 @@ public class NetworkIO {
|
|||||||
stream.writeByte(times);
|
stream.writeByte(times);
|
||||||
|
|
||||||
for(int i = 0; i < times; i ++){
|
for(int i = 0; i < times; i ++){
|
||||||
stream.writeFloat(tile.entity.timer.getTimes()[times]);
|
stream.writeFloat(tile.entity.timer.getTimes()[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
tile.entity.write(stream);
|
tile.entity.write(stream);
|
||||||
@@ -204,8 +201,6 @@ public class NetworkIO {
|
|||||||
|
|
||||||
int enemies = stream.readInt();
|
int enemies = stream.readInt();
|
||||||
|
|
||||||
Array<Enemy> enemiesToUpdate = new Array<>();
|
|
||||||
|
|
||||||
for(int i = 0; i < enemies; i ++){
|
for(int i = 0; i < enemies; i ++){
|
||||||
int id = stream.readInt();
|
int id = stream.readInt();
|
||||||
byte type = stream.readByte();
|
byte type = stream.readByte();
|
||||||
@@ -226,7 +221,6 @@ public class NetworkIO {
|
|||||||
enemy.tier = tier;
|
enemy.tier = tier;
|
||||||
enemy.node = node;
|
enemy.node = node;
|
||||||
enemy.add(Vars.control.enemyGroup);
|
enemy.add(Vars.control.enemyGroup);
|
||||||
enemiesToUpdate.add(enemy);
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@@ -234,8 +228,7 @@ public class NetworkIO {
|
|||||||
|
|
||||||
Vars.control.setWaveData(enemies, wave, wavetime);
|
Vars.control.setWaveData(enemies, wave, wavetime);
|
||||||
|
|
||||||
if(!android)
|
Vars.player.add();
|
||||||
Vars.player.add();
|
|
||||||
|
|
||||||
//map
|
//map
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,7 @@ package io.anuke.mindustry.io;
|
|||||||
|
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import com.badlogic.gdx.utils.Timer;
|
|
||||||
import com.badlogic.gdx.utils.Timer.Task;
|
|
||||||
import com.badlogic.gdx.utils.async.AsyncExecutor;
|
import com.badlogic.gdx.utils.async.AsyncExecutor;
|
||||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
|
||||||
import com.badlogic.gdx.utils.reflect.Field;
|
|
||||||
import com.badlogic.gdx.utils.reflect.ReflectionException;
|
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.core.GameState;
|
import io.anuke.mindustry.core.GameState;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
@@ -156,6 +151,7 @@ public class Saves {
|
|||||||
|
|
||||||
public void delete(){
|
public void delete(){
|
||||||
SaveIO.fileFor(index).delete();
|
SaveIO.fileFor(index).delete();
|
||||||
|
saves.removeValue(this, true);
|
||||||
if(this == current){
|
if(this == current){
|
||||||
current = null;
|
current = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,6 +192,8 @@ public class Net{
|
|||||||
public IntArray getConnections();
|
public IntArray getConnections();
|
||||||
/**Register classes to be sent.*/
|
/**Register classes to be sent.*/
|
||||||
public void register(Class<?>... types);
|
public void register(Class<?>... types);
|
||||||
|
/**Returns the ping for a certain connection.*/
|
||||||
|
public int getPingFor(int connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SendMode{
|
public enum SendMode{
|
||||||
|
|||||||
@@ -28,17 +28,27 @@ public class Packets {
|
|||||||
public static class SyncPacket{
|
public static class SyncPacket{
|
||||||
public int[] ids;
|
public int[] ids;
|
||||||
public float[][] data;
|
public float[][] data;
|
||||||
public int enemyStart = 0;
|
public short enemyStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BlockSyncPacket extends Streamable{
|
public static class BlockSyncPacket extends Streamable{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class StateSyncPacket {
|
public static class ConnectPacket{
|
||||||
|
public String name;
|
||||||
|
public boolean android;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DisconnectPacket{
|
||||||
|
public int playerid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class StateSyncPacket{
|
||||||
public int[] items;
|
public int[] items;
|
||||||
public float countdown;
|
public float countdown, time;
|
||||||
public int enemies, wave;
|
public int enemies, wave;
|
||||||
|
public long timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PositionPacket{
|
public static class PositionPacket{
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ public class Registrator {
|
|||||||
EnemyDeathPacket.class,
|
EnemyDeathPacket.class,
|
||||||
BlockUpdatePacket.class,
|
BlockUpdatePacket.class,
|
||||||
BlockDestroyPacket.class,
|
BlockDestroyPacket.class,
|
||||||
|
ConnectPacket.class,
|
||||||
|
DisconnectPacket.class,
|
||||||
|
|
||||||
Class.class,
|
Class.class,
|
||||||
byte[].class,
|
byte[].class,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package io.anuke.mindustry.net;
|
package io.anuke.mindustry.net;
|
||||||
|
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import io.anuke.mindustry.Vars;
|
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||||
import io.anuke.mindustry.graphics.Fx;
|
import io.anuke.mindustry.graphics.Fx;
|
||||||
@@ -37,11 +36,11 @@ public interface Syncable {
|
|||||||
@Override
|
@Override
|
||||||
public void update(Player entity, Interpolator interpolator) {
|
public void update(Player entity, Interpolator interpolator) {
|
||||||
Interpolator i = entity.getInterpolator();
|
Interpolator i = entity.getInterpolator();
|
||||||
if(i.target.dst(entity.x, entity.y) > 16){
|
if(i.target.dst(entity.x, entity.y) > 16 && !entity.isAndroid){
|
||||||
entity.set(i.target.x, i.target.y);
|
entity.set(i.target.x, i.target.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Vars.android && i.target.dst(entity.x, entity.y) > 2f && Timers.get(entity, "dashfx", 3)){
|
if(entity.isAndroid && i.target.dst(entity.x, entity.y) > 2f && Timers.get(entity, "dashfx", 2)){
|
||||||
Angles.translation(entity.angle + 180, 3f);
|
Angles.translation(entity.angle + 180, 3f);
|
||||||
Effects.effect(Fx.dashsmoke, entity.x + Angles.x(), entity.y + Angles.y());
|
Effects.effect(Fx.dashsmoke, entity.x + Angles.x(), entity.y + Angles.y());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,7 @@ import io.anuke.ucore.scene.Element;
|
|||||||
import io.anuke.ucore.scene.builders.build;
|
import io.anuke.ucore.scene.builders.build;
|
||||||
import io.anuke.ucore.scene.builders.imagebutton;
|
import io.anuke.ucore.scene.builders.imagebutton;
|
||||||
import io.anuke.ucore.scene.ui.ImageButton;
|
import io.anuke.ucore.scene.ui.ImageButton;
|
||||||
import io.anuke.ucore.scene.ui.TextField.TextFieldFilter.DigitsOnlyFilter;
|
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
import io.anuke.ucore.util.Strings;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.ui;
|
import static io.anuke.mindustry.Vars.ui;
|
||||||
|
|
||||||
@@ -62,26 +58,13 @@ public class MenuDialog extends FloatingDialog{
|
|||||||
|
|
||||||
content().row();
|
content().row();
|
||||||
|
|
||||||
content().addButton("$text.hostserver", () -> {
|
content().addButton("$text.hostserver", () -> ui.showHostServer())
|
||||||
Vars.ui.showTextInput("$text.hostserver", "$text.server.port", Vars.port + "", new DigitsOnlyFilter(), text -> {
|
.disabled(b -> Net.active() || (Net.active() && !Net.server()));
|
||||||
int result = Strings.parseInt(text);
|
|
||||||
if(result == Integer.MIN_VALUE || result >= 65535){
|
|
||||||
Vars.ui.showError("$text.server.invalidport");
|
|
||||||
}else{
|
|
||||||
try{
|
|
||||||
Net.host(result);
|
|
||||||
GameState.set(State.playing);
|
|
||||||
}catch (IOException e){
|
|
||||||
Vars.ui.showError(Bundles.format("text.server.error", Strings.parseException(e, false)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).disabled(b -> Net.active() || (Net.active() && !Net.server()));
|
|
||||||
|
|
||||||
content().row();
|
content().row();
|
||||||
|
|
||||||
content().addButton("$text.quit", () -> {
|
content().addButton("$text.quit", () -> {
|
||||||
Vars.ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
|
ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
|
||||||
runSave();
|
runSave();
|
||||||
hide();
|
hide();
|
||||||
GameState.set(State.menu);
|
GameState.set(State.menu);
|
||||||
@@ -105,8 +88,12 @@ public class MenuDialog extends FloatingDialog{
|
|||||||
new imagebutton("icon-tools", isize, () -> ui.showPrefs()).text("$text.settings").padTop(4f);
|
new imagebutton("icon-tools", isize, () -> ui.showPrefs()).text("$text.settings").padTop(4f);
|
||||||
|
|
||||||
new imagebutton("icon-save", isize, ()-> save.show()).text("$text.save").padTop(4f);
|
new imagebutton("icon-save", isize, ()-> save.show()).text("$text.save").padTop(4f);
|
||||||
|
|
||||||
|
content().row();
|
||||||
|
|
||||||
new imagebutton("icon-load", isize, () -> load.show()).text("$text.load").padTop(4f);
|
new imagebutton("icon-load", isize, () -> load.show()).text("$text.load").padTop(4f);
|
||||||
|
|
||||||
|
new imagebutton("icon-host", isize, () -> ui.showHostServer()).text("$text.host").padTop(4f);
|
||||||
|
|
||||||
new imagebutton("icon-quit", isize, () -> {
|
new imagebutton("icon-quit", isize, () -> {
|
||||||
Vars.ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
|
Vars.ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
|
||||||
|
|||||||
@@ -150,6 +150,14 @@ public class HudFragment implements Fragment{
|
|||||||
|
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
|
if(Vars.debugNet) {
|
||||||
|
new table() {{
|
||||||
|
new label(() -> "players: " + Vars.control.playerGroup.amount());
|
||||||
|
row();
|
||||||
|
new label(() -> "" + Vars.control.playerGroup.all());
|
||||||
|
}}.end();
|
||||||
|
}
|
||||||
|
|
||||||
blockfrag.build();
|
blockfrag.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class MenuFragment implements Fragment{
|
|||||||
|
|
||||||
new imagebutton("icon-tools", isize, () -> ui.showPrefs()).text("$text.settings").padTop(4f);
|
new imagebutton("icon-tools", isize, () -> ui.showPrefs()).text("$text.settings").padTop(4f);
|
||||||
|
|
||||||
new imagebutton("icon-tools", isize, () -> ui.showJoinGame()).text("$text.joingame").padTop(4f);
|
new imagebutton("icon-add", isize, () -> ui.showJoinGame()).text("$text.joingame").padTop(4f);
|
||||||
|
|
||||||
if(Mindustry.donationsCallable != null){
|
if(Mindustry.donationsCallable != null){
|
||||||
new imagebutton("icon-donate", isize, () -> {
|
new imagebutton("icon-donate", isize, () -> {
|
||||||
|
|||||||
@@ -1,15 +1,7 @@
|
|||||||
package io.anuke.mindustry.world.blocks.types.distribution;
|
package io.anuke.mindustry.world.blocks.types.distribution;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import com.badlogic.gdx.utils.IntArray;
|
import com.badlogic.gdx.utils.IntArray;
|
||||||
|
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
@@ -17,7 +9,20 @@ import io.anuke.mindustry.world.Layer;
|
|||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Draw;
|
import io.anuke.ucore.core.Draw;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.util.*;
|
import io.anuke.ucore.util.Bits;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
import io.anuke.ucore.util.Strings;
|
||||||
|
import io.anuke.ucore.util.Tmp;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.AbstractList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
public class Conveyor extends Block{
|
public class Conveyor extends Block{
|
||||||
private static ItemPos pos1 = new ItemPos();
|
private static ItemPos pos1 = new ItemPos();
|
||||||
@@ -182,6 +187,7 @@ public class Conveyor extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(DataInputStream stream) throws IOException{
|
public void read(DataInputStream stream) throws IOException{
|
||||||
|
convey.clear();
|
||||||
int amount = stream.readInt();
|
int amount = stream.readInt();
|
||||||
convey.ensureCapacity(amount);
|
convey.ensureCapacity(amount);
|
||||||
|
|
||||||
|
|||||||
BIN
kryonet/build/libs/kryonet-release.jar
Normal file
BIN
kryonet/build/libs/kryonet-release.jar
Normal file
Binary file not shown.
2
kryonet/build/tmp/jar/MANIFEST.MF
Normal file
2
kryonet/build/tmp/jar/MANIFEST.MF
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
|
||||||
@@ -133,6 +133,11 @@ public class KryoServer implements ServerProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPingFor(int connection) {
|
||||||
|
return getByID(connection).getReturnTripTime();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(Class<?>... types) {
|
public void register(Class<?>... types) {
|
||||||
for(Class<?> c : types){
|
for(Class<?> c : types){
|
||||||
|
|||||||
Reference in New Issue
Block a user