Esempio n. 1
0
 public void PlayCard(ActionObject action, IPEndPoint groupEP, MatchController match)
 {
     if (action.Player != match.CurrentPlayer)
     {
         return;
     }
     match.PlayCard(action.Player, action.Card);
 }
Esempio n. 2
0
 public void Guess(ActionObject action, IPEndPoint groupEP, MatchController match)
 {
     if (action.Player != match.CurrentPlayer)
     {
         return;
     }
     match.Guess(action.Player, action.Guess);
 }
Esempio n. 3
0
 public void UpdateGameState(MatchController match)
 {
     foreach (var p in PlayersIps.Keys)
     {
         var message = new ResponseMessage
         {
             Id            = Guid.NewGuid().ToString(),
             GameStates    = GameState.MountGameStates(match.Guesses, match.Wins),
             GuessingRound = match.IsGuessing,
             Table         = match.Table.ToList(),
             CanPlay       = p == match.CurrentPlayer,
             AdjustPlayer  = true,
             Player        = match.Players.Where(x => x.Id == p.Id).FirstOrDefault(),
             Players       = match.Players
         };
         var bytes = GetMessageBytes(message);
         _udpClient.Send(bytes, bytes.Length, PlayersIps[p]);
     }
 }
Esempio n. 4
0
 public void AddPlayer(ActionObject action, IPEndPoint groupEP, MatchController match)
 {
     match.AddPlayer(action.Player);
     PlayersIps.Add(action.Player, groupEP);
     UpdateGameState(match);
 }
Esempio n. 5
0
 private void StartGame(ActionObject action, IPEndPoint groupEP, MatchController match)
 {
     match.StartGame();
 }