Ejemplo n.º 1
0
 private void FriendlyAI_LocationRecieved(object sender, GameConnectionEventArgs <Point> e)
 {
     Application.Current.Dispatcher.Invoke((Action <Point>)DropCoin, e.GameObject);
     GameConnection.SendMessage(new Message <object>()
     {
         Type = typeof(Point).ToString(), Data = e.GameObject
     });
 }
Ejemplo n.º 2
0
 public void OnNewConnection(object sender, GameConnectionEventArgs e)
 {
     Console.WriteLine("Player connected");
     AddConnection(e.Connection);
     if (players.Count >= 3)
     {
         Start();
     }
 }
Ejemplo n.º 3
0
 public void OnPlayerDropped(object sender, GameConnectionEventArgs e)
 {
     lock (players)
     {
         if (players.ContainsKey(e.Connection))
         {
             Player dropped_player = players[e.Connection];
             players.Remove(e.Connection);
             foreach (Player player in players.Values)
             {
                 Send(player, new GameCommand("Message", "Player " + dropped_player.Name + " dropped"));
             }
         }
     }
 }
Ejemplo n.º 4
0
        private void GameConnection_LocationRecieved(object sender, GameConnectionEventArgs <Point> e)
        {
            Point point = e.GameObject;

            Application.Current.Dispatcher.Invoke((Action <Point>)DropCoin, point);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Passes messages sent from the opponent to the game chat.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e">message</param>
 private void GameConnection_MessageRecieved(object sender, GameConnectionEventArgs <string> e)
 {
     Application.Current.Dispatcher.Invoke((Action <object>)AddMessage, new Message(e.GameObject, "Them"));
 }