コード例 #1
0
        public Bank()
        {
            resources = new List <ResourceCard>();

            //Load the development card images.
            for (int i = 0; i < 6; i++)
            {
                devCardImages[i] = new Bitmap(devCardImageNames[i]);
            }

            developmentCards = new Deck(25);
            //Create the development cards
            foreach (DevelopmentCard.DevCardType dct in fourPlayerDevCards)
            {
                DevelopmentCard dc = new DevelopmentCard();
                dc.setType(dct);
                developmentCards.putCard(dc);
            }
            developmentCards.shuffleDeck();

            for (int i = 0; i < 19; i++)
            {
                resources.Add(new ResourceCard(Board.ResourceType.Brick));
                resources.Add(new ResourceCard(Board.ResourceType.Ore));
                resources.Add(new ResourceCard(Board.ResourceType.Sheep));
                resources.Add(new ResourceCard(Board.ResourceType.Wheat));
                resources.Add(new ResourceCard(Board.ResourceType.Wood));
            }
        }
コード例 #2
0
        public DevelopmentCard takeDevelopmentCard(DevelopmentCard.DevCardType cardType)
        {
            DevelopmentCard theCard = null;

            foreach (DevelopmentCard c in onHandDevelopmentCards)
            {
                if (c.getType() == cardType)
                {
                    theCard = c;
                }
            }
            onHandDevelopmentCards.Remove(theCard);
            updateDevelopmentCards();
            return(theCard);
        }
コード例 #3
0
        private void updateDevelopmentCards()
        {
            this.pnlDevCards.Controls.Clear();

            int row = 0;
            int col = 0;

            for (int i = 0; i < onHandDevelopmentCards.Count; i++)
            {
                DevelopmentCard devC = onHandDevelopmentCards[i];
                pnlDevCards.Controls.Add(devC);
                float newX = pnlDevCards.Width / 2 - 12;
                float newY = (DevelopmentCard.devCardSize.Height * newX) / DevelopmentCard.devCardSize.Width;
                devC.Size     = new Size((int)newX, (int)newY);
                devC.Location = new Point(col * devC.Width, row * devC.Height);
                col++;
                if (col > 1)
                {
                    col = 0;
                    row++;
                }
            }
        }
コード例 #4
0
 public void giveDevelopmentCard(DevelopmentCard card)
 {
     onHandDevelopmentCards.Add(card);
     updateDevelopmentCards();
 }