예제 #1
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);

            cardSlot  = Content.Load <Texture2D>("ui/card_slot");
            cardBack  = Content.Load <Texture2D>("deck/card_back_green");
            refreshMe = Content.Load <Texture2D>("ui/refresh");
            newGame   = Content.Load <Texture2D>("ui/new_game");
            metaSmug  = Content.Load <Texture2D>("ui/smug-logo");
            debug     = Content.Load <Texture2D>("ui/wrench");
            undo      = Content.Load <Texture2D>("ui/undo");
            solve     = Content.Load <Texture2D>("ui/solve");
            paused    = Content.Load <Texture2D>("ui/paused");
            debugFont = Content.Load <SpriteFont>("ui/Arial");

            soundFX = new List <SoundEffect> {
                Content.Load <SoundEffect>("audio/card-kick"),
                Content.Load <SoundEffect>("audio/card-parent"),
                Content.Load <SoundEffect>("audio/card-play"),
                Content.Load <SoundEffect>("audio/card-restack"),
                Content.Load <SoundEffect>("audio/card-undo"),
                Content.Load <SoundEffect>("audio/card-bounce")
            };

            gameWinFX = Content.Load <SoundEffect>("audio/game-win");
            popFX     = Content.Load <SoundEffect>("audio/pop");

            dragonDrop = new DragonDrop <IDragonDropItem>(this, viewport);


            // table creates a fresh table.deck
            table = new TableClassic(this, spriteBatch, dragonDrop, cardBack, cardSlot, 20, 30, soundFX);

            table.muteSound = Properties.Settings.Default.mute;

            // load up the card assets for the new deck
            foreach (var card in table.drawPile.cards)
            {
                var location = "deck/" + card.suit + card.rank;
                card.SetTexture(Content.Load <Texture2D>(location));
            }

            table.InitializeTable();

            table.SetTable();

            Components.Add(dragonDrop);

            // more confetti stuff
            var textures = new List <Color> {
                new Color(255, 234, 142),
                new Color(129, 232, 138),
                new Color(239, 133, 189)
            }.Select(c => GeometricTextureFactory.Rectangle(GraphicsDevice, 10, 18, c))
            .ToList().AsReadOnly();

            confetti = new Confetti(textures);
        }
예제 #2
0
 public Table(SpriteBatch spriteBatch, DragonDrop <IDragonDropItem> dragonDrop, Texture2D cardBack, Texture2D slotTex, int stackOffsetH, int stackOffsetV)
 {
     this.spriteBatch      = spriteBatch;
     this.dragonDrop       = dragonDrop;
     stackOffsetHorizontal = stackOffsetH;
     stackOffsetVertical   = stackOffsetV;
     this.cardBack         = cardBack;
     this.slotTex          = slotTex;
 }
예제 #3
0
        public TableClassic(GameplayScreen game, SpriteBatch spriteBatch, DragonDrop <IDragAndDropItem> dd, TileGrid tg, Board plBoard, Board cBoard, SpriteFont font, ScreenManager scrMgr, AudioManager audMgr,
                            int stackOffsetH, int stackOffsetV,
                            Texture2D bCircle, Texture2D bCross, Texture2D rCircle, Texture2D rCross)
            : base(game, spriteBatch, dd, font, scrMgr, audMgr, stackOffsetH, stackOffsetV, bCircle, bCross, rCircle, rCross)
        {
            this.game = game;

            tileGrid = tg;
            p1Board  = plBoard;
            cpuBoard = cBoard;
        }
예제 #4
0
        public Table(GameplayScreen game, SpriteBatch spriteBatch, DragonDrop <IDragAndDropItem> dragonDrop, SpriteFont font, ScreenManager scrMgr, AudioManager audMgr, int stackOffsetH, int stackOffsetV,
                     Texture2D bCircle, Texture2D bCross, Texture2D rCircle, Texture2D rCross)
        {
            this.game        = game;
            this.spriteBatch = spriteBatch;
            this.dragonDrop  = dragonDrop;
            screenManager    = scrMgr;
            audioManager     = audMgr;
            enterMoveFont    = font;

            blueCircle = bCircle;
            blueCross  = bCross;
            redCircle  = rCircle;
            redCross   = rCross;
        }
예제 #5
0
        public TableClassic(Game game, SpriteBatch spriteBatch, DragonDrop <IDragonDropItem> dd, Texture2D cardBack, Texture2D slotTex, int stackOffsetH, int stackOffsetV, List <SoundEffect> soundFX)
            : base(spriteBatch, dd, cardBack, slotTex, stackOffsetH, stackOffsetV)
        {
            this.game = game;

            kickSound    = soundFX[0];
            parentSound  = soundFX[1];
            playSound    = soundFX[2];
            restackSound = soundFX[3];
            undoSound    = soundFX[4];
            bounceSound  = soundFX[5];

            // create a fresh card deck
            drawPile = new Deck(this, DeckType.playing, cardBack, slotTex, spriteBatch, stackOffsetH, stackOffsetV)
            {
                type = StackType.deck
            };
            drawPile.freshDeck();

            Tween.TweenerImpl.SetLerper <Vector2Lerper>(typeof(Vector2));
        }