/// <summary> /// Called when the form is loaded. /// </summary> private void Monopyly_Load(object sender, EventArgs e) { // We start the messaging-client... m_messagingClient = new MessagingClient(); m_messagingClient.StartOfTournamentEvent += onStartOfTournament; m_messagingClient.StartOfGameEvent += onStartOfGame; m_messagingClient.BoardUpdateEvent += onBoardUpdate; m_messagingClient.PlayerInfoEvent += onPlayerInfo; }
/// <summary> /// Called when we receive a player-info update. /// </summary> private void onPlayerInfo(object sender, MessagingClient.PlayerInfoArgs e) { foreach(var playerInfo in e.PlayerInfo.player_infos) { ctrlBoard.UpdatePlayerInfo( playerInfo.player_number, playerInfo.net_worth, playerInfo.games_won, playerInfo.square, playerInfo.ms_per_turn); } }
/// <summary> /// Called when we get a board update. /// </summary> private void onBoardUpdate(object sender, MessagingClient.BoardUpdateArgs e) { ctrlBoard.BoardUpdate = e.BoardUpdate; }
/// <summary> /// Called when the tournament starts. /// </summary> private void onStartOfTournament(object sender, MessagingClient.StartOfTournamentArgs e) { ctrlBoard.SetPlayers(from p in e.StartOfTournament.player_infos select p.player_name); }