Esempio n. 1
0
 private void DownloadTilesInfinite()
 {
     Debug.Log("DownloadTilesInfinite started");
     while (true)
     {
         Thread.Sleep(1);
         try
         {
             string tileKey = DequeueTileKeyToDownload();
             if (!string.IsNullOrEmpty(tileKey))
             {
                 TileOSMBehaviour tile = tilesDico[tileKey];
                 if (!tile.TextureDownloadHasBeenRequested())
                 {
                     bool loadTileDidHappen = tile.LoadTexture();
                     if (!loadTileDidHappen)
                     {
                         EnqueueTileKeyToDownload(tileKey);
                     }
                 }
                 else
                 {
                     Debug.LogWarning("tileKey is not empty but download has already been requested : " + tileKey);
                 }
             }
         }
         catch (System.Exception ex)
         {
             Debug.LogError("tileDownloaderThread got an exception : " + ex.Message);
         }
     }
 }
Esempio n. 2
0
    private IEnumerator CheckForTexturesToDisplay()
    {
        yield return(new WaitForSeconds(0));

        TileOSMBehaviour tile = DequeueTileToDisplay();

        if (tile != null)
        {
            tile.SetTexture();
        }
        checkForTexturesToDisplayCoroutine = StartCoroutine(CheckForTexturesToDisplay());
    }
Esempio n. 3
0
    private TileOSMBehaviour DequeueTileToDisplay()
    {
        string           tileKey;
        TileOSMBehaviour tile = null;

        lock (tilesToDisplay)
        {
            try
            {
                tileKey = tilesToDisplay.Dequeue();
                //Debug.Log("DequeueTileToDisplay : " + tileKey);
                tile = tilesDico[tileKey];
            }
            catch (System.Exception)
            {
                tileKey = null;
            }
        }
        if (string.IsNullOrEmpty(tileKey))
        {
            return(null);
        }
        return(tile);
    }