Пример #1
0
        public static Tile GetCachedTile(int level, int x, int y, Imageset dataset, Tile parent)
        {
            if (level < dataset.BaseLevel)
            {
                return(null);
            }

            Tile   retTile = null;
            string tileKey = Imageset.GetTileKey(dataset, level, x, y, parent);

            try
            {
                if (!tiles.ContainsKey(tileKey))
                {
                    return(null);
                }
                else
                {
                    retTile = tiles[tileKey];
                }
            }
            catch
            {
            }

            return(retTile);
        }
Пример #2
0
        //internal static void AddTileToQueue(Tile tile)
        //{

        //    queue[tile.Key] = tile;
        //}

        public static Tile GetTile(int level, int x, int y, Imageset dataset, Tile parent)
        {
            Tile   retTile = null;
            string tileKey = Imageset.GetTileKey(dataset, level, x, y, parent);

            // try
            {
                if (!tiles.ContainsKey(tileKey))
                {
                    retTile = Imageset.GetNewTile(dataset, level, x, y, parent);
                    if (retTile != null)
                    {
                        tiles[tileKey] = retTile;
                    }
                }
                else
                {
                    retTile = tiles[tileKey];
                }
            }
            // catch
            {
                int p = 0;
            }

            return(retTile);
        }