diff --git a/Editor/Mapbox.UnitySDK.Editor.asmdef b/Editor/Mapbox.UnitySDK.Editor.asmdef index 313e9198f..1ca996427 100644 --- a/Editor/Mapbox.UnitySDK.Editor.asmdef +++ b/Editor/Mapbox.UnitySDK.Editor.asmdef @@ -2,7 +2,8 @@ "name": "MapboxUnitySDK.Editor", "rootNamespace": "", "references": [ - "GUID:093b9fb2cd4794a8c94472d55c8bb0a9" + "GUID:093b9fb2cd4794a8c94472d55c8bb0a9", + "GUID:36ca6af6e2b304d4090888554d6ce199" ], "includePlatforms": [ "Editor" diff --git a/Runtime/Mapbox/BaseModule/Data/Platform/Cache/FileCache.cs b/Runtime/Mapbox/BaseModule/Data/Platform/Cache/FileCache.cs index dfb43393e..fb076c0b1 100644 --- a/Runtime/Mapbox/BaseModule/Data/Platform/Cache/FileCache.cs +++ b/Runtime/Mapbox/BaseModule/Data/Platform/Cache/FileCache.cs @@ -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) diff --git a/Runtime/Mapbox/BaseModule/Editor.meta b/Runtime/Mapbox/BaseModule/Editor.meta new file mode 100644 index 000000000..28695b49d --- /dev/null +++ b/Runtime/Mapbox/BaseModule/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 88c1b74736534426ea94437fd425da25 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Mapbox/Example/Editor/MapInformationDrawer.cs b/Runtime/Mapbox/BaseModule/Editor/MapInformationDrawer.cs similarity index 100% rename from Runtime/Mapbox/Example/Editor/MapInformationDrawer.cs rename to Runtime/Mapbox/BaseModule/Editor/MapInformationDrawer.cs diff --git a/Runtime/Mapbox/Example/Editor/MapInformationDrawer.cs.meta b/Runtime/Mapbox/BaseModule/Editor/MapInformationDrawer.cs.meta similarity index 100% rename from Runtime/Mapbox/Example/Editor/MapInformationDrawer.cs.meta rename to Runtime/Mapbox/BaseModule/Editor/MapInformationDrawer.cs.meta diff --git a/Runtime/Mapbox/BaseModule/Editor/MapboxBaseModule.Editor.asmdef b/Runtime/Mapbox/BaseModule/Editor/MapboxBaseModule.Editor.asmdef new file mode 100644 index 000000000..d2c79de57 --- /dev/null +++ b/Runtime/Mapbox/BaseModule/Editor/MapboxBaseModule.Editor.asmdef @@ -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 +} \ No newline at end of file diff --git a/Runtime/Mapbox/BaseModule/Editor/MapboxBaseModule.Editor.asmdef.meta b/Runtime/Mapbox/BaseModule/Editor/MapboxBaseModule.Editor.asmdef.meta new file mode 100644 index 000000000..1626f91e1 --- /dev/null +++ b/Runtime/Mapbox/BaseModule/Editor/MapboxBaseModule.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 567de054dbe5948c0bc25053f1aa6581 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Mapbox/BaseModule/Editor/RuntimeCacheManagerBehaviourEditor.cs b/Runtime/Mapbox/BaseModule/Editor/RuntimeCacheManagerBehaviourEditor.cs new file mode 100644 index 000000000..3f00a43e2 --- /dev/null +++ b/Runtime/Mapbox/BaseModule/Editor/RuntimeCacheManagerBehaviourEditor.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/Runtime/Mapbox/BaseModule/Editor/RuntimeCacheManagerBehaviourEditor.cs.meta b/Runtime/Mapbox/BaseModule/Editor/RuntimeCacheManagerBehaviourEditor.cs.meta new file mode 100644 index 000000000..f8563100d --- /dev/null +++ b/Runtime/Mapbox/BaseModule/Editor/RuntimeCacheManagerBehaviourEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f504b61d8125144a89d1eee4768fcb2b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Mapbox/Example/Editor/UnityContextDrawer.cs b/Runtime/Mapbox/BaseModule/Editor/UnityContextDrawer.cs similarity index 100% rename from Runtime/Mapbox/Example/Editor/UnityContextDrawer.cs rename to Runtime/Mapbox/BaseModule/Editor/UnityContextDrawer.cs diff --git a/Runtime/Mapbox/Example/Editor/UnityContextDrawer.cs.meta b/Runtime/Mapbox/BaseModule/Editor/UnityContextDrawer.cs.meta similarity index 100% rename from Runtime/Mapbox/Example/Editor/UnityContextDrawer.cs.meta rename to Runtime/Mapbox/BaseModule/Editor/UnityContextDrawer.cs.meta diff --git a/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/DataFetchingManagerBehaviour.cs b/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/DataFetchingManagerBehaviour.cs index 137d17406..2bf00dfcd 100644 --- a/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/DataFetchingManagerBehaviour.cs +++ b/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/DataFetchingManagerBehaviour.cs @@ -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 { diff --git a/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/MapboxCacheManagerBehaviour.cs b/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/MapboxCacheManagerBehaviour.cs index ede5f920f..6c08e08a5 100644 --- a/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/MapboxCacheManagerBehaviour.cs +++ b/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/MapboxCacheManagerBehaviour.cs @@ -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); diff --git a/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/RuntimeCacheManagerBehaviour.cs b/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/RuntimeCacheManagerBehaviour.cs new file mode 100644 index 000000000..f0f478529 --- /dev/null +++ b/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/RuntimeCacheManagerBehaviour.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/RuntimeCacheManagerBehaviour.cs.meta b/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/RuntimeCacheManagerBehaviour.cs.meta new file mode 100644 index 000000000..856152900 --- /dev/null +++ b/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/RuntimeCacheManagerBehaviour.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 459c81193c94429ba939258f8a66103f +timeCreated: 1768224967 \ No newline at end of file diff --git a/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/TileCreatorBehaviour.cs b/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/TileCreatorBehaviour.cs index d3ebaed22..3197ff51e 100644 --- a/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/TileCreatorBehaviour.cs +++ b/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/TileCreatorBehaviour.cs @@ -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 { diff --git a/Runtime/Mapbox/DirectionsApi/Samples~/DirectionsApiDemo/Scripts/DirectionScript.cs b/Runtime/Mapbox/DirectionsApi/Samples~/DirectionsApiDemo/Scripts/DirectionScript.cs index 357fdb748..0a9e8d25d 100644 --- a/Runtime/Mapbox/DirectionsApi/Samples~/DirectionsApiDemo/Scripts/DirectionScript.cs +++ b/Runtime/Mapbox/DirectionsApi/Samples~/DirectionsApiDemo/Scripts/DirectionScript.cs @@ -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; diff --git a/Runtime/Mapbox/Example/Scripts/Map/MapboxMapBehaviour.cs b/Runtime/Mapbox/Example/Scripts/Map/MapboxMapBehaviour.cs index 72f0a4601..54ffedb12 100644 --- a/Runtime/Mapbox/Example/Scripts/Map/MapboxMapBehaviour.cs +++ b/Runtime/Mapbox/Example/Scripts/Map/MapboxMapBehaviour.cs @@ -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; diff --git a/Runtime/Mapbox/Example/Scripts/Test/FilterTest.cs b/Runtime/Mapbox/Example/Scripts/Test/FilterTest.cs index e40c13b62..f760d3731 100644 --- a/Runtime/Mapbox/Example/Scripts/Test/FilterTest.cs +++ b/Runtime/Mapbox/Example/Scripts/Test/FilterTest.cs @@ -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 diff --git a/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingCacheManagerBehaviour.cs b/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingCacheManagerBehaviour.cs index b0f1c419a..fdec9d400 100644 --- a/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingCacheManagerBehaviour.cs +++ b/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingCacheManagerBehaviour.cs @@ -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; diff --git a/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingDataFetchingManagerBehaviour.cs b/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingDataFetchingManagerBehaviour.cs index cb34e2d2d..bbe0f2111 100644 --- a/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingDataFetchingManagerBehaviour.cs +++ b/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingDataFetchingManagerBehaviour.cs @@ -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 diff --git a/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingMapBehaviour.cs b/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingMapBehaviour.cs index 02a958018..479e05155 100644 --- a/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingMapBehaviour.cs +++ b/Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingMapBehaviour.cs @@ -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