Exemplo n.º 1
0
 // Игрок делает ход
 public void PlayerMakeMove(Card Card)
 {
     if (Card == null)
         return;
     ServerConnection.ExecuteMessageWithoutResult(new Message(Messages.MESSAGE_GAME_GAMING_PLAYERMOVE,
         String.Format("Card={0}", Card.ToString())));
 }
Exemplo n.º 2
0
 // Отображение хоженой карты
 public void DrawMovedCard(int ServerPlace, Card Card)
 {
     int graphicPlace = CoordinatesTransmitor.ServerPlaceToGraphicPlace(ServerPlace, game.Information.Place);
     PictureBox cardBox = null;
     switch (graphicPlace)
     {
         case 1:
             {
                 cardBox = Player1MoveCard;
                 break;
             }
         case 2:
             {
                 cardBox = Player2MoveCard;
                 break;
             }
         case 3:
             {
                 cardBox = Player3MoveCard;
                 break;
             }
         case 4:
             {
                 cardBox = Player4MoveCard;
                 break;
             }
     }
     if (Card != null)
     {
         switch (Card.Suit)
         {
             case CardSuit.C_CLUBS:
                 {
                     cardBox.Image = Clubs.Images[(int)Card.Type];
                     break;
                 }
             case CardSuit.C_HEARTS:
                 {
                     cardBox.Image = Hearts.Images[(int)Card.Type];
                     break;
                 }
             case CardSuit.С_DIAMONDS:
                 {
                     cardBox.Image = Diamonds.Images[(int)Card.Type];
                     break;
                 }
             case CardSuit.C_SPADES:
                 {
                     cardBox.Image = Spades.Images[(int)Card.Type];
                     break;
                 }
         }
     }
     else
         cardBox.Image = null;
     cardBox.Invalidate();
 }
Exemplo n.º 3
0
        // Ход другого игрока
        public void RemindCardHandler(Message Msg)
        {
            Dictionary<string, string> cParams = Helpers.SplitCommandString(Msg.Msg);
            int cardPlace = Int32.Parse(cParams["Place"]);
            Card newCard = new Card(cParams["Card"]);
            LocalScore1 = Int32.Parse(cParams["Scores1"]);
            LocalScore2 = Int32.Parse(cParams["Scores2"]);
            int beloteRemind = Int32.Parse(cParams["Belote"]);
            if (beloteRemind == 1)
                BelotePlace = cardPlace;
            if (beloteRemind == 2)
                RebelotePlace = cardPlace;

            switch (cardPlace)
            {
                case 1:
                    {
                        P1Card = newCard;
                        break;
                    }
                case 2:
                    {
                        P2Card = newCard;
                        break;
                    }
                case 3:
                    {
                        P3Card = newCard;
                        break;
                    }
                case 4:
                    {
                        P4Card = newCard;
                        break;
                    }
            }
            gameForm.UpdateGraphics();
            if ((P1Card != null) && (P2Card != null) && (P3Card != null) && (P4Card != null))
            {
                BelotePlace = 0;
                RebelotePlace = 0;
                P1Card = null;
                P2Card = null;
                P3Card = null;
                P4Card = null;
                //Thread.Sleep(300);
                //gameForm.UpdateGraphics();
            }
        }
Exemplo n.º 4
0
 // Удаление карты из списка
 public void Remove(Card card)
 {
     list.Remove(card);
 }
Exemplo n.º 5
0
 // Проверяет наличие карты в списке
 public bool Exists(Card card)
 {
     return ((list.Find(c => (c.Type == card.Type) && (c.Suit == card.Suit))) != null);
 }
Exemplo n.º 6
0
 // Добавление карты в список
 public void Add(Card card)
 {
     list.Add(card);
 }
Exemplo n.º 7
0
 public void PutCard(Card card, int place)
 {
     cards[place - 1] = card;
 }
Exemplo n.º 8
0
 public void PutCard(Card card, int place)
 {
     if (list.Count == 0)
         Add();
     if (CurrentBribe.IsFull())
         Add();
     CurrentBribe.PutCard(card, place);
 }
Exemplo n.º 9
0
 // Ход другого игрока
 private void RemindCardHandler(Message Msg)
 {
     try
     {
         MessageResult cParams = new MessageResult(Msg);
         int cardPlace = Int32.Parse(cParams["Place"]);
         Card newCard = new Card(cParams["Card"]);
         int beloteRemind = Int32.Parse(cParams["Belote"]);
         gameData.Bribes.PutCard(newCard, cardPlace);
         gameData.LocalScores[BeloteTeam.TEAM1_1_3] = Int32.Parse(cParams["Scores1"]);
         gameData.LocalScores[BeloteTeam.TEAM2_2_4] = Int32.Parse(cParams["Scores2"]);
         if (beloteRemind == 1)
             gameData.Bribes.CurrentBribe.BelotePlace = cardPlace;
         else
         if (beloteRemind == 2)
             gameData.Bribes.CurrentBribe.RebelotePlace = cardPlace;
         if (OnUpdateGraphics != null)
             OnUpdateGraphics();
     }
     catch (Exception Ex)
     {
         throw new BeloteClientException("Произошла ошибка во время оповещения о карте, которой походил кто-то из игроков", Ex);
     }
 }
Exemplo n.º 10
0
 // Отрисовка карт последней взятки
 private void DrawLastBribeCard(int ServerPlace, Card Card)
 {
     int graphicPlace = game.ServerPlaceToGraphicPlace(ServerPlace);
     PictureBox cardBox = null;
     switch (graphicPlace)
     {
         case 1:
             {
                 cardBox = LastBribePlayer1PB;
                 break;
             }
         case 2:
             {
                 cardBox = LastBribePlayer2PB;
                 break;
             }
         case 3:
             {
                 cardBox = LastBribePlayer3PB;
                 break;
             }
         case 4:
             {
                 cardBox = LastBribePlayer4PB;
                 break;
             }
     }
     if (Card != null)
     {
         switch (Card.Suit)
         {
             case CardSuit.C_CLUBS:
                 {
                     cardBox.Image = Clubs.Images[(int)Card.Type];
                     break;
                 }
             case CardSuit.C_HEARTS:
                 {
                     cardBox.Image = Hearts.Images[(int)Card.Type];
                     break;
                 }
             case CardSuit.С_DIAMONDS:
                 {
                     cardBox.Image = Diamonds.Images[(int)Card.Type];
                     break;
                 }
             case CardSuit.C_SPADES:
                 {
                     cardBox.Image = Spades.Images[(int)Card.Type];
                     break;
                 }
         }
     }
     else
         cardBox.Image = null;
     cardBox.Invalidate();
 }