Exemplo n.º 1
0
        private void DrawGame()
        {
            var game = Data.DataManager.Game;

            if (Program.State == (int)GameState.Game)
            {
                for (int i = 0; i < (int)CardType.Length; i++)
                {
                    var spaceSprite = new RectangleShape(new Vector2f(Card.CardWidth, Card.CardHeight));
                    spaceSprite.FillColor = default(Color);
                    int top  = Card.GetPresetTop(i);
                    int left = 0;

                    switch (i)
                    {
                    case (int)CardType.EnemyField:
                        spaceSprite.FillColor = new Color(255, 0, 0);
                        break;

                    case (int)CardType.EnemyHeld:
                        spaceSprite.FillColor = new Color(255, 0, 0);
                        break;

                    case (int)CardType.MyField:
                        spaceSprite.FillColor = new Color(0, 255, 0);
                        break;

                    case (int)CardType.MyHeld:
                        spaceSprite.FillColor = new Color(0, 255, 0);
                        break;
                    }

                    for (int x = 0; x < 7; x++)
                    {
                        left = Card.IndexToLeft(x);

                        spaceSprite.Position = new Vector2f(left, top);
                        BackBuffer.Draw(spaceSprite);
                    }
                }


                foreach (var card in game.Cards)
                {
                    // Exit out early.
                    if (card.CardID < 0)
                    {
                        break;
                    }
                    if (card.SurfaceID < 0)
                    {
                        card.SurfaceID = GetSurfaceIndex(card.SurfaceName, SurfaceType.Card);
                    }

                    if (card.SurfaceID >= 0)
                    {
                        int x  = card.X;
                        int y  = card.Y;
                        int id = card.SurfaceID;

                        if (card.Type == CardType.EnemyDeck || card.Type == CardType.MyDeck)
                        {
                            id = Card.BlankID;
                        }

                        var surface = _surface[(int)SurfaceType.Card][id].sprite;
                        surface.Position = new Vector2f(x, y);
                        surface.Scale    = new Vector2f(Card.CardWidth / surface.Texture.Size.X, Card.CardHeight / surface.Texture.Size.Y);
                        BackBuffer.Draw(surface);
                    }
                }
            }
        }