Beispiel #1
0
    /// <summary>
    /// This method is called when loading the tile.
    /// </summary>
    /// <param name="tile">Reference to tile</param>
    private void OnStartDownloadTile(OnlineMapsTile tile)
    {
        // Get local path.
        string path = GetTilePath(tile);

        // If the tile is cached.
        if (File.Exists(path))
        {
            // Load tile texture from cache.
            Texture2D tileTexture = new Texture2D(256, 256, TextureFormat.RGB24, false);
            tileTexture.LoadImage(File.ReadAllBytes(path));
            tileTexture.wrapMode = TextureWrapMode.Clamp;

            // Send texture to map.
            if (OnlineMapsControlBase.instance.resultIsTexture)
            {
                (tile as OnlineMapsRasterTile).ApplyTexture(tileTexture);
                OnlineMaps.instance.buffer.ApplyTile(tile);
                OnlineMapsUtils.Destroy(tileTexture);
            }
            else
            {
                tile.texture = tileTexture;
                tile.status  = OnlineMapsTileStatus.loaded;
            }

            // Redraw map.
            OnlineMaps.instance.Redraw();
        }
        else
        {
            // If the tile is not cached, download tile with a standard loader.
            OnlineMapsTileManager.StartDownloadTile(tile);
        }
    }
Beispiel #2
0
    private void OnStartDownloadTileM(OnlineMapsTile tile)
    {
        if (TryLoadFromCache(tile))
        {
            if (OnLoadedFromCache != null)
            {
                OnLoadedFromCache(tile);
            }
        }
        else
        {
#pragma warning disable 618
            if (OnStartDownloadTile != null)
            {
                OnStartDownloadTile(tile);
            }
#pragma warning restore 618
            else if (OnlineMapsTileManager.OnStartDownloadTile != null)
            {
                OnlineMapsTileManager.OnStartDownloadTile(tile);
            }
            else
            {
                OnlineMapsTileManager.StartDownloadTile(tile);
            }
        }
    }
        private void OnStartDownloadTile(OnlineMapsTile tile)
        {
            // Load overlay for tile.
            LoadTileOverlay(tile);

            // Load the tile using a standard loader.
            OnlineMapsTileManager.StartDownloadTile(tile);
        }
 private void OnStartDownloadTileM(OnlineMapsTile tile)
 {
     if (TryLoadFromCache(tile))
     {
         if (OnLoadedFromCache != null)
         {
             OnLoadedFromCache(tile);
         }
     }
     else
     {
         if (OnStartDownloadTile != null)
         {
             OnStartDownloadTile(tile);
         }
         else
         {
             OnlineMapsTileManager.StartDownloadTile(tile);
         }
     }
 }
 private void OnStartDownloadTile(OnlineMapsTile tile)
 {
     OnlineMapsTileManager.StartDownloadTile(tile);
     StartDownloadOverlay(tile);
 }
Beispiel #6
0
 public void StartDownloadTile(OnlineMapsTile tile)
 {
     OnlineMapsTileManager.StartDownloadTile(tile);
 }