Beispiel #1
0
 public void ShowBooster(List <Card> cards)
 {
     if (InvokeRequired)
     {
         Delegate d = new ShowCardsCallBack(ShowBooster);
         this.Invoke(d, cards);
     }
     else
     {
         headlineLabel.Text = "PICK A CARD BITCH";
         // !!!
         for (int i = 0; i < cards.Count; i++)
         {
             // !!!
             string image_filename = image_folder + "/" + cards[i].Name + ".jpg";
             booster_boxes[i].BackgroundImage = Image.FromFile(image_filename);
             booster_boxes[i].Tag             = cards[i].Id;
             booster_boxes[i].Enabled         = true;
         }
         boosterContainer.Show();
         if (wonder)
         {
             pbox_MouseClick(booster_boxes.First(), new MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 0, 0, 0, 0));
         }
         else
         {
             pbox_MouseClick(booster_boxes.First(), new MouseEventArgs(System.Windows.Forms.MouseButtons.Right, 0, 0, 0, 0));
             wonder = true;
         }
     }
 }
Beispiel #2
0
 public void DisplayBoard(List <Card> cards)
 {
     if (InvokeRequired)
     {
         Delegate d = new ShowCardsCallBack(DisplayBoard);
         this.Invoke(d, cards);
     }
     else
     {
         // !!!
         if (cards.Count() > card_boxes.Count())
         {
             for (int i = 0; i < cards.Count() - card_boxes.Count(); i++)
             {
                 PictureBox pbox = new PictureBox();
                 pbox.MouseDown += pbox_MouseDown;
                 pbox.MouseUp   += pbox_MouseUp;
                 card_boxes.Add(pbox);
             }
         }
         var groups = cards.OrderBy(card => card.Color).GroupBy(card => card.Color);
         int j      = 0;
         int k      = 0;
         boardContainer.Controls.SetChildIndex(wonderBox, 0);
         foreach (var group in groups)
         {
             int i = 0;
             foreach (var card in group)
             {
                 PictureBox pbox = card_boxes[k];
                 pbox.Parent = boardContainer;
                 pbox.Left   = wonderBox.Left - 44 * (i + 1) + 220 * j;
                 pbox.Top    = wonderBox.Top - 80 * (i + 1);
                 pbox.Width  = 208;
                 pbox.Height = 320;
                 string image_filename = image_folder + "/" + card.Name + ".jpg";
                 pbox.BackgroundImage = Image.FromFile(image_filename);
                 pbox.Tag             = i + j * 10 + 1;
                 boardContainer.Controls.SetChildIndex(pbox, i + j * 10 + 1);
                 i++;
                 k++;
             }
             j++;
         }
         DrawTierBoxes();
     }
 }