brnkhy / MapzenGo

Pokemon Go clone using Unity3D & Mapzen/OpenStreetMap
http://www.barankahyaoglu.com
MIT License
198 stars 59 forks source link

Save the files(tile json) to disk #22

Closed Outgoing closed 8 years ago

Outgoing commented 8 years ago

You can add saving and loading files from disk.

private void LoadTile(Vector2 tileTms, Tile tile) {
            var url = string.Format(_mapzenUrl, _mapzenLayers, Zoom, tile.GetTileTms.x, tile.GetTileTms.y, _mapzenFormat, _key);
            var pathFile = PathSaveJsonFile + tile.GetTileTms.x + "-" + tile.GetTileTms.y;
            if (File.Exists(pathFile)) tile.ConstructTile(pathFile, true);
            else {     ObservableWWW.Get(url).Subscribe(
                        tile.ConstructTile, //success
                        exp => Debug.Log("Error fetching -> " + url)); }
        }
brnkhy commented 8 years ago

I also did this on the lastest update, please check it out as well, thanks!