示例#1
0
        public Cell(GuiGrid parent, Shape shape, ShapesAtlas texture, Texture2D backTexture, int row, int column)
        {
            this.parent = parent;
            Shape = shape;
            shapeTexture = texture;
            this.backTexture = backTexture;
            Row = row;
            Column = column;

            size = parent.CellSize;
            location = new Vector2((Column * size.X) + parent.Rectangle.X, (Row * size.Y) + parent.Rectangle.Y);

            Animation = Animation.FadeIn;
            State = GuiElementState.Normal;
            Bonus = Bonus.None;
            IsSelected = false;
        }
示例#2
0
        internal override void LoadContent(GraphicsDeviceManager graphics, ContentManager content)
        {
            shapesAtlas = new ShapesAtlas(content.Load<Texture2D>("shapes"));
            backTexture = new Texture2D(graphics.GraphicsDevice, 1, 1);
            backTexture.SetData(new[] { Color.White });
            fireTexture = content.Load<Texture2D>("fire");

            for (int i = 0; i < cells.GetLength(0); i++)
            {
                for (int j = 0; j < cells.GetLength(1); j++)
                {
                    Cell cell = new Cell(this, Shape.Empty, shapesAtlas, backTexture, i, j);
                    cells[i, j] = cell;
                }
            }
        }