Exemplo n.º 1
0
    private void OnTileDownloaded(Tile tile, OnlineMapsWWW www)
    {
        if (www.hasError)
        {
            Debug.Log("Download error");
            return;
        }

        if (OnDownloadSuccess != null)
        {
            OnDownloadSuccess(tile, www);
        }
        string response = www.text;

        OnlineMapsCache.Add(tile.GetCacheKey(cachePrefix), Encoding.UTF8.GetBytes(response));
        ParseResponse(tile, response);
    }
Exemplo n.º 2
0
    protected void SetElevationToCache(Tile tile, short[,] elevations)
    {
        if (!cacheElevations)
        {
            return;
        }

        byte[] cache      = new byte[tileWidth * tileHeight * 2];
        int    cacheIndex = 0;

        for (int y = 0; y < tileHeight; y++)
        {
            for (int x = 0; x < tileWidth; x++)
            {
                short s = elevations[x, y];
                cache[cacheIndex++] = (byte)(s & 255);
                cache[cacheIndex++] = (byte)(s >> 8);
            }
        }

        OnlineMapsCache.Add(tile.GetCacheKey(cachePrefix), cache);
    }