Exemple #1
0
 public void HandleOnCommunicationServer(Messages.CommunicationServer.IConnection connection, Messages.CommunicationServer.IReceiver receiver = null)
 {
     if (receiver.IsGameMaster)
     {
         IReceiver rec        = connection.Receivers.Find(p => p.Id == this.playerId);
         var       serializer = new Messages.XmlHandling.Serializer(this);
         rec.SendMessage(serializer.Serialize());
     }
     else
     {
         this.playerId = receiver.Id;
         IReceiver rec        = connection.Receivers.Find(p => p.Id == this.playerId);
         var       serializer = new Messages.XmlHandling.Serializer(this);
         rec.SendMessage(serializer.Serialize());
     }
 }
Exemple #2
0
        public void HandleOnCommunicationServer(Messages.CommunicationServer.IConnection server, Messages.CommunicationServer.IReceiver receiver)
        {
            var game = server.CreateGame(receiver, this);

            if (game == null)
            {
                var msg        = new RejectGameRegistration();
                var serializer = new Messages.XmlHandling.Serializer(msg);
                receiver.SendMessage(serializer.Serialize());
            }
            else
            {
                var msg        = new ConfirmGameRegistration(game.GameId);
                var serializer = new Messages.XmlHandling.Serializer(msg);
                receiver.SendMessage(serializer.Serialize());
            }
        }