Esempio n. 1
0
 public bool UpdateDeckPile(GameTime gameTime, MouseState mouse, PlayerHand hand)
 {
     isPlayer1 = true;
     if (!SSEngine.IsACardMoving)
     {
         if (mouse.LeftButton == ButtonState.Pressed &&
             deckPile[0].CollisionRectangle.Contains(mouse.X, mouse.Y))
         {
             SSEngine.IsACardMoving = true;
             deckPile[2].IsMoving   = true;
             deckPile[2].CourseToCard(hand.GetNextHandPosition());
             elapsedTime = gameTime.TotalGameTime.TotalMilliseconds;
             drawEffect.Play();
             if (SSEngine.VersionStage == MenuStage.LAN)
             {
                 SSEngine.LANClient.Send((byte)NetGame.Draw);
             }
             else if (SSEngine.VersionStage == MenuStage.Online)
             {
                 NetOutgoingMessage msg = SSEngine.Peer.CreateMessage();
                 msg.Write((byte)NetGame.Draw);
                 SSEngine.Peer.SendMessage(msg, SSEngine.Peer.Connections[0], NetDeliveryMethod.ReliableOrdered);
             }
         }
     }
     else if (deckPile[2].Time >= gameTime.TotalGameTime.TotalMilliseconds - elapsedTime && deckPile[2].IsMoving)
     {
         deckPile[2].Move(gameTime, deckPile[0].Position, hand.GetNextHandPosition());
     }
     else if (deckPile[2].Time < gameTime.TotalGameTime.TotalMilliseconds - elapsedTime && deckPile[2].IsMoving)
     {
         hand.AddCardToHand(deckPile[deckPile.Count - 1].Clone());
         deckPile.RemoveAt(deckPile.Count - 1);
         deckPile[2].Position    = deckPile[0].Position;
         deckPile[2].Destination = deckPile[2].CollisionRectangle;
         SSEngine.IsACardMoving  = false;
         deckPile[2].IsMoving    = false;
         elapsedTime             = 0.0;
         setEffect.Play();
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            SSEngine.DeckSprites["AceClub"]      = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/AceClub"), RankValue.Ace, Suit.Club);
            SSEngine.DeckSprites["AceDiamond"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/AceDiamond"), RankValue.Ace, Suit.Diamond);
            SSEngine.DeckSprites["AceHearts"]    = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/AceHearts"), RankValue.Ace, Suit.Hearts);
            SSEngine.DeckSprites["AceSpades"]    = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/AceSpades"), RankValue.Ace, Suit.Spades);
            SSEngine.DeckSprites["DeuceClub"]    = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/DeuceClub"), RankValue.Deuce, Suit.Club);
            SSEngine.DeckSprites["DeuceDiamond"] = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/DeuceDiamond"), RankValue.Deuce, Suit.Diamond);
            SSEngine.DeckSprites["DeuceHearts"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/DeuceHearts"), RankValue.Deuce, Suit.Hearts);
            SSEngine.DeckSprites["DeuceSpades"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/DeuceSpades"), RankValue.Deuce, Suit.Spades);
            SSEngine.DeckSprites["ThreeClub"]    = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/ThreeClub"), RankValue.Three, Suit.Club);
            SSEngine.DeckSprites["ThreeDiamond"] = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/ThreeDiamond"), RankValue.Three, Suit.Diamond);
            SSEngine.DeckSprites["ThreeHearts"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/ThreeHearts"), RankValue.Three, Suit.Hearts);
            SSEngine.DeckSprites["ThreeSpades"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/ThreeSpades"), RankValue.Three, Suit.Spades);
            SSEngine.DeckSprites["FourClub"]     = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/FourClub"), RankValue.Four, Suit.Club);
            SSEngine.DeckSprites["FourDiamond"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/FourDiamond"), RankValue.Four, Suit.Diamond);
            SSEngine.DeckSprites["FourHearts"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/FourHearts"), RankValue.Four, Suit.Hearts);
            SSEngine.DeckSprites["FourSpades"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/FourSpades"), RankValue.Four, Suit.Spades);
            SSEngine.DeckSprites["FiveClub"]     = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/FiveClub"), RankValue.Five, Suit.Club);
            SSEngine.DeckSprites["FiveDiamond"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/FiveDiamond"), RankValue.Five, Suit.Diamond);
            SSEngine.DeckSprites["FiveHearts"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/FiveHearts"), RankValue.Five, Suit.Hearts);
            SSEngine.DeckSprites["FiveSpades"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/FiveSpades"), RankValue.Five, Suit.Spades);
            SSEngine.DeckSprites["SixClub"]      = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/SixClub"), RankValue.Six, Suit.Club);
            SSEngine.DeckSprites["SixDiamond"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/SixDiamond"), RankValue.Six, Suit.Diamond);
            SSEngine.DeckSprites["SixHearts"]    = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/SixHearts"), RankValue.Six, Suit.Hearts);
            SSEngine.DeckSprites["SixSpades"]    = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/SixSpades"), RankValue.Six, Suit.Spades);
            SSEngine.DeckSprites["SevenClub"]    = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/SevenClub"), RankValue.Seven, Suit.Club);
            SSEngine.DeckSprites["SevenDiamond"] = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/SevenDiamond"), RankValue.Seven, Suit.Diamond);
            SSEngine.DeckSprites["SevenHearts"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/SevenHearts"), RankValue.Seven, Suit.Hearts);
            SSEngine.DeckSprites["SevenSpades"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/SevenSpades"), RankValue.Seven, Suit.Spades);
            SSEngine.DeckSprites["EightClub"]    = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/EightClub"), RankValue.Eight, Suit.Club);
            SSEngine.DeckSprites["EightDiamond"] = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/EightDiamond"), RankValue.Eight, Suit.Diamond);
            SSEngine.DeckSprites["EightHearts"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/EightHearts"), RankValue.Eight, Suit.Hearts);
            SSEngine.DeckSprites["EightSpades"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/EightSpades"), RankValue.Eight, Suit.Spades);
            SSEngine.DeckSprites["NineClub"]     = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/NineClub"), RankValue.Nine, Suit.Club);
            SSEngine.DeckSprites["NineDiamond"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/NineDiamond"), RankValue.Nine, Suit.Diamond);
            SSEngine.DeckSprites["NineHearts"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/NineHearts"), RankValue.Nine, Suit.Hearts);
            SSEngine.DeckSprites["NineSpades"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/NineSpades"), RankValue.Nine, Suit.Spades);
            SSEngine.DeckSprites["TenClub"]      = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/TenClub"), RankValue.Ten, Suit.Club);
            SSEngine.DeckSprites["TenDiamond"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/TenDiamond"), RankValue.Ten, Suit.Diamond);
            SSEngine.DeckSprites["TenHearts"]    = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/TenHearts"), RankValue.Ten, Suit.Hearts);
            SSEngine.DeckSprites["TenSpades"]    = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/TenSpades"), RankValue.Ten, Suit.Spades);
            SSEngine.DeckSprites["JackClub"]     = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/JackClub"), RankValue.Jack, Suit.Club);
            SSEngine.DeckSprites["JackDiamond"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/JackDiamond"), RankValue.Jack, Suit.Diamond);
            SSEngine.DeckSprites["JackHearts"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/JackHearts"), RankValue.Jack, Suit.Hearts);
            SSEngine.DeckSprites["JackSpades"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/JackSpades"), RankValue.Jack, Suit.Spades);
            SSEngine.DeckSprites["QueenClub"]    = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/QueenClub"), RankValue.Queen, Suit.Club);
            SSEngine.DeckSprites["QueenDiamond"] = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/QueenDiamond"), RankValue.Queen, Suit.Diamond);
            SSEngine.DeckSprites["QueenHearts"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/QueenHearts"), RankValue.Queen, Suit.Hearts);
            SSEngine.DeckSprites["QueenSpades"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/QueenSpades"), RankValue.Queen, Suit.Spades);
            SSEngine.DeckSprites["KingClub"]     = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/KingClub"), RankValue.King, Suit.Club);
            SSEngine.DeckSprites["KingDiamond"]  = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/KingDiamond"), RankValue.King, Suit.Diamond);
            SSEngine.DeckSprites["KingHearts"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/KingHearts"), RankValue.King, Suit.Hearts);
            SSEngine.DeckSprites["KingSpades"]   = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/KingSpades"), RankValue.King, Suit.Spades);

            CardSprite cardBack        = new CardSprite(Game.Content.Load <Texture2D>(@"DeckOfCards/CardBack"));
            Vector2    discardPosition = new Vector2(3 * SSEngine.QuarterSceenWidth - 2 * cardBack.Texture.Width,
                                                     2 * SSEngine.QuarterSceenHeight - cardBack.Texture.Height / 2);
            CardSprite discardpileSprite = new CardSprite(Game.Content.Load <Texture2D>("DiscardPile"), discardPosition);

            discardPile  = new DiscardPile(discardpileSprite);
            deckPosition = new Vector2(3 * SSEngine.QuarterSceenWidth - discardpileSprite.Texture.Width / 2,
                                       2 * SSEngine.QuarterSceenHeight - discardpileSprite.Texture.Height / 2);
            CardSprite  deckSprite = new CardSprite(Game.Content.Load <Texture2D>("DeckPile"), deckPosition);
            SoundEffect setSound   = Game.Content.Load <SoundEffect>(@"Audio\CardSet");

            deckPile = new DeckPile(deckSprite, cardBack, Game.Content.Load <SoundEffect>(@"Audio\CardShuffle"),
                                    Game.Content.Load <SoundEffect>(@"Audio\DrawCard"), setSound);
            deckPile.ShuffleDeck();
            playerCards1 = new PlayerHand(Game.Content.Load <Texture2D>(@"Hand\ArrowButtonL"),
                                          Game.Content.Load <Texture2D>(@"Hand\ArrowButtonCoverL"), Game.Content.Load <Texture2D>(@"Hand\ArrowButtonR"),
                                          Game.Content.Load <Texture2D>(@"Hand\ArrowButtonCoverR"), cardBack.Texture, setSound);
            playerCards2 = new AIHand(cardBack.Texture, setSound);
            font         = Game.Content.Load <SpriteFont>(@"Fonts\GameFont");
            Texture2D overlay = Game.Content.Load <Texture2D>(@"Buttons\backBtnCover");

            backButton    = new SSButton(Game.Content.Load <Texture2D>(@"Buttons\SuitBackButton"), new Vector2(20f, 20f), overlay, MenuStage.Play);
            overlay       = Game.Content.Load <Texture2D>(@"Buttons\ButtonCover");
            endTurnButton = new Button(Game.Content.Load <Texture2D>(@"Buttons\SuitEndTurnButton"),
                                       new Vector2(3 * SSEngine.QuarterSceenWidth + discardpileSprite.Texture.Width,
                                                   2 * SSEngine.QuarterSceenHeight - overlay.Height / 2), overlay);
            panel = new SelectPanel(Game.Content, "Change To");
            base.LoadContent();
        }