public void Challenge(IFoosPlayer playerToChallenge) { Task.Factory.StartNew(() => { Thread.Sleep(2000); var repsonse = new ChallengeResponse(playerToChallenge, m_Random.Next(2) == 0); if (ChallengeResponse != null) ChallengeResponse(repsonse); }); }
public void Respond(ChallengeResponse response) { m_WebSocket.SendAsJson(new { action = "respond", challenger = response.Player.Email, response = response.Accepted.ToString() }); }
private void NetworkServiceOnChallengeResponse(ChallengeResponse challengeResponse) { var player = m_PlayerLineUp.FirstOrDefault(p => p.Email.Equals(challengeResponse.Player.Email, StringComparison.OrdinalIgnoreCase)); if (player != null) { player.GameState = challengeResponse.Accepted ? GameState.Accepted : GameState.Declined; if (player.GameState == GameState.Declined) RemovePlayer(player); if (IsGameReadyToStart) { StatusMessage = c_ReadyToStart; // This property is not automatically updated because it's a computed value OnPropertyChanged("IsGameReadyToStart"); } } else { if (challengeResponse.Accepted) { m_NetworkService.CancelGame(new[] { challengeResponse.Player }); } } }
public void Respond(ChallengeResponse response) { }