Esempio n. 1
0
        public void LoadGroupCards(DirectoryInfo dir, ContentManager content, Texture2D coverImage, GraphicsDeviceManager graphics, GameState gameState)
        {
            var randomCardManager = new RandomCardManager(gameState.MemoryMatrixSizeHeight, gameState.MemoryMatrixSizeWidth);

            int counter = 0;
            foreach(FileInfo fileInfo in dir.GetFiles())
            {
                counter++;
                var cardTexture = content.Load<Texture2D>("Cards/Math/Integrals/" + fileInfo.Name.Replace(".xnb", ""));
                var rect = new Texture2D(graphics.GraphicsDevice, coverImage.Width + 6, coverImage.Height + 4);
                var data = new Color[rect.Height * rect.Width];
                for (int k = 0; k < data.Length; ++k) data[k] = Color.White;
                rect.SetData(data);

                gameState.PlaceRandomCard(counter, counter % 2 == 0 ? (counter - 1) : (counter + 1), randomCardManager, coverImage, cardTexture, rect,
                                fileInfo.Name);
            }
        }
Esempio n. 2
0
        public void ResetGame()
        {
            //reset player points
            Player1.Points = 0;
            Player2.Points = 0;

            Card[][] copyCards = CopyCards();

            //reset cards
            var randomCardManager = new RandomCardManager(_memoryMatrixSizeHeight, _memoryMatrixSizeWidth);
            for(int i = 0; i < _memoryMatrixSizeHeight; i++)
            {
                for(int j = 0; j < _memoryMatrixSizeWidth; j++)
                {
                    copyCards[i][j].Reset();
                    PlaceRandomCard(copyCards[i][j].ID, copyCards[i][j].PairCardID, randomCardManager, copyCards[i][j].Cover, copyCards[i][j].Face, copyCards[i][j].Frame, copyCards[i][j].Value);
                }
            }

            //reset open cards
            OpenCard1 = null;
            OpenCard2 = null;

            //reset question message
            Message.Message = "";
        }
Esempio n. 3
0
        public void PlaceRandomCard(int id, int pairId, RandomCardManager randomCardManager, Texture2D coverImage, Texture2D card, Texture2D rect, string value)
        {
            RandomCardManager.RandomCardPlace randomCardPlace = randomCardManager.GetNext();
            int offsetY = randomCardPlace.J * (coverImage.Height + 10) + CardOffY;
            int offsetX = randomCardPlace.I * (coverImage.Width + 23) + CardOffX;

            Cards[randomCardPlace.I][randomCardPlace.J] =
                new Card(offsetX, offsetY, coverImage, card, rect, Card.CardAnimation.Cover, id, pairId, value);
        }