Exemplo n.º 1
0
        private void UpdateCards()
        {
            cards = new List <CardSlot>();
            var deckCards = selectMethod.GetCards();
            var margin    = (Width - 2 * 150 - 120) / (deckCards.Length - 1); //所以必须至少2选一,不然会除零错

            for (int i = 0; i < deckCards.Length; i++)
            {
                var card = new CardSlot();
                card.SetSlotCard(deckCards[i]);
                card.Location = new Point(margin * i + 150, 100);
                card.Size     = new Size(120, 120);
                card.BgColor  = Color.Transparent;

                cards.Add(card);
            }
        }
Exemplo n.º 2
0
        public void Init(Player p, ICardSelectMethod method)
        {
            canClick              = true;
            selectMethod          = method;
            selectMethod.Selector = this;
            selectMethod.Init(p);
            BackColor = Color.FromArgb(100, Color.Black);

            region.ClearRegion();
            var cardCount = method.GetCards().Length;
            var margin    = (Width - 2 * 150 - 120) / (cardCount - 1);

            for (int i = 0; i < cardCount; i++)
            {
                region.AddRegion(new SwitchButtonRegion(i + 1, margin * i + 150, 100, 120, 120, "ErrorButton.PNG", ""));
            }

            UpdateCards();
        }