Пример #1
0
        public static void PlaceSprite(int destinationX, int destinationY, SpriteFull sprite, int style, WorldViewModel wvm)
        {
            if (sprite.Tile == (ushort)TileType.ChristmasTree)
            {
                for (int x = 0; x < sprite.SizeTiles.X; x++)
                {
                    int tilex = x + destinationX;
                    for (int y = 0; y < sprite.SizeTiles.Y; y++)
                    {
                        int tiley = y + destinationY;
                        wvm.UndoManager.SaveTile(tilex, tiley);
                        Tile curtile = wvm.CurrentWorld.Tiles[tilex, tiley];
                        curtile.IsActive = true;
                        curtile.Type     = sprite.Tile;
                        if (x == 0 && y == 0)
                        {
                            curtile.U = 10;
                        }
                        else
                        {
                            curtile.U = (short)x;
                        }
                        curtile.V = (short)y;

                        wvm.UpdateRenderPixel(tilex, tiley);
                        BlendRules.ResetUVCache(wvm, tilex, tiley, sprite.SizeTiles.X, sprite.SizeTiles.Y);
                    }
                }
            }
            else
            {
                for (int x = 0; x < sprite.SizeTiles.X; x++)
                {
                    Vector2Short[,] tiles = sprite.GetTiles(style);
                    int tilex = x + destinationX;
                    for (int y = 0; y < sprite.SizeTiles.Y; y++)
                    {
                        int tiley = y + destinationY;
                        wvm.UndoManager.SaveTile(tilex, tiley);
                        Tile curtile = wvm.CurrentWorld.Tiles[tilex, tiley];
                        curtile.IsActive = true;
                        curtile.Type     = sprite.Tile;
                        curtile.U        = tiles[x, y].X;
                        curtile.V        = tiles[x, y].Y;

                        wvm.UpdateRenderPixel(tilex, tiley);
                        BlendRules.ResetUVCache(wvm, tilex, tiley, sprite.SizeTiles.X, sprite.SizeTiles.Y);
                    }
                }
            }
        }
Пример #2
0
 public static void PlaceSprite(int destinationX, int destinationY, SpriteFull sprite, int style, ITileData world)
 {
     if (sprite.Tile == (ushort)TileType.ChristmasTree)
     {
         for (int x = 0; x < sprite.SizeTiles.X; x++)
         {
             int tilex = x + destinationX;
             for (int y = 0; y < sprite.SizeTiles.Y; y++)
             {
                 int  tiley   = y + destinationY;
                 Tile curtile = world.Tiles[tilex, tiley];
                 curtile.IsActive = true;
                 curtile.Type     = sprite.Tile;
                 if (x == 0 && y == 0)
                 {
                     curtile.U = 10;
                 }
                 else
                 {
                     curtile.U = (short)x;
                 }
                 curtile.V = (short)y;
             }
         }
     }
     else
     {
         for (int x = 0; x < sprite.SizeTiles.X; x++)
         {
             Vector2Short[,] tiles = sprite.GetTiles(style);
             int tilex = x + destinationX;
             for (int y = 0; y < sprite.SizeTiles.Y; y++)
             {
                 int  tiley   = y + destinationY;
                 Tile curtile = world.Tiles[tilex, tiley];
                 curtile.IsActive = true;
                 curtile.Type     = sprite.Tile;
                 curtile.U        = tiles[x, y].X;
                 curtile.V        = tiles[x, y].Y;
             }
         }
     }
 }