示例#1
0
        /// <summary>
        /// Adds the cards from the given War battle pile to the bottom of the hand
        /// </summary>
        /// <param name="warBattlePile">the War battle pile to add</param>
        public void AddCards(WarBattlePile warBattlePile)
        {
            // add all the cards
            while (!warBattlePile.Empty)
            {
                Card card = warBattlePile.TakeTopCard();
                if (card.FaceUp)
                {
                    card.FlipOver();
                }
                cards.Insert(0, card);

                // move the card to the hand location
                card.X = x;
                card.Y = y;
            }
        }
示例#2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // create the deck object and shuffle
            Deck deck = new Deck(Content, 0, 0);
            deck.Shuffle();

            // create the player hands and fully deal the deck into the hands
            for(int i = 0; i < 3;i ++ )/*while (deck.Empty != true)*/
            {
                player1.AddCard(deck.TakeTopCard());
                if (deck.Empty != true)
                {
                    player2.AddCard(deck.TakeTopCard());
                }
            }
            // create the player battle piles
            wbp1 = new WarBattlePile(400, 200);
            wbp2 = new WarBattlePile(400, 400);

            // create the player winner messages
            wmessage1 = new WinnerMessage(Content, 600, 100);
            wmessage2 = new WinnerMessage(Content,600,500);

            // create the menu buttons
            quitbutton = new MenuButton(Content, "quitbutton", 180, 450,GameState.Quit);
            flipbutton = new MenuButton(Content, "flipbutton", 180, 150,GameState.Flip);
            collectwinningsbutton = new MenuButton(Content, "collectwinningsbutton", 180, 300, GameState.CollectWinnings);

            // initialized the menu buttons
            collectwinningsbutton.Visible = false;
            flipbutton.Visible = true;
            quitbutton.Visible = true;
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // create the deck object and shuffle
            Deck deck = new Deck(Content, 100, 100);
            deck.Shuffle();

            // create the player hands and fully deal the deck into the hands
            playerOneHand = new WarHand(WINDOW_WIDTH / 2, 100);
            playerTwoHand = new WarHand(WINDOW_WIDTH / 2, WINDOW_HEIGHT - 100);

            for (int i = 0; i < 2; i++)
            {
                playerOneHand.AddCard(deck.TakeTopCard());
                playerTwoHand.AddCard(deck.TakeTopCard());
            }

            // create the player battle piles
            playerOneBP = new WarBattlePile(WINDOW_WIDTH / 2, 200);
            playerTwoBP = new WarBattlePile(WINDOW_WIDTH / 2, WINDOW_HEIGHT - 200);

            // create the player winner messages
            playerOneWM = new WinnerMessage(Content, WINDOW_WIDTH / 2 + 150, 100);
            playerTwoWM = new WinnerMessage(Content, WINDOW_WIDTH / 2 + 150, WINDOW_HEIGHT - 100);

            // create the menu buttons
            flipButton = new MenuButton(Content, "flipbutton", 150, 150, GameState.Flip);
            quitButton = new MenuButton(Content, "quitbutton", 150, 450, GameState.Quit);
            collectWinnings = new MenuButton(Content, "collectwinningsbutton", 150, 300, GameState.CollectWinnings);
        }
示例#4
0
        /// <summary>
        /// Adds the cards from the given War battle pile to the bottom of the hand
        /// </summary>
        /// <param name="warBattlePile">the War battle pile to add</param>
        public void AddCards(WarBattlePile warBattlePile)
        {
            // add all the cards
            while (!warBattlePile.Empty)
            {
                Card card = warBattlePile.TakeTopCard();
                if (card.FaceUp)
                {
                    card.FlipOver();
                }
                cards.Insert(0, card);

                // move the card to the hand location
                card.X = x;
                card.Y = y;
            }
        }