Example #1
0
    /// <summary>
    /// Dispose of tile.
    /// </summary>
    public void Dispose()
    {
        if (status == OnlineMapsTileStatus.disposed)
        {
            return;
        }
        status = OnlineMapsTileStatus.disposed;

        if (www != null)
        {
            //www.Dispose();
            www = null;
        }
        if (trafficWWW != null)
        {
            //trafficWWW.Dispose();
            trafficWWW = null;
        }
        _colors        = null;
        _url           = null;
        labelData      = null;
        labelColors    = null;
        data           = null;
        texture        = null;
        trafficTexture = null;
        OnSetColor     = null;
        if (hasChilds)
        {
            foreach (OnlineMapsTile child in childs)
            {
                if (child != null)
                {
                    child.parent = null;
                }
            }
        }
        if (parent != null)
        {
            if (parent.childs != null)
            {
                for (int i = 0; i < 4; i++)
                {
                    if (parent.childs[i] == this)
                    {
                        parent.childs[i] = null;
                        break;
                    }
                }
            }
            parent = null;
        }
        childs    = null;
        hasChilds = false;
        hasColors = false;
    }
Example #2
0
    /// <summary>
    /// Dispose of tile.
    /// </summary>
    public void Dispose()
    {
        if (status == OnlineMapsTileStatus.disposed)
        {
            return;
        }
        status = OnlineMapsTileStatus.disposed;

        _colors     = null;
        _url        = null;
        labelData   = null;
        labelColors = null;
        data        = null;

        OnSetColor = null;
        if (hasChilds)
        {
            foreach (OnlineMapsTile child in childs)
            {
                if (child != null)
                {
                    child.parent = null;
                }
            }
        }
        if (parent != null)
        {
            if (parent.childs != null)
            {
                for (int i = 0; i < 4; i++)
                {
                    if (parent.childs[i] == this)
                    {
                        parent.childs[i] = null;
                        break;
                    }
                }
            }
            parent = null;
        }
        childs    = null;
        hasChilds = false;
        hasColors = false;

        if (OnDisposed != null)
        {
            OnDisposed(this);
        }

        lock (unusedTiles)
        {
            unusedTiles.Add(this);
        }
    }
Example #3
0
 public void CheckTextureSize(Texture2D texture)
 {
     if (texture == null)
     {
         return;
     }
     if (mapType.isCustom && (texture.width != 256 || texture.height != 256))
     {
         Debug.LogError(string.Format("Size tiles {0}x{1}. Expected to 256x256. Please check the URL.", texture.width, texture.height));
         status = OnlineMapsTileStatus.error;
     }
 }
Example #4
0
    private IEnumerator TryDownloadAgain()
    {
        if (tryAgainAfterSec < 0)
        {
            yield break;
        }
        if (tryAgainAfterSec < 0)
        {
            yield return(new WaitForSeconds(tryAgainAfterSec));
        }

        status = OnlineMapsTileStatus.none;
    }
Example #5
0
    /// <summary>
    /// Dispose of tile.
    /// </summary>
    public void Dispose()
    {
        if (status == OnlineMapsTileStatus.disposed)
        {
            return;
        }
        status = OnlineMapsTileStatus.disposed;

        map.tileManager.Remove(this);
        if (OnDisposed != null)
        {
            OnDisposed(this);
        }
    }
Example #6
0
 /// <summary>
 /// Mark that the tile has an error
 /// </summary>
 public void MarkError()
 {
     status = OnlineMapsTileStatus.error;
     if (OnTileError != null)
     {
         OnTileError(this);
     }
     if (tryAgainAfterSec >= 0)
     {
         if (OnlineMaps.instance != null)
         {
             OnlineMaps.instance.StartCoroutine(TryDownloadAgain());
         }
     }
 }
    /// <summary>
    /// Dispose of tile.
    /// </summary>
    public void Dispose()
    {
        if (status == OnlineMapsTileStatus.disposed)
        {
            return;
        }
        status = OnlineMapsTileStatus.disposed;

        lock (unusedTiles)
        {
            unusedTiles.Add(this);
        }

        if (_dtiles.ContainsKey(key))
        {
            _dtiles.Remove(key);
        }
    }
Example #8
0
 /// <summary>
 /// Mark that the tile has an error
 /// </summary>
 public void MarkError()
 {
     status = OnlineMapsTileStatus.error;
     if (OnTileError != null)
     {
         OnTileError(this);
     }
     if (tryAgainAfterSec >= 0)
     {
         if (map != null && map.source != OnlineMapsSource.Resources)
         {
             remainDownloadsAttempts--;
             if (remainDownloadsAttempts > 0)
             {
                 map.StartCoroutine(TryDownloadAgain());
             }
         }
     }
 }
Example #9
0
    public void ApplyTexture(Texture2D texture)
    {
        _colors   = texture.GetPixels();
        status    = OnlineMapsTileStatus.loaded;
        hasColors = true;

        if (parent != null && parent.status != OnlineMapsTileStatus.loaded)
        {
            parent.hasColors = false;
        }
        if (childs == null)
        {
            return;
        }

        foreach (OnlineMapsTile child in childs)
        {
            if (child != null && child.status != OnlineMapsTileStatus.loaded)
            {
                child.hasColors = false;
            }
        }
    }
 public void CheckTextureSize(Texture2D texture)
 {
     if (texture == null) return;
     if (api.provider == OnlineMapsProviderEnum.custom && (texture.width != 256 || texture.height != 256))
     {
         Debug.LogError(string.Format("Size tiles {0}x{1}. Expected to 256x256. Please check the URL.", texture.width, texture.height));
         status = OnlineMapsTileStatus.error;
     }
 }
Example #11
0
 public void OnDownloadError()
 {
     status = OnlineMapsTileStatus.error;
 }
 public void MarkError()
 {
     status = OnlineMapsTileStatus.error;
 }
Example #13
0
 public void ApplyTexture(Texture2D texture)
 {
     _colors   = texture.GetPixels32();
     status    = OnlineMapsTileStatus.loaded;
     hasColors = true;
 }
Example #14
0
 public void OnDownloadError()
 {
     status = OnlineMapsTileStatus.error;
 }
Example #15
0
 public void Dispose()
 {
     if (status == OnlineMapsTileStatus.disposed) return;
     www = null;
     _colors = null;
     _url = null;
     OnSetColor = null;
     status = OnlineMapsTileStatus.disposed;
     if (hasChilds) foreach (OnlineMapsTile child in childs) if (child != null) child.parent = null;
     if (parent != null)
     {
         if (parent.childs != null)
         {
             for (int i = 0; i < 4; i++)
             {
                 if (parent.childs[i] == this)
                 {
                     parent.childs[i] = null;
                     break;
                 }
             }
         }
         parent = null;
     }
     childs = null;
     hasChilds = false;
     hasColors = false;
 }
Example #16
0
 public void ApplyTexture(Texture2D texture)
 {
     _colors = texture.GetPixels();
     status = OnlineMapsTileStatus.loaded;
     hasColors = true;
 }
    /// <summary>
    /// Dispose of tile.
    /// </summary>
    public void Dispose()
    {
        if (status == OnlineMapsTileStatus.disposed) return;
        status = OnlineMapsTileStatus.disposed;

        if (www != null)
        {
            //www.Dispose();
            www = null;
        }
        if (trafficWWW != null)
        {
            //trafficWWW.Dispose();
            trafficWWW = null;
        }
        _colors = null;
        _url = null;
        labelData = null;
        labelColors = null;
        data = null;
        texture = null;
        trafficTexture = null;
        OnSetColor = null;
        if (hasChilds) foreach (OnlineMapsTile child in childs) if (child != null) child.parent = null;
        if (parent != null)
        {
            if (parent.childs != null)
            {
                for (int i = 0; i < 4; i++)
                {
                    if (parent.childs[i] == this)
                    {
                        parent.childs[i] = null;
                        break;
                    }
                }
            }
            parent = null;
        }
        childs = null;
        hasChilds = false;
        hasColors = false;
    }
    public void ApplyTexture(Texture2D texture)
    {
        _colors = texture.GetPixels();
        status = OnlineMapsTileStatus.loaded;
        hasColors = true;

        if (parent != null && parent.status != OnlineMapsTileStatus.loaded) parent.hasColors = false;
        if (childs == null) return;

        foreach (OnlineMapsTile child in childs)
        {
            if (child != null && child.status != OnlineMapsTileStatus.loaded) child.hasColors = false;
        }
    }