public void SendUnityGameMessage(UnityGameMessage unityGameMessage)
 {
     unityGameMessage.playerId = NetworkSettings.instance.username;
     ClientMessage clientMessage = new ClientMessage();
     clientMessage.unityGameMessage = unityGameMessage;
     ActorSystem.instance.client.Send(Serialize(clientMessage));
 }
Exemplo n.º 2
0
 public AsyncUdpClient(string host, int port, string _playerId, int authtoken, bool measure=false)
 {
     playerId = _playerId;
     this.authtoken = authtoken;
     this.host = host;
     this.port = port;
     clientMessage = CreateClientMessage ();
     receivedPlayerConnected = false;
 }
Exemplo n.º 3
0
 public ClientMessage CreateClientMessage()
 {
     Player player = new Player();
     player.id = playerId;
     player.authtoken = authtoken;
     ClientMessage clientMessage = new ClientMessage ();
     clientMessage.connection_type = connectionType;
     clientMessage.player = player;
     return clientMessage;
 }
 private byte[] Serialize(ClientMessage message)
 {
     MemoryStream stream = new MemoryStream();
     Serializer.Serialize(stream, message);
     return stream.ToArray();
 }