Exemplo n.º 1
0
 private static void GameInfoOnCardPlayed(CardPlayedEventArgs eventArgs)
 {
     //Console.WriteLine("{0} played {1}", eventArgs.Position, eventArgs.PlayAction.Card);
     ////Console.ReadKey();
 }
        private void GameOnCardPlayed(CardPlayedEventArgs eventArgs)
        {
            this.Draw();

            if (eventArgs.Position == this.Position)
            {
                // Current player bid event
                return;
            }

            var position = eventArgs.Position;
            for (int i = eventArgs.CurrentTrickCards.Count() - 1; i >= 0; i--)
            {
                if (position == PlayerPosition.South)
                {
                    ConsoleHelper.DrawTextBoxTopLeft(eventArgs.CurrentTrickCards.ToList()[i].ToString(), 40 - (eventArgs.CurrentTrickCards.ToList()[i].ToString().Length / 2), Settings.ConsoleHeight - 9);
                    if (position == eventArgs.Position && eventArgs.PlayAction.Belote)
                    {
                        ConsoleHelper.DrawTextBoxTopLeft("Belote", 40 - ("Belote".Length / 2), Settings.ConsoleHeight - 10);
                    }
                }

                if (position == PlayerPosition.East)
                {
                    ConsoleHelper.DrawTextBoxTopRight(eventArgs.CurrentTrickCards.ToList()[i].ToString(), 80 - 2 - this.Game[PlayerPosition.East].Name.Length - 2, 8);
                    if (position == eventArgs.Position && eventArgs.PlayAction.Belote)
                    {
                        ConsoleHelper.DrawTextBoxTopLeft("Belote", 80 - 2 - this.Game[PlayerPosition.East].Name.Length - 2 - eventArgs.CurrentTrickCards.ToList()[i].ToString().Length - 2, 8);
                    }
                }

                if (position == PlayerPosition.North)
                {
                    ConsoleHelper.DrawTextBoxTopLeft(eventArgs.CurrentTrickCards.ToList()[i].ToString(), 40 - (eventArgs.CurrentTrickCards.ToList()[i].ToString().Length / 2), 4);
                    if (position == eventArgs.Position && eventArgs.PlayAction.Belote)
                    {
                        ConsoleHelper.DrawTextBoxTopLeft("Belote", 40 - ("Belote".Length / 2), 7);
                    }
                }

                if (position == PlayerPosition.West)
                {
                    ConsoleHelper.DrawTextBoxTopLeft(eventArgs.CurrentTrickCards.ToList()[i].ToString(), this.Game[PlayerPosition.West].Name.Length + 3, 8);
                    if (position == eventArgs.Position && eventArgs.PlayAction.Belote)
                    {
                        ConsoleHelper.DrawTextBoxTopLeft("Belote", this.Game[PlayerPosition.West].Name.Length + 3 + eventArgs.CurrentTrickCards.ToList()[i].ToString().Length + 2, 8);
                    }
                }

                position = position.PreviousPosition();
            }

            ConsoleHelper.WriteOnPosition(string.Format("Played {0} played {1}.", this.Game[eventArgs.Position].Name, eventArgs.PlayAction.Card), 0, Settings.ConsoleHeight - 3);
            ConsoleHelper.WriteOnPosition("Press enter to continue...", 0, Settings.ConsoleHeight - 2);
            Console.ReadLine();
        }
 private void AddCardPlayed(CardPlayedEventArgs eventArgs)
 {
     if (eventArgs.Position != this.Position)
     {
         this.remainedInGame.Remove(eventArgs.PlayAction.Card);
     }
     this.onTheTable.Add(eventArgs.PlayAction.Card);
     if (this.onTheTable.Count == 4)
     {
         if (this.myPartnerBurst == null && this.startsFirst == this.MyPartnerPosition && onTheTable.ElementAt(0).GetValue(this.currentContract) < onTheTable.Max().GetValue(this.currentContract))
         {
             this.myPartnerBurst = onTheTable.ElementAt(0).Suit;
         }
         this.onTheTable.Clear();
     }
 }