Exemplo n.º 1
0
 public override void Set(string player, BaseGame baseGame)
 {
     ConnectFour setConnectFour = (ConnectFour)baseGame;
     lastSet = setConnectFour;
     if (setConnectFour.Situation == GameSituation.Disconnect)
     {
         serverMain.RemoveGame(this);
     }
     else if (setConnectFour.Situation == GameSituation.Win)
     {
         Packet packet = new Packet();
         packet.Flag = Flag.Connect4;
         String you = setConnectFour.Opponent;
         setConnectFour.Opponent = setConnectFour.You;
         setConnectFour.You = you;
         packet.Data = setConnectFour;
         serverMain.SendResolvedGameSituation(you, packet);
         serverMain.RemoveGame(this);
     }
     else
     {
         sets++;
         if (player == Players[0])
         {
             game[setConnectFour.X-1][setConnectFour.Y-1] = 1;
         }
         else
         {
             game[setConnectFour.X-1][setConnectFour.Y-1] = 2;
         }
         GameCheck();
     }
 }
Exemplo n.º 2
0
 public abstract void Set(string player, BaseGame baseGame);
Exemplo n.º 3
0
 public override void Set(string player, BaseGame baseGame)
 {
     RockPaperScissorsLizardSpock rockPaperScissorsLizardSpock = (RockPaperScissorsLizardSpock) baseGame;
     if (rockPaperScissorsLizardSpock.Situation == GameSituation.Disconnect)
     {
         serverMain.RemoveGame(this);
     }
     else if (rockPaperScissorsLizardSpock.Situation == GameSituation.Win)
     {
         Packet packet = new Packet();
         packet.Flag = Flag.RPSLS;
         string you = rockPaperScissorsLizardSpock.Opponent;
         rockPaperScissorsLizardSpock.Opponent = rockPaperScissorsLizardSpock.You;
         rockPaperScissorsLizardSpock.You = you;
         packet.Data = rockPaperScissorsLizardSpock;
         serverMain.SendResolvedGameSituation(you, packet);
         serverMain.RemoveGame(this);
     }
     else
     {
         ChosenHands.Add(player, rockPaperScissorsLizardSpock.YourHand);
         if (ChosenHands.Count == 2)
         {
             GameCheck();
             Rounds.Add(ChosenHands.ToDictionary(
                 x => x.Key,
                 y => y.Value
                 ));
         }
     }
 }