Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Editor/Mapbox.UnitySDK.Editor.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "MapboxUnitySDK.Editor",
"rootNamespace": "",
"references": [
"GUID:093b9fb2cd4794a8c94472d55c8bb0a9"
"GUID:093b9fb2cd4794a8c94472d55c8bb0a9",
"GUID:36ca6af6e2b304d4090888554d6ce199"
],
"includePlatforms": [
"Editor"
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Mapbox/BaseModule/Data/Platform/Cache/FileCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public bool TestAvailability()

private string TileToRelativeFilePath(CanonicalTileId tileId, string tilesetId)
{
return string.Format("{0}/{1}{2}{3}.{4}", MapIdToFolderName(tilesetId), tileId.X, tileId.Y, tileId.Z, FileExtension);
return string.Format("{0}/{1}_{2}_{3}.{4}", MapIdToFolderName(tilesetId), tileId.X, tileId.Y, tileId.Z, FileExtension);
}

public virtual bool Exists(CanonicalTileId tileId, string mapId)
Expand Down
8 changes: 8 additions & 0 deletions Runtime/Mapbox/BaseModule/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions Runtime/Mapbox/BaseModule/Editor/MapboxBaseModule.Editor.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "MapboxBaseModule.Editor",
"rootNamespace": "",
"references": [
"GUID:093b9fb2cd4794a8c94472d55c8bb0a9"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Mapbox.BaseModule.Unity.ModuleBehaviours;
using UnityEditor;

namespace Mapbox.BaseModule.Editor
{
[CustomEditor(typeof(RuntimeCacheManagerBehaviour))]
public class RuntimeCacheManagerBehaviourEditor : UnityEditor.Editor
{
SerializedProperty createSqliteCache;
SerializedProperty useCustomName;
SerializedProperty customName;
SerializedProperty createFileCache;

void OnEnable()
{
createSqliteCache = serializedObject.FindProperty("CreateSqliteCache");
useCustomName = serializedObject.FindProperty("UseCustomName");
customName = serializedObject.FindProperty("CustomName");
createFileCache = serializedObject.FindProperty("CreateFileCache");
}

public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(useCustomName);
if (useCustomName.boolValue)
{
EditorGUILayout.PropertyField(customName);
}
serializedObject.ApplyModifiedProperties();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Mapbox.BaseModule.Data.DataFetchers;
using UnityEngine;

namespace Mapbox.Example.Scripts.ModuleBehaviours
namespace Mapbox.BaseModule.Unity.ModuleBehaviours
{
public class DataFetchingManagerBehaviour : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,9 @@
using Mapbox.BaseModule.Data.DataFetchers;
using Mapbox.BaseModule.Data.Platform.Cache;
using Mapbox.BaseModule.Data.Platform.Cache.SQLiteCache;
using Mapbox.BaseModule.Unity;
using UnityEngine;

namespace Mapbox.Example.Scripts.ModuleBehaviours
namespace Mapbox.BaseModule.Unity.ModuleBehaviours
{
public class RuntimeCacheManagerBehaviour : MapboxCacheManagerBehaviour
{
public MapboxCacheManager CacheManager;
public MemoryCache MemoryCache;

public MapboxCacheManager GetCacheManager() => CacheManager;

public bool CreateSqliteCache = true;
public bool CreateFileCache = true;

public override MapboxCacheManager GetCacheManager(UnityContext unityContext, DataFetchingManager dataFetchingManager)
{
if (CacheManager == null)
{
SqliteCache sqliteCache = null;
FileCache fileCache = null;
sqliteCache = CreateSqliteCache ? new SqliteCache(unityContext.TaskManager, 1000) : null;
fileCache = CreateFileCache ? new FileCache(unityContext.TaskManager) : null;
MemoryCache = new MemoryCache();

CacheManager = new MapboxCacheManager(
unityContext,
MemoryCache,
fileCache,
sqliteCache);
}

return CacheManager;
}
}

public abstract class MapboxCacheManagerBehaviour : MonoBehaviour
{
public abstract MapboxCacheManager GetCacheManager(UnityContext unityContext, DataFetchingManager dataFetchingManager);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using Mapbox.BaseModule.Data.DataFetchers;
using Mapbox.BaseModule.Data.Platform.Cache;
using Mapbox.BaseModule.Data.Platform.Cache.SQLiteCache;

namespace Mapbox.BaseModule.Unity.ModuleBehaviours
{
public class RuntimeCacheManagerBehaviour : MapboxCacheManagerBehaviour
{
public MapboxCacheManager CacheManager;
public MemoryCache MemoryCache;

public MapboxCacheManager GetCacheManager() => CacheManager;

public bool CreateSqliteCache = true;

public bool CreateFileCache = true;

public bool UseCustomName = false;
public string CustomName;

public override MapboxCacheManager GetCacheManager(UnityContext unityContext, DataFetchingManager dataFetchingManager)
{
if (CacheManager == null)
{
SqliteCache sqliteCache = null;
FileCache fileCache = null;
if (CreateSqliteCache)
{
if (UseCustomName)
{
sqliteCache = new SqliteCache(unityContext.TaskManager, 1000, CustomName);
}
else
{
sqliteCache = new SqliteCache(unityContext.TaskManager, 1000);
}
}

if (CreateFileCache)
{
if (UseCustomName)
{
fileCache = new FileCache(unityContext.TaskManager, CustomName);
}
else
{
fileCache = new FileCache(unityContext.TaskManager);
}
}

MemoryCache = new MemoryCache();
CacheManager = new MapboxCacheManager(
unityContext,
MemoryCache,
fileCache,
sqliteCache);
}

return CacheManager;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using System;
using Mapbox.BaseModule.Data.Interfaces;
using Mapbox.BaseModule.Map;
using Mapbox.BaseModule.Unity;
using Mapbox.ImageModule.Terrain.Settings;
using Mapbox.ImageModule.Terrain.TerrainStrategies;
using UnityEngine;

namespace Mapbox.Example.Scripts.ModuleBehaviours
namespace Mapbox.BaseModule.Unity.ModuleBehaviours
{
public class TileCreatorBehaviour : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Mapbox.BaseModule.Map;
using Mapbox.BaseModule.Utilities;
using Mapbox.DirectionsApi;
using Mapbox.Example.Scripts.ModuleBehaviours;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
Expand Down
6 changes: 1 addition & 5 deletions Runtime/Mapbox/Example/Scripts/Map/MapboxMapBehaviour.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
using System;
using System.Linq;
using Mapbox.BaseModule;
using Mapbox.BaseModule.Data.DataFetchers;
using Mapbox.BaseModule.Data.Interfaces;
using Mapbox.BaseModule.Data.Platform.Cache;
using Mapbox.BaseModule.Data.Platform.Cache.SQLiteCache;
using Mapbox.BaseModule.Map;
using Mapbox.BaseModule.Unity;
using Mapbox.BaseModule.Unity.ModuleBehaviours;
using Mapbox.BaseModule.Utilities;
using Mapbox.Example.Scripts.ModuleBehaviours;
using Mapbox.Example.Scripts.TileProviderBehaviours;
using Mapbox.ImageModule.Terrain.TerrainStrategies;
using Mapbox.UnityMapService;
using Mapbox.UnityMapService.TileProviders;
using UnityEngine;
Expand Down
3 changes: 0 additions & 3 deletions Runtime/Mapbox/Example/Scripts/Test/FilterTest.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System.Linq;
using Mapbox.BaseModule.Utilities;
using Mapbox.Example.Scripts.Map;
using Mapbox.Example.Scripts.ModuleBehaviours;
using Mapbox.VectorModule;
using Mapbox.VectorModule.Filters;
using Mapbox.VectorModule.Unity;
using UnityEngine;

namespace Mapbox.Example.Scripts.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Mapbox.BaseModule.Data.DataFetchers;
using Mapbox.BaseModule.Data.Platform.Cache;
using Mapbox.BaseModule.Data.Platform.Cache.SQLiteCache;
using Mapbox.BaseModule.Unity;
using Mapbox.Example.Scripts.ModuleBehaviours;
using Mapbox.BaseModule.Unity.ModuleBehaviours;
using Mapbox.MapDebug.Scripts.Logging;
using UnityEngine;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using Mapbox.BaseModule.Data.DataFetchers;
using Mapbox.Example.Scripts.ModuleBehaviours;
using Mapbox.BaseModule.Unity.ModuleBehaviours;
using UnityEngine;

namespace Mapbox.MapDebug.Scripts.Logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
using Mapbox.BaseModule.Data.Platform.Cache.SQLiteCache;
using Mapbox.BaseModule.Map;
using Mapbox.BaseModule.Unity;
using Mapbox.BaseModule.Unity.ModuleBehaviours;
using Mapbox.BaseModule.Utilities;
using Mapbox.Example.Scripts.ModuleBehaviours;
using Mapbox.Example.Scripts.TileProviderBehaviours;
using Mapbox.ImageModule.Terrain.TerrainStrategies;
#if UNITY_RECORDER && UNITY_EDITOR
using Mapbox.MapDebug.Sequence;
#endif
Expand Down