Пример #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;
    }
Пример #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);
        }
    }
Пример #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;
     }
 }
Пример #4
0
    private IEnumerator TryDownloadAgain()
    {
        if (tryAgainAfterSec < 0)
        {
            yield break;
        }
        if (tryAgainAfterSec < 0)
        {
            yield return(new WaitForSeconds(tryAgainAfterSec));
        }

        status = OnlineMapsTileStatus.none;
    }
Пример #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);
        }
    }
Пример #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());
         }
     }
 }
Пример #7
0
    /// <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);
        }
    }
Пример #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());
             }
         }
     }
 }
Пример #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;
            }
        }
    }
Пример #10
0
 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;
     }
 }
Пример #11
0
 public void OnDownloadError()
 {
     status = OnlineMapsTileStatus.error;
 }
 public void MarkError()
 {
     status = OnlineMapsTileStatus.error;
 }
Пример #13
0
 public void ApplyTexture(Texture2D texture)
 {
     _colors   = texture.GetPixels32();
     status    = OnlineMapsTileStatus.loaded;
     hasColors = true;
 }
Пример #14
0
 public void OnDownloadError()
 {
     status = OnlineMapsTileStatus.error;
 }
Пример #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;
 }
Пример #16
0
 public void ApplyTexture(Texture2D texture)
 {
     _colors = texture.GetPixels();
     status = OnlineMapsTileStatus.loaded;
     hasColors = true;
 }
Пример #17
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;
    }
Пример #18
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;
        }
    }