package net.mueller_martin.turirun.network;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryonet.EndPoint;

public class TurirunNetwork {
	public static final int tcpPort = 1337;
	public static final int udpPort = 7331;

	// This registers objects that are going to be sent over the network
	public static void register(EndPoint endPoint) {
		Kryo kryo = endPoint.getKryo();

		kryo.register(Register.class);
		kryo.register(Character.class);
		kryo.register(AddCharacter.class);
		kryo.register(RemoveCharacter.class);
		kryo.register(UpdateCharacter.class);
		kryo.register(MoveCharacter.class);
	}

	public static class Register {
		public String nick;
		public int type;
	}

	public static class Character {
		public String nick;
		public int type, id;
		public float x, y;
	};

	public static class AddCharacter {
		public Character character;
	}

	public static class RemoveCharacter {
		public int id;
	}

	public static class UpdateCharacter {
		public int id;
		public float x, y;
	}

	public static class MoveCharacter {
		public float x, y;
	}
}

@@ -771,16 +771,27 @@
 type, id
+, direction
 ;%0A%09%09publ
@@ -994,16 +994,27 @@
 c int id
+, direction
 ;%0A%09%09publ
@@ -1084,19 +1084,30 @@
 c float x, y
+, direction
 ;%0A%09%7D%0A%7D%0A

Add direction to network objects