Ejemplo n.º 1
0
        public void HandleOnPlayer(Messages.PlayerInterfaces.IConnection connection)
        {
            var msg        = connection.Logic.AnswerForGameMessage(connection, this);
            var serializer = new Messages.XmlHandling.Serializer(msg);

            connection.SendMessage(serializer.Serialize());
        }
        public void HandleOnPlayer(Messages.PlayerInterfaces.IConnection connection)
        {
            Data msg = new Data();

            msg.gameFinished = connection.GameFinished;
            msg.GoalFields   = connection.Logic.GetGoalFields.ToArray();
            msg.TaskFields   = connection.Logic.GetTaskFields.ToArray();
            msg.Pieces       = new Piece[1] {
                connection.Logic.GetPiece
            };
            var serializer = new Messages.XmlHandling.Serializer(msg);

            connection.SendMessage(serializer.Serialize());
        }
Ejemplo n.º 3
0
        public void HandleOnPlayer(Messages.PlayerInterfaces.IConnection connection)
        {
            if (gameFinished == true)
            {
                Console.WriteLine("Game is finished");
                return;
            }
            connection.Logic.SetReceivedData(this.TaskFields, this.GoalFields, this.gameFinished, this.Pieces, this.PlayerLocation);
            var msg = connection.Logic.ChooseNextMessage(connection, this);

            if (msg != null)
            {
                var serializer = new Messages.XmlHandling.Serializer(msg);
                connection.SendMessage(serializer.Serialize());
            }
        }
 public void HandleOnPlayer(Messages.PlayerInterfaces.IConnection connection)
 {
     if (connection.Logic.TeamMembers.FirstOrDefault(x => x.id == this.senderPlayerId) != null)
     {
         Data msg = new Data();
         msg.gameFinished = connection.GameFinished;
         msg.GoalFields   = connection.Logic.GetGoalFields.ToArray();
         msg.TaskFields   = connection.Logic.GetTaskFields.ToArray();
         msg.Pieces       = new Piece[1] {
             connection.Logic.GetPiece
         };
         var serializer = new Messages.XmlHandling.Serializer(msg);
         connection.SendMessage(serializer.Serialize());
         AuthorizeKnowledgeExchange message = new AuthorizeKnowledgeExchange(connection.Guid.ToString(), connection.GameId, this.senderPlayerId);
         var serializer2 = new Messages.XmlHandling.Serializer(message);
         connection.SendMessage(serializer2.Serialize());
     }
 }
 public void HandleOnPlayer(Messages.PlayerInterfaces.IConnection connection)
 {
 }
Ejemplo n.º 6
0
 public void HandleOnPlayer(Messages.PlayerInterfaces.IConnection connection)
 {
     Console.WriteLine("Game Master disconnected, disconnecting the player");
     connection.Disconnect();
 }
Ejemplo n.º 7
0
 public void HandleOnPlayer(Messages.PlayerInterfaces.IConnection connection)
 {
     connection.Guid   = new Guid(privateGuid);
     connection.GameId = gameId;
 }
Ejemplo n.º 8
0
 public void HandleOnPlayer(Messages.PlayerInterfaces.IConnection connection)
 {
     Console.WriteLine("Player id #{0} disconnected", this.playerId);
     Thread.Sleep(2000);
 }