예제 #1
0
 public GameData()
 {
     GameStatus = TableStatus.BAZAR;
     TotalScores = new Scores();
     LocalScores = new Scores();
     LastDistributionScores = new Scores();
     Orders = new Orders();
     Bribes = new Bribes();
     AnnouncedBonuses = new BonusesTypes();
     AllCards = new CardList();
     PossibleCards = new CardList();
     IsMakingMove = false;
 }
예제 #2
0
 // Создание колоды для игры в блот
 public CardsDeck()
 {
     list = new CardList();
     random = new Random();
     // Добавляем в список все возможные карты в колоде
     foreach (CardSuit s in Enum.GetValues(typeof(CardSuit)))
     {
         if (s == CardSuit.C_NONE)
             continue;
         foreach (CardType t in Enum.GetValues(typeof(CardType)))
         {
             if (t == CardType.C_UNDEFINED)
                 continue;
             list.Add(new Card(t, s));
         }
     }
 }
예제 #3
0
 // Создание бонуса из строки
 public Bonus(string BonusString)
 {
     Cards = new CardList();
     // Если длина строки не равна четырем - то это никакой и не бонус
     if (BonusString.Length < 4)
     {
         Type = BonusType.BONUS_NONE;
         HighCard = CardType.C_UNDEFINED;
         Suit = CardSuit.C_NONE;
         IsTrump = false;
     }
     else
     {
         // Считываем из строки значения всех необходимых параметров бонуса
         Type = (BonusType)Int32.Parse(BonusString.Substring(0, 1));
         HighCard = (CardType)Int32.Parse(BonusString.Substring(1, 1));
         Suit = Helpers.StringToSuit(BonusString.Substring(2, 1));
         IsTrump = Helpers.StringToBool(BonusString.Substring(3, 1));
         if (BonusString.Length > 4)
         {
             Cards = new CardList(BonusString.Substring(4, BonusString.Length - 4));
         }
     }
 }
예제 #4
0
 // Переход хода к игроку
 public void NextPlayerHandler(Message Msg)
 {
     // Если это первый ход, то нужно огласить бонусы
     if (Bonuses != null)
     {
         // Если есть неоглашенные бонусы, то предлагаем их огласить
         if (Bonuses.Count != 0)
         {
             // Показываем форму
             BonusAnnounceForm form = new BonusAnnounceForm(this);
             form.ShowDialog();
             serverActions.PlayerAnnounceBonuses(Bonuses);
             // Обнуляем бонусы
             Bonuses = null;
         }
     }
     Dictionary<string, string> cParams = Helpers.SplitCommandString(Msg.Msg);
     // Получаем список возможных карт
     PossibleCards = new CardList(cParams["Cards"]);
     // Разрешаем игроку сделать ход
     IsMakingMove = true;
     gameForm.UpdateGraphics();
 }
예제 #5
0
 // Обработчик получения списка карт
 public void GetCardsHandler(Message Msg)
 {
     // MessageBox.Show("Раздача карт игрок " + Place.ToString());
     Dictionary<string, string> cParams = Helpers.SplitCommandString(Msg.Msg);
     string cardsStr = cParams["Cards"];
     int totalScore1 = Int32.Parse(cParams["Scores1"]);
     int totalScore2 = Int32.Parse(cParams["Scores2"]);
     LastScore1 = totalScore1 - TotalScore1;
     LastScore2 = totalScore2 - TotalScore2;
     TotalScore1 = totalScore1;
     TotalScore2 = totalScore2;
     LocalScore1 = 0;
     LocalScore2 = 0;
     Player1Order = null;
     Player2Order = null;
     Player3Order = null;
     Player4Order = null;
     IsMakingMove = false;
     Player1BonusesTypes = null;
     Player2BonusesTypes = null;
     Player3BonusesTypes = null;
     Player4BonusesTypes = null;
     P1Card = null;
     P2Card = null;
     P3Card = null;
     P4Card = null;
     Bonuses = null;
     BelotePlace = 0;
     RebelotePlace = 0;
     AllCards = new CardList(cardsStr);
     PossibleCards = AllCards;
     Status = TableStatus.BAZAR;
     betForm123 = new BetFromType123(this);
     gameForm.UpdateGraphics();
 }
예제 #6
0
 public void NewDistribution(CardList Cards, int Score1, int Score2)
 {
     AllCards = Cards;
     GameStatus = TableStatus.BAZAR;
     LocalScores[BeloteTeam.TEAM1_1_3] = 0;
     LocalScores[BeloteTeam.TEAM2_2_4] = 0;
     LastDistributionScores[BeloteTeam.TEAM1_1_3] = Score1 - TotalScores[BeloteTeam.TEAM1_1_3];
     LastDistributionScores[BeloteTeam.TEAM2_2_4] = Score2 - TotalScores[BeloteTeam.TEAM2_2_4];
     TotalScores[BeloteTeam.TEAM1_1_3] = Score1;
     TotalScores[BeloteTeam.TEAM2_2_4] = Score2;
     Orders.RenewPlayersOrders();
     IsMakingMove = false;
     Bribes.NewDistribution();
 }