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 }); }
public void OnNewConnection(object sender, GameConnectionEventArgs e) { Console.WriteLine("Player connected"); AddConnection(e.Connection); if (players.Count >= 3) { Start(); } }
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")); } } } }
private void GameConnection_LocationRecieved(object sender, GameConnectionEventArgs <Point> e) { Point point = e.GameObject; Application.Current.Dispatcher.Invoke((Action <Point>)DropCoin, point); }
/// <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")); }