diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index 99f926f5f..e16cd79b2 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -2,6 +2,9 @@ _Note: If this is a bug or support ticket, please provide the following information:_ * Unity version: + * Scripting Runtime Version: + * Scripting Backend: + * Api Compatibility Level: * Mapbox SDK version: * The platform you're building to: * A description of what you're trying to do: diff --git a/documentation/docs/05-changelog.md b/documentation/docs/05-changelog.md index c06e5de52..e04b4424c 100644 --- a/documentation/docs/05-changelog.md +++ b/documentation/docs/05-changelog.md @@ -1,4 +1,44 @@ -## CHANGELOG +## CHANGELOG + ### v.1.4.2 +*05/14/2018* + +##### New Features +- Layer names and property names are preloaded from the data source into a dropdown. +- Add `Location Prefabs` section to `AbstractMap`. Enables users to spawn prefabs at points-of-interest on the map directly from the `AbstractMap` UI. +- Add options to spawn prefabs on points-of-interest using `Mapbox Category`, `Name`, or a list of `Address or LatLon`. +- Add methods on `AbstractMap` to spawn prefabs. Enables users to add layers via script. +- Add the `LocationPrefabs.unity` example scene. Demonstrates the basics of using the `Location Prefabs` feature. +- Add `OnUpdated` event to `AbstractMap`. Enables subscribers to get a notification when the map location and/or zoom gets updated. +- `DeviceLocationProviderAndroidNative`: a native location provider for Android that directly accesses location and orientation provided by the operating system not using Unity's `Input.location` which has some shortcomings, eg coordinates truncated to `float` precision. + **Only available on Android 7.0 (Nougat, API Level 24) and up!** +- `EditorGpsLogLocationProvider`: an Editor location provider to replay real world GPS traces logged with [GNSSLogger](https://github.com/google/gps-measurement-tools/tree/master/GNSSLogger) +- New example scene showing `UserHeading` and `DeviceOrientation` + +##### Improvements +- `UnityARInterface` updated to [commit 67351b6](https://github.com/Unity-Technologies/experimental-ARInterface/commit/67351b66ff9af28380e7dd5f5b2f4ba1bf802ca8) from March 1st 2018 +- Additional properties on `RotateWithLocationProvider` to account for new `Location` properties `UserHeading` and `DeviceOrientation`. +- Changes to terrain factory (#623) + - Create a new base class + - Introduce all different terrains as strategies + - Change sidewalls as a property on elevated terrain strategy +- Data Fetching Changes (#622) + - Move data calls from factories to DataFetcher classes + - Factories register to events in DataFetchers +- `Layer Name` , `Extrusion Property Name` and `Filter Key` are now selectable dropdowns indicating the layers and properties available in the current `Data Source`. Layers and properties no longer require manual string entry. + +#### Bug Fixes +- Added checks to prevent NRE in `GeocodeAttributeSearchWindow` when searching with an invalid token or no connection. +- Fix issue where side wall mesh generation did not work with elevated terrain. + +#### Known Issues +- `Filters` with empty key or value parameters will exclude all features in a layer. +- SDK will throw `[Physics.PhysX] cleaning the mesh failed` error if a MapFeature is used with the following options: {Primitive Type: `Line`, LayerName: `Road`, Collider Type: `Mesh Collider`} + +##### BREAKING CHANGES +- Property `Heading` on `Location` object has been split into `UserHeading` and `DeviceOrientation`. + - `UserHeading`: the direction the user is moving. This is calculated from the latest position. If the user stops moving the last heading value is kept. + - `DeviceOrientation`: value obtained from the device compass. Where the device is looking to. + ### v.1.4.1 *04/17/2018* diff --git a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/libarcore_camera_utility.so b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/libarcore_camera_utility.so index c43564e86..139eb4d95 100644 Binary files a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/libarcore_camera_utility.so and b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/libarcore_camera_utility.so differ diff --git a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src/arcore_camera_utility.zip b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src/arcore_camera_utility.zip index aea81e32d..a77736e07 100644 Binary files a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src/arcore_camera_utility.zip and b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src/arcore_camera_utility.zip differ diff --git a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scenes/ComputerVision.unity b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scenes/ComputerVision.unity index e8040ac8d..e75eb2119 100644 --- a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scenes/ComputerVision.unity +++ b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scenes/ComputerVision.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1} + m_IndirectSpecularColor: {r: 0.37311947, g: 0.38074005, b: 0.35872722, a: 1} --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 @@ -128,12 +128,17 @@ Prefab: propertyPath: BackgroundMaterial value: objectReference: {fileID: 2100000, guid: 44aa46aeaaf4d46a79e18f3e2da31ccc, type: 2} + - target: {fileID: 114876698896786350, guid: c10877f7cd5764de18d46d7b777d1faa, + type: 2} + propertyPath: BackgroundMaterial + value: + objectReference: {fileID: 2100000, guid: 44aa46aeaaf4d46a79e18f3e2da31ccc, type: 2} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: c10877f7cd5764de18d46d7b777d1faa, type: 2} m_IsPrefabParent: 0 ---- !u!114 &273323148 stripped +--- !u!114 &517579873 stripped MonoBehaviour: - m_PrefabParentObject: {fileID: 114923820857209294, guid: c10877f7cd5764de18d46d7b777d1faa, + m_PrefabParentObject: {fileID: 114876698896786350, guid: c10877f7cd5764de18d46d7b777d1faa, type: 2} m_PrefabInternal: {fileID: 60865845} m_Script: {fileID: 11500000, guid: eb172c260d42e4f62945afda50892c0c, type: 3} @@ -179,7 +184,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: TextureReaderComponent: {fileID: 1465104024} - BackgroundRenderer: {fileID: 273323148} + BackgroundRenderer: {fileID: 517579873} --- !u!114 &1465104024 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scripts/ComputerVisionController.cs b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scripts/ComputerVisionController.cs index 9f7a0fc97..0f9b12ab9 100644 --- a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scripts/ComputerVisionController.cs +++ b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scripts/ComputerVisionController.cs @@ -40,7 +40,7 @@ public class ComputerVisionController : MonoBehaviour /// Background renderer to inject our texture into. /// public ARCoreBackgroundRenderer BackgroundRenderer; - + /// /// True if the app is in the process of quitting due to an ARCore connection error, otherwise false. /// @@ -71,6 +71,11 @@ public void Start() /// public void Update() { + if (Input.GetKey(KeyCode.Escape)) + { + Application.Quit(); + } + _QuitOnConnectionErrors(); _HandleTouchInput(); } @@ -179,7 +184,7 @@ private float _GetTouchDelta() return 0; } } - + /// /// Actually quit the application. /// @@ -199,13 +204,13 @@ private void _QuitOnConnectionErrors() } // Quit if ARCore was unable to connect and give Unity some time for the toast to appear. - if (Session.ConnectionState == SessionConnectionState.UserRejectedNeededPermission) + if (Session.Status == SessionStatus.ErrorPermissionNotGranted) { _ShowAndroidToastMessage("Camera permission is needed to run this application."); m_IsQuitting = true; Invoke("DoQuit", 0.5f); } - else if (Session.ConnectionState == SessionConnectionState.ConnectToServiceFailed) + else if (Session.Status == SessionStatus.FatalError) { _ShowAndroidToastMessage("ARCore encountered a problem connecting. Please start the app again."); m_IsQuitting = true; diff --git a/sdkproject/Assets/GoogleARCore/LICENSE b/sdkproject/Assets/GoogleARCore/LICENSE deleted file mode 100644 index 644835619..000000000 --- a/sdkproject/Assets/GoogleARCore/LICENSE +++ /dev/null @@ -1,158 +0,0 @@ -Copyright (c) 2017, Google Inc. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -1. Definitions. - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. -END OF TERMS AND CONDITIONS diff --git a/sdkproject/Assets/GoogleARCore/Prefabs/ARCore Device.prefab b/sdkproject/Assets/GoogleARCore/Prefabs/ARCore Device.prefab index 1dd0dbb41..b1f1c63bd 100644 --- a/sdkproject/Assets/GoogleARCore/Prefabs/ARCore Device.prefab +++ b/sdkproject/Assets/GoogleARCore/Prefabs/ARCore Device.prefab @@ -9,75 +9,75 @@ Prefab: m_Modifications: [] m_RemovedComponents: [] m_ParentPrefab: {fileID: 0} - m_RootGameObject: {fileID: 1905656715913530} + m_RootGameObject: {fileID: 1772147192650458} m_IsPrefabParent: 1 ---- !u!1 &1905656715913530 +--- !u!1 &1637996540812124 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4892153982037908} - - component: {fileID: 114254441574086558} + - component: {fileID: 4497055787654456} + - component: {fileID: 20155940112608238} + - component: {fileID: 114963366853050710} + - component: {fileID: 114876698896786350} m_Layer: 0 - m_Name: ARCore Device + m_Name: First Person Camera m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1960903772876386 +--- !u!1 &1772147192650458 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4923070639190690} - - component: {fileID: 20362215073346118} - - component: {fileID: 114720632237736846} - - component: {fileID: 114923820857209294} + - component: {fileID: 4442908887562770} + - component: {fileID: 114451889682527732} m_Layer: 0 - m_Name: First Person Camera + m_Name: ARCore Device m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &4892153982037908 +--- !u!4 &4442908887562770 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1905656715913530} + m_GameObject: {fileID: 1772147192650458} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 4923070639190690} + - {fileID: 4497055787654456} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4923070639190690 +--- !u!4 &4497055787654456 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1960903772876386} + m_GameObject: {fileID: 1637996540812124} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 4892153982037908} + m_Father: {fileID: 4442908887562770} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!20 &20362215073346118 +--- !u!20 &20155940112608238 Camera: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1960903772876386} + m_GameObject: {fileID: 1637996540812124} m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 2 @@ -108,44 +108,43 @@ Camera: m_OcclusionCulling: 1 m_StereoConvergence: 10 m_StereoSeparation: 0.022 ---- !u!114 &114254441574086558 +--- !u!114 &114451889682527732 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1905656715913530} + m_GameObject: {fileID: 1772147192650458} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: d4ca0c6a3af6b4635b7e98c6ea0a0cf9, type: 3} m_Name: m_EditorClassIdentifier: SessionConfig: {fileID: 11400000, guid: 9586a84d6c32f46b6ab7aeb6042f160d, type: 2} - ConnectOnAwake: 1 ---- !u!114 &114720632237736846 +--- !u!114 &114876698896786350 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1960903772876386} + m_GameObject: {fileID: 1637996540812124} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1742909100, guid: 3a84de5cd0624681b6b6dcd8921d912a, type: 3} + m_Script: {fileID: 11500000, guid: eb172c260d42e4f62945afda50892c0c, type: 3} m_Name: m_EditorClassIdentifier: - m_Device: 0 - m_PoseSource: 6 - m_TrackingType: 0 - m_UpdateType: 2 - m_UseRelativeTransform: 1 ---- !u!114 &114923820857209294 + BackgroundMaterial: {fileID: 2100000, guid: 03ad0130a037647aeb60218f61aca114, type: 2} +--- !u!114 &114963366853050710 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1960903772876386} + m_GameObject: {fileID: 1637996540812124} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: eb172c260d42e4f62945afda50892c0c, type: 3} + m_Script: {fileID: 1742909100, guid: 3a84de5cd0624681b6b6dcd8921d912a, type: 3} m_Name: m_EditorClassIdentifier: - BackgroundMaterial: {fileID: 2100000, guid: 03ad0130a037647aeb60218f61aca114, type: 2} + m_Device: 0 + m_PoseSource: 6 + m_TrackingType: 0 + m_UpdateType: 2 + m_UseRelativeTransform: 1 diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview.meta new file mode 100644 index 000000000..4a8208577 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: e1e9a08d000a446c9ad506ecb3a4d083 +folderAsset: yes +timeCreated: 1513969093 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins.meta new file mode 100644 index 000000000..6d4a6474e --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: ede998a9371e74aa6a759743f41b3eb6 +folderAsset: yes +timeCreated: 1513969093 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64.meta new file mode 100644 index 000000000..ed36e8810 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 42098948be8564f678777d26e6906df3 +folderAsset: yes +timeCreated: 1513969093 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll new file mode 100644 index 000000000..2e6e5f7e4 Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll differ diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll.meta new file mode 100644 index 000000000..aa02256a0 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 3a5f7d59b4b729446a1d2a9999f62bdb +timeCreated: 1513200317 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Windows + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle.meta new file mode 100644 index 000000000..0683b5e74 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle.meta @@ -0,0 +1,101 @@ +fileFormatVersion: 2 +guid: 1785ef67a37b1402f8f80e1f0658e486 +folderAsset: yes +timeCreated: 1515110710 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Editor: 0 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + - first: + '': OSXIntel + second: + enabled: 0 + settings: + CPU: None + - first: + '': OSXIntel64 + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: OSX + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Facebook: Win64 + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents.meta new file mode 100644 index 000000000..cdd5fcc29 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c22c793c4b5f447bbb532e92cb93d5ac +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS.meta new file mode 100644 index 000000000..ff6f0ebec --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 33d076be2f74340b98cb58cefe9122f7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin new file mode 100644 index 000000000..5e21d15e5 Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin differ diff --git a/sdkproject/Assets/GoogleARCore/LICENSE.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin.meta similarity index 67% rename from sdkproject/Assets/GoogleARCore/LICENSE.meta rename to sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin.meta index 4616bef18..9eab1b004 100644 --- a/sdkproject/Assets/GoogleARCore/LICENSE.meta +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 29a90add1a7164050863c7e390cc97be -timeCreated: 1515457486 +guid: 27a7f7613c41541ef8517d1b5390962b +timeCreated: 1516418595 licenseType: Pro DefaultImporter: externalObjects: {} diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib new file mode 100644 index 000000000..a2c5a41e0 Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib differ diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib.meta new file mode 100644 index 000000000..481ccf42d --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9a49dee3272c24e7794351bb17e92bd3 +timeCreated: 1516418595 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll new file mode 100644 index 000000000..06e205666 Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll differ diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll.meta new file mode 100644 index 000000000..54fbaede5 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: d80cb1919279b7348924bc747e2ada70 +timeCreated: 1513200317 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Windows + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts.meta new file mode 100644 index 000000000..c1960e641 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: a10b012db03ac404a87dcb0519846527 +folderAsset: yes +timeCreated: 1513969093 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs new file mode 100644 index 000000000..f628d10a7 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs @@ -0,0 +1,186 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCore +{ + using System; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.InteropServices; + using GoogleARCoreInternal; + using UnityEngine; + + /// + /// Helper class that provides touch input in lieu of Input.GetTouch when + /// running the Unity Editor. + /// + public static class InstantPreviewInput + { + private static Touch[] s_Touches = new Touch[0]; + + /// + /// Gets the available touch inputs from Instant Preview since the last + /// update. + /// + [SuppressMessage("UnityRules.UnityStyleRules", "US1000:FieldsMustBeUpperCamelCase", + Justification = "Overridden field.")] + public static Touch[] touches + { + get + { + return s_Touches; + } + } + + /// + /// Gets the number of touches available from Instant preview since the + /// last update. + /// + [SuppressMessage("UnityRules.UnityStyleRules", "US1000:FieldsMustBeUpperCamelCase", + Justification = "Overridden field.")] + public static int touchCount + { + get + { + return touches.Length; + } + } + + /// + /// Gets return value of Input.mousePosition. + /// + [SuppressMessage("UnityRules.UnityStyleRules", "US1000:FieldsMustBeUpperCamelCase", + Justification = "Overridden field.")] + public static Vector3 mousePosition + { + get + { + return Input.mousePosition; + } + } + + /// + /// Gets a value indicating whether a mouse device is detected. + /// + [SuppressMessage("UnityRules.UnityStyleRules", "US1000:FieldsMustBeUpperCamelCase", + Justification = "Overridden field.")] + public static bool mousePresent + { + get + { + return Input.mousePresent; + } + } + + /// + /// Gets a specific touch input from Instant Preview by index. + /// + /// Index of touch input to get. + /// Touch data. + public static Touch GetTouch(int index) + { + return touches[index]; + } + + /// + /// Passthrough function to Input.GetKey. + /// + /// Key parameter to pass to Input.GetKey. + /// Key state returned from Input.GetKey. + public static bool GetKey(KeyCode keyCode) + { + return Input.GetKey(keyCode); + } + + /// + /// Passthrough function to Input.GetMouseButton. + /// + /// Button index. + /// Return value of Input.GetMouseButton. + public static bool GetMouseButton(int button) + { + return Input.GetMouseButton(button); + } + + /// + /// Passthrough function to Input.GetMouseButtonDown. + /// + /// Button index. + /// Return value of Input.GetMouseButtonDown. + public static bool GetMouseButtonDown(int button) + { + return Input.GetMouseButtonDown(button); + } + + /// + /// Passthrough function to Input.GetMouseButtonUp. + /// + /// Button index. + /// Return value of Input.GetMouseButtonUp. + public static bool GetMouseButtonUp(int button) + { + return Input.GetMouseButtonUp(button); + } + + /// + /// Refreshes touch inputs from Instant Preview to reflect the state + /// since the last time Update was called. + /// + public static void Update() + { + if (!Application.isEditor) + { + return; + } + + IntPtr nativeTouchesPtr; + int nativeTouchCount; + NativeApi.GetTouches(out nativeTouchesPtr, out nativeTouchCount); + + var structSize = Marshal.SizeOf(typeof(NativeTouch)); + s_Touches = new Touch[nativeTouchCount]; + for (var i = 0; i < nativeTouchCount; ++i) + { + var source = new IntPtr(nativeTouchesPtr.ToInt64() + (i * structSize)); + var nativeTouch = (NativeTouch)Marshal.PtrToStructure(source, typeof(NativeTouch)); + + s_Touches[i] = new Touch() + { + phase = nativeTouch.Phase, + + // Note that the Unity's screen coordinate (0, 0) starts from bottom left. + position = new Vector2(nativeTouch.X, Screen.height - nativeTouch.Y), + }; + } + } + + private struct NativeTouch + { + public TouchPhase Phase; + public float X; + public float Y; + } + + private struct NativeApi + { + [DllImport(InstantPreviewManager.InstantPreviewNativeApi)] + public static extern void GetTouches(out IntPtr touches, out int count); + } + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs.meta similarity index 77% rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs.meta rename to sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs.meta index 6b534b6ea..040ca2529 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs.meta +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 5f09b2ba21eed493084a67bd51b5d3a0 -timeCreated: 1511395337 +guid: ed2d2995c742a6c4490fa51080dbf4cf +timeCreated: 1512422473 licenseType: Pro MonoImporter: externalObjects: {} diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs new file mode 100644 index 000000000..a3d84f8b7 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs @@ -0,0 +1,470 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System; + using System.Collections; + using System.IO; + using System.Runtime.InteropServices; + using System.Text; + using System.Threading; + using GoogleARCore; + using UnityEngine; + using UnityEngine.Rendering; + using UnityEngine.SpatialTracking; + + /// + /// Contains methods for managing communication to the Instant Preview + /// plugin. + /// + public static class InstantPreviewManager + { + /// + /// Name of the Instant Preview plugin library. + /// + public const string InstantPreviewNativeApi = "instant_preview_unity_plugin"; + + // Guid is taken from meta file and should never change. + private const string k_ApkGuid = "cf7b10762fe921e40a18151a6c92a8a6"; + private const string k_NoDevicesFoundAdbResult = "error: no devices/emulators found"; + private const float k_MaxTolerableAspectRatioDifference = 0.1f; + private const string k_MismatchedAspectRatioWarningFormatString = + "The aspect ratio of your game window is different from the aspect ratio of your Instant Preview camera " + + "texture. Please resize your game window's aspect ratio to match, or your preview will be distorted. The " + + "camera texture resolution is {0}, {1}."; + + private static readonly WaitForEndOfFrame k_WaitForEndOfFrame = new WaitForEndOfFrame(); + + /// + /// Coroutine method that communicates to the Instant Preview plugin + /// every frame. + /// + /// If not running in the editor, this does nothing. + /// + /// Enumerator for a coroutine that updates Instant Preview + /// every frame. + public static IEnumerator InitializeIfNeeded() + { + // Terminates if not running in editor. + if (!Application.isEditor) + { + yield break; + } + + // User may have explicitly disabled Instant Preview. + if (ARCoreProjectSettings.Instance != null && + !ARCoreProjectSettings.Instance.IsInstantPreviewEnabled) + { + yield break; + } + + var adbPath = InstantPreviewManager.GetAdbPath(); + if (adbPath == null) + { + Debug.LogError("Instant Preview requires your Unity Android SDK path to be set. Please set it under " + + "Preferences/External Tools/Android. You may need to install the Android SDK first."); + yield break; + } + else if (!File.Exists(adbPath)) + { + Debug.LogErrorFormat("adb not found at \"{0}\". Please add adb to your SDK path and restart the Unity editor.", adbPath); + yield break; + } + + string localVersion; + if (!StartServer(adbPath, out localVersion)) + { + yield break; + } + + yield return InstallApkAndRunIfConnected(adbPath, localVersion); + + yield return UpdateLoop(); + } + + /// + /// Uploads the latest camera video frame received from Instant Preview + /// to the specified texture. The texture might be recreated if it is + /// not the right size or null. + /// + /// Texture variable to store the latest + /// Instant Preview video frame. + /// True if InstantPreview updated the background texture, + /// false if it did not and the texture still needs updating. + public static bool UpdateBackgroundTextureIfNeeded(ref Texture2D backgroundTexture) + { + if (!Application.isEditor) + { + return false; + } + + IntPtr pixelBytes; + int width; + int height; + if (NativeApi.LockCameraTexture(out pixelBytes, out width, out height)) + { + if (backgroundTexture == null || width != backgroundTexture.width || + height != backgroundTexture.height) + { + backgroundTexture = new Texture2D(width, height, TextureFormat.BGRA32, false); + } + + backgroundTexture.LoadRawTextureData(pixelBytes, width * height * 4); + backgroundTexture.Apply(); + + NativeApi.UnlockCameraTexture(); + } + + return true; + } + + private static IEnumerator UpdateLoop() + { + // Creates a target texture to capture the preview window onto. + // Some video encoders prefer the dimensions to be a multiple of 16. + var targetWidth = RoundUpToNearestMultipleOf16(Screen.width); + var targetHeight = RoundUpToNearestMultipleOf16(Screen.height); + var screenTexture = new RenderTexture(targetWidth, targetHeight, 0); + + var renderEventFunc = NativeApi.GetRenderEventFunc(); + var shouldConvertToBrgra = SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11; + var targetTexture = screenTexture; + RenderTexture bgrTexture = null; + if (shouldConvertToBrgra) + { + bgrTexture = new RenderTexture(screenTexture.width, screenTexture.height, 0, RenderTextureFormat.BGRA32); + targetTexture = bgrTexture; + } + + var loggedAspectRatioWarning = false; + + // Begins update loop. The coroutine will cease when the + // ARCoreSession component it's called from is destroyed. + for (;;) + { + yield return k_WaitForEndOfFrame; + NativeApi.Update(); + InstantPreviewInput.Update(); + AddInstantPreviewTrackedPoseDriverWhenNeeded(); + + Graphics.Blit(null, screenTexture); + + if (shouldConvertToBrgra) + { + Graphics.Blit(screenTexture, bgrTexture); + } + + var cameraTexture = Frame.CameraImage.Texture; + if (!loggedAspectRatioWarning && cameraTexture != null) + { + var sourceWidth = cameraTexture.width; + var sourceHeight = cameraTexture.height; + var sourceAspectRatio = (float)sourceWidth / sourceHeight; + var destinationWidth = Screen.width; + var destinationHeight = Screen.height; + var destinationAspectRatio = (float)destinationWidth / destinationHeight; + + if (Mathf.Abs(sourceAspectRatio - destinationAspectRatio) > + k_MaxTolerableAspectRatioDifference) + { + Debug.LogWarning(string.Format(k_MismatchedAspectRatioWarningFormatString, sourceWidth, + sourceHeight)); + loggedAspectRatioWarning = true; + } + } + + NativeApi.SendFrame(targetTexture.GetNativeTexturePtr()); + GL.IssuePluginEvent(renderEventFunc, 69); + } + } + + private static void AddInstantPreviewTrackedPoseDriverWhenNeeded() + { + foreach (var poseDriver in Component.FindObjectsOfType()) + { + poseDriver.enabled = false; + var gameObject = poseDriver.gameObject; + var hasInstantPreviewTrackedPoseDriver = + gameObject.GetComponent() != null; + if (!hasInstantPreviewTrackedPoseDriver) + { + gameObject.AddComponent(); + } + } + } + + private static string GetAdbPath() + { + string sdkRoot = null; +#if UNITY_EDITOR + // Gets adb path and starts instant preview server. + sdkRoot = UnityEditor.EditorPrefs.GetString("AndroidSdkRoot"); +#endif // UNITY_EDITOR + + if (string.IsNullOrEmpty(sdkRoot)) + { + return null; + } + + // Gets adb path from known directory. + var adbPath = Path.Combine(Path.GetFullPath(sdkRoot), "platform-tools" + Path.DirectorySeparatorChar + "adb"); + + if (Application.platform == RuntimePlatform.WindowsEditor) + { + adbPath = Path.ChangeExtension(adbPath, "exe"); + } + + return adbPath; + } + + /// + /// Tries to install and run the Instant Preview android app. + /// + /// Path to adb to use for installing. + /// Local version of Instant Preview plugin to compare installed APK against. + /// Enumerator for coroutine that handles installation if necessary. + private static IEnumerator InstallApkAndRunIfConnected(string adbPath, string localVersion) + { + string apkPath = null; + +#if UNITY_EDITOR + apkPath = UnityEditor.AssetDatabase.GUIDToAssetPath(k_ApkGuid); +#endif // !UNITY_EDITOR + + // Early outs if set to install but the apk can't be found. + if (!File.Exists(apkPath)) + { + Debug.LogError( + string.Format("Trying to install Instant Preview apk but reference to InstantPreview.apk is " + + "broken. Couldn't find an asset with .meta file guid={0}", k_ApkGuid)); + yield break; + } + + Result result = new Result(); + + Thread checkAdbThread = new Thread((object obj) => + { + Result res = (Result)obj; + string output; + string errors; + + // Gets version of installed apk. + RunAdbCommand(adbPath, "shell dumpsys package com.google.ar.core.instantpreview | grep versionName", + out output, out errors); + string installedVersion = null; + if (!string.IsNullOrEmpty(output) && string.IsNullOrEmpty(errors)) + { + installedVersion = output.Substring(output.IndexOf('=') + 1); + } + + // Early outs if no device is connected. + if (string.Compare(errors, k_NoDevicesFoundAdbResult) == 0) + { + return; + } + + // Prints errors and exits on failure. + if (!string.IsNullOrEmpty(errors)) + { + Debug.LogError(errors); + return; + } + + if (installedVersion == null) + { + Debug.Log(string.Format( + "Instant Preview: app not found on device, attempting to install it from {0}.", + apkPath)); + } + else if (installedVersion != localVersion) + { + Debug.Log(string.Format( + "Instant Preview: installed version \"{0}\" does not match local version \"{1}\", attempting upgrade.", + installedVersion, localVersion)); + } + + res.ShouldPromptForInstall = installedVersion != localVersion; + }); + checkAdbThread.Start(result); + + while (!checkAdbThread.Join(0)) + { + yield return 0; + } + + if (result.ShouldPromptForInstall) + { + if (PromptToInstall()) + { + Thread installThread = new Thread(() => + { + string output; + string errors; + + RunAdbCommand(adbPath, + string.Format("uninstall com.google.ar.core.instantpreview", apkPath), + out output, out errors); + + RunAdbCommand(adbPath, + string.Format("install \"{0}\"", apkPath), + out output, out errors); + + // Prints any output from trying to install. + if (!string.IsNullOrEmpty(output)) + { + Debug.Log(output); + } + + if (!string.IsNullOrEmpty(errors)) + { + if (string.Equals(errors, "Success")) + { + Debug.Log("Successfully installed Instant Preview app."); + } + else + { + Debug.LogError(errors); + } + } + }); + installThread.Start(); + + while (!installThread.Join(0)) + { + yield return 0; + } + } + else + { + yield break; + } + } + + if (!NativeApi.IsConnected()) + { + new Thread(() => + { + string output; + string errors; + RunAdbCommand(adbPath, + "shell am start -n com.google.ar.core.instantpreview/.InstantPreviewActivity", + out output, out errors); + }).Start(); + } + } + + private static bool PromptToInstall() + { +#if UNITY_EDITOR + return UnityEditor.EditorUtility.DisplayDialog("Instant Preview", + "To instantly reflect your changes on device, the " + + "Instant Preview app will be installed on your " + + "connected phone.\n\nTo permanently disable Instant Preview, " + + "uncheck the InstantPreviewEnabled checkbox in Edit/Project Settings/ARCore Instant Preview Enabled.", "Okay", "Don't Install This Time"); +#else + return false; +#endif + } + + private static void RunAdbCommand(string fileName, string arguments, out string output, out string errors) + { + using (var process = new System.Diagnostics.Process()) + { + var startInfo = new System.Diagnostics.ProcessStartInfo(fileName, arguments); + startInfo.UseShellExecute = false; + startInfo.RedirectStandardError = true; + startInfo.RedirectStandardOutput = true; + startInfo.CreateNoWindow = true; + process.StartInfo = startInfo; + + var outputBuilder = new StringBuilder(); + var errorBuilder = new StringBuilder(); + process.OutputDataReceived += (sender, ef) => outputBuilder.Append(ef.Data); + process.ErrorDataReceived += (sender, ef) => errorBuilder.Append(ef.Data); + + process.Start(); + process.BeginOutputReadLine(); + process.BeginErrorReadLine(); + process.WaitForExit(); + process.Close(); + + // Trims the output strings to make comparison easier. + output = outputBuilder.ToString().Trim(); + errors = errorBuilder.ToString().Trim(); + } + } + + private static bool StartServer(string adbPath, out string version) + { + // Tries to start server. + const int k_InstantPreviewVersionStringMaxLength = 64; + var versionStringBuilder = new StringBuilder(k_InstantPreviewVersionStringMaxLength); + var started = NativeApi.InitializeInstantPreview(adbPath, versionStringBuilder, + versionStringBuilder.Capacity); + if (!started) + { + Debug.LogErrorFormat("Couldn't start Instant Preview server with adb path: {0}.", adbPath); + version = null; + return false; + } + + version = versionStringBuilder.ToString(); + Debug.Log("Instant Preview Version: " + version); + return true; + } + + private static int RoundUpToNearestMultipleOf16(int value) + { + return (value + 15) & ~15; + } + + private struct NativeApi + { + [DllImport(InstantPreviewNativeApi)] + public static extern bool InitializeInstantPreview( + string adbPath, StringBuilder version, int versionStringLength); + + [DllImport(InstantPreviewNativeApi)] + public static extern void Update(); + + [DllImport(InstantPreviewNativeApi)] + public static extern IntPtr GetRenderEventFunc(); + + [DllImport(InstantPreviewNativeApi)] + public static extern void SendFrame(IntPtr renderTexture); + + [DllImport(InstantPreviewNativeApi)] + public static extern bool LockCameraTexture(out IntPtr pixelBytes, out int width, + out int height); + + [DllImport(InstantPreviewNativeApi)] + public static extern void UnlockCameraTexture(); + + [DllImport(InstantPreviewNativeApi)] + public static extern bool IsConnected(); + } + + private class Result + { + public bool ShouldPromptForInstall = false; + } + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/VectorSubLayerTreeView.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs.meta similarity index 77% rename from sdkproject/Assets/Mapbox/Unity/Editor/VectorSubLayerTreeView.cs.meta rename to sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs.meta index 0b224614d..101cb5a44 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/VectorSubLayerTreeView.cs.meta +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: a9591575401b14570a6a95b275639eaf -timeCreated: 1518069137 +guid: 8d78f35e6ec68ed4ba199eddf266e308 +timeCreated: 1513720134 licenseType: Pro MonoImporter: externalObjects: {} diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs new file mode 100644 index 000000000..4515e1269 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCore +{ + using UnityEngine; + + /// + /// Drives cameras when using Instant Preview, since there is no easy way to + /// provide data to Unity's TrackedPoseDriver. + /// + public class InstantPreviewTrackedPoseDriver : MonoBehaviour + { + /// + /// Updates the game object's transform to that of the latest pose + /// received by Instant Preview. + /// + public void Update() + { + if (!Application.isEditor) + { + return; + } + + transform.position = Frame.Pose.position; + transform.rotation = Frame.Pose.rotation; + } + } +} diff --git a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteVideo.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs.meta similarity index 77% rename from sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteVideo.cs.meta rename to sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs.meta index 5882d805e..f56757ea9 100644 --- a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteVideo.cs.meta +++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: c700c8e0285e78d43be3948bfe834b2d -timeCreated: 1508289706 +guid: 307167e96a9af144789862588807c91b +timeCreated: 1512450063 licenseType: Pro MonoImporter: externalObjects: {} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Materials/ARBackground.shader b/sdkproject/Assets/GoogleARCore/SDK/Materials/ARBackground.shader index 65273bc55..a05825d8d 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Materials/ARBackground.shader +++ b/sdkproject/Assets/GoogleARCore/SDK/Materials/ARBackground.shader @@ -58,5 +58,60 @@ } } - FallBack Off + Subshader + { + Pass + { + ZWrite Off + + CGPROGRAM + + #pragma exclude_renderers gles3 + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + uniform float4 _UvTopLeftRight; + uniform float4 _UvBottomLeftRight; + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + }; + + v2f vert(appdata v) + { + float2 uvTop = lerp(_UvTopLeftRight.xy, _UvTopLeftRight.zw, v.uv.x); + float2 uvBottom = lerp(_UvBottomLeftRight.xy, _UvBottomLeftRight.zw, v.uv.x); + + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = lerp(uvTop, uvBottom, v.uv.y); + + // Instant preview's texture is transformed differently. + o.uv = o.uv.yx; + o.uv.x = 1.0 - o.uv.x; + + return o; + } + + sampler2D _MainTex; + + fixed4 frag(v2f i) : SV_Target + { + return tex2D(_MainTex, i.uv); + } + ENDCG + } + } + + FallBack Off } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar b/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar index 43b413be2..9d9732ffe 100644 Binary files a/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar differ diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar.meta b/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar.meta index 37152d392..a5cc8b2e5 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar.meta +++ b/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: 19eddef6ceb6961489b26fb8bf19f1e5 -timeCreated: 1510180815 +timeCreated: 1517361316 licenseType: Pro PluginImporter: externalObjects: {} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar new file mode 100644 index 000000000..8a1817891 Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar differ diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar.meta b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar.meta new file mode 100644 index 000000000..b610eba46 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar.meta @@ -0,0 +1,31 @@ +fileFormatVersion: 2 +guid: e2fd4640a9f7349438a5920ea2fb35f2 +timeCreated: 1518222616 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar new file mode 100644 index 000000000..be40e73d9 Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar differ diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar.meta b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar.meta new file mode 100644 index 000000000..3c485d19f --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar.meta @@ -0,0 +1,31 @@ +fileFormatVersion: 2 +guid: cb4b89ba21eac484797cfca938a1a5ea +timeCreated: 1518222591 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so index 63a0d85d0..11694aa5f 100644 Binary files a/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so differ diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so.meta b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so.meta index 9dbfe25cb..9272c6dc6 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so.meta +++ b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so.meta @@ -23,6 +23,7 @@ PluginImporter: Exclude OSXUniversal: 1 Exclude Win: 1 Exclude Win64: 1 + Exclude iOS: 1 - first: Android: Android second: @@ -30,7 +31,7 @@ PluginImporter: settings: CPU: ARMv7 - first: - Any: + Any: second: enabled: 0 settings: {} @@ -90,6 +91,13 @@ PluginImporter: enabled: 0 settings: CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: + - first: + iPhone: iOS + second: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so new file mode 100644 index 000000000..2b010c931 Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so differ diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so.meta b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so.meta new file mode 100644 index 000000000..e803faa08 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: ccde220b10a8b441a9b728f80d014cfe +timeCreated: 1513372698 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 1 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Android: Android + second: + enabled: 1 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/unityandroidpermissions.aar b/sdkproject/Assets/GoogleARCore/SDK/Plugins/unityandroidpermissions.aar index 44adf1b1e..acb6aa5a5 100644 Binary files a/sdkproject/Assets/GoogleARCore/SDK/Plugins/unityandroidpermissions.aar and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/unityandroidpermissions.aar differ diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/unitygar.aar b/sdkproject/Assets/GoogleARCore/SDK/Plugins/unitygar.aar index 23711fe70..e180693f9 100644 Binary files a/sdkproject/Assets/GoogleARCore/SDK/Plugins/unitygar.aar and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/unitygar.aar differ diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreBackgroundRenderer.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreBackgroundRenderer.cs index 9e85dccae..cb49abfe8 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreBackgroundRenderer.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreBackgroundRenderer.cs @@ -26,9 +26,6 @@ namespace GoogleARCore using UnityEngine; using UnityEngine.XR; - //// TODO (mtsmall): Consider if this component is the best way to expose background rendering and discuss approach - //// with Unity. - /// /// Renders the device's camera as a background to the attached Unity camera component. /// @@ -47,12 +44,6 @@ public class ARCoreBackgroundRenderer : MonoBehaviour private void OnEnable() { - if (Application.isEditor) - { - enabled = false; - return; - } - if (BackgroundMaterial == null) { Debug.LogError("ArCameraBackground:: No material assigned."); @@ -64,24 +55,21 @@ private void OnEnable() private void OnDisable() { - if (m_BackgroundRenderer != null) - { - m_BackgroundRenderer.camera = null; - m_BackgroundRenderer = null; - } + Disable(); } private void Update() { if (BackgroundMaterial == null) { - // A background rending material has not been assigned. + Disable(); return; } - else if (Frame.CameraImage.Texture == null) + + Texture backgroundTexture = Frame.CameraImage.Texture; + if (backgroundTexture == null) { - // TODO (mtsmall): Consider rendering a default background in this case. - // No texture is available. + Disable(); return; } @@ -89,16 +77,16 @@ private void Update() const string topLeftRightVar = "_UvTopLeftRight"; const string bottomLeftRightVar = "_UvBottomLeftRight"; - BackgroundMaterial.SetTexture(mainTexVar, Frame.CameraImage.Texture); - - ApiDisplayUvCoords uvQuad = Frame.CameraImage.DisplayUvCoords; + BackgroundMaterial.SetTexture(mainTexVar, backgroundTexture); + var uvQuad = Frame.CameraImage.DisplayUvCoords; BackgroundMaterial.SetVector(topLeftRightVar, new Vector4(uvQuad.TopLeft.x, uvQuad.TopLeft.y, uvQuad.TopRight.x, uvQuad.TopRight.y)); BackgroundMaterial.SetVector(bottomLeftRightVar, new Vector4(uvQuad.BottomLeft.x, uvQuad.BottomLeft.y, uvQuad.BottomRight.x, uvQuad.BottomRight.y)); - m_Camera.projectionMatrix = Frame.CameraImage.GetCameraProjectionMatrix(m_Camera.nearClipPlane, m_Camera.farClipPlane); + m_Camera.projectionMatrix = Frame.CameraImage.GetCameraProjectionMatrix( + m_Camera.nearClipPlane, m_Camera.farClipPlane); if (m_BackgroundRenderer == null) { @@ -108,5 +96,14 @@ private void Update() m_BackgroundRenderer.mode = ARRenderMode.MaterialAsBackground; } } + + private void Disable() + { + if (m_BackgroundRenderer != null) + { + m_BackgroundRenderer.camera = null; + m_BackgroundRenderer = null; + } + } } } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreSession.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreSession.cs index 9b025fcf9..29c000e1d 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreSession.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreSession.cs @@ -20,11 +20,8 @@ namespace GoogleARCore { - using System; - using System.Runtime.InteropServices; using GoogleARCoreInternal; using UnityEngine; - using UnityEngine.XR; /// /// A component that manages the ARCore Session in a Unity scene. @@ -37,47 +34,12 @@ public class ARCoreSession : MonoBehaviour [Tooltip("A scriptable object specifying the ARCore session configuration.")] public ARCoreSessionConfig SessionConfig; - /// - /// Toggles whether the tango service should be automatically connected upon Awake. - /// - [Tooltip("Toggles whether the tango service should be automatically connected upon Awake.")] - public bool ConnectOnAwake = false; - - private SessionManager m_SessionManager; - /// /// Unity Awake. /// public void Awake() { - if (Application.isEditor) - { - enabled = false; - return; - } - - if (FindObjectsOfType().Length > 1) - { - ARDebug.LogError("Multiple SessionComponents present in the game scene. Destroying the gameobject " + - "of the newest one."); - Destroy(gameObject); - return; - } - - m_SessionManager = SessionManager.CreateSession(); - Session.Initialize(m_SessionManager); - - if (Session.ConnectionState != SessionConnectionState.Uninitialized) - { - ARDebug.LogError("Could not create an ARCore session. The current Unity Editor may not support this " + - "version of ARCore."); - return; - } - - if (ConnectOnAwake) - { - Connect(); - } + LifecycleManager.Instance.CreateSession(this); } /// @@ -85,132 +47,23 @@ public void Awake() /// public void OnDestroy() { - Frame.Destroy(); - Session.Destroy(); + LifecycleManager.Instance.DestroySession(); } /// - /// Unity Update. + /// Unity OnEnable. /// - public void Update() + public void OnEnable() { - if (m_SessionManager == null) - { - return; - } - - AsyncTask.OnUpdate(); + LifecycleManager.Instance.EnableSession(); } /// - /// Connects an ARSession using {@link sessionConfig} configuration. Note that if user permissions are needed - /// they will be requested and thus this is an asynchronous method. + /// Unity OnDisable. /// - /// An {@link AsyncTask} that completes when the connection has been made or failed. - public AsyncTask Connect() + public void OnDisable() { - return Connect(SessionConfig); - } - - /// - /// Connects an ARSession. Note that if user permissions are needed they will be requested and thus this is an - /// asynchronous method. - /// - /// The session configuration. - /// An {@link AsyncTask} that completes when the connection has been made or failed. - public AsyncTask Connect(ARCoreSessionConfig sessionConfig) - { - const string androidCameraPermissionName = "android.permission.CAMERA"; - - if (m_SessionManager == null) - { - ARDebug.LogError("Cannot connect because ARCoreSession failed to initialize."); - return new AsyncTask(SessionConnectionState.Uninitialized); - } - - if (sessionConfig == null) - { - ARDebug.LogError("Unable to connect ARSession session due to missing ARSessionConfig."); - m_SessionManager.ConnectionState = SessionConnectionState.MissingConfiguration; - return new AsyncTask(Session.ConnectionState); - } - - // We have already connected at least once. - if (Session.ConnectionState != SessionConnectionState.Uninitialized) - { - ARDebug.LogError("Multiple attempts to connect to the ARSession. Note that the ARSession connection " + - "spans the lifetime of the application and cannot be reconfigured. This will change in future " + - "versions of ARCore."); - return new AsyncTask(Session.ConnectionState); - } - - // Create an asynchronous task for the potential permissions flow and service connection. - Action onTaskComplete; - var returnTask = new AsyncTask(out onTaskComplete); - returnTask.ThenAction((connectionState) => - { - m_SessionManager.ConnectionState = connectionState; - }); - - // Attempt service connection immediately if permissions are granted. - if (AndroidPermissionsManager.IsPermissionGranted(androidCameraPermissionName)) - { - _ResumeSession(sessionConfig, onTaskComplete); - return returnTask; - } - - // Request needed permissions and attempt service connection if granted. - AndroidPermissionsManager.RequestPermission(androidCameraPermissionName).ThenAction((requestResult) => - { - if (requestResult.IsAllGranted) - { - _ResumeSession(sessionConfig, onTaskComplete); - } - else - { - ARDebug.LogError("ARCore connection failed because a needed permission was rejected."); - onTaskComplete(SessionConnectionState.UserRejectedNeededPermission); - } - }); - - return returnTask; - } - - /// - /// Connects to the ARCore service. - /// - /// The session configuration to connect with. - /// A callback for when the result of the connection attempt is known. - private void _ResumeSession(ARCoreSessionConfig sessionConfig, Action onComplete) - { - if (!m_SessionManager.CheckSupported(sessionConfig)) - { - ARDebug.LogError("The requested ARCore session configuration is not supported."); - onComplete(SessionConnectionState.InvalidConfiguration); - return; - } - - if (!m_SessionManager.SetConfiguration(sessionConfig)) - { - ARDebug.LogError("ARCore connection failed because the current configuration is not supported."); - onComplete(SessionConnectionState.InvalidConfiguration); - return; - } - - Frame.Initialize(m_SessionManager.FrameManager); - - // ArSession_resume needs to be called in the UI thread due to b/69682628. - AsyncTask.PerformActionInUIThread(() => - { - if (!m_SessionManager.Resume()) - { - onComplete(SessionConnectionState.ConnectToServiceFailed); - } - else - { - onComplete(SessionConnectionState.Connected); - } - }); + LifecycleManager.Instance.DisableSession(); } } } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Anchor.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Anchor.cs index d28046eb0..b7e6dd43c 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Anchor.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Anchor.cs @@ -36,7 +36,7 @@ public class Anchor : MonoBehaviour private IntPtr m_AnchorNativeHandle = IntPtr.Zero; - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; private TrackingState m_LastFrameTrackingState = TrackingState.Stopped; @@ -47,7 +47,21 @@ public TrackingState TrackingState { get { - return m_NativeApi.Anchor.GetTrackingState(m_AnchorNativeHandle); + // TODO (b/73256094): Remove isTracking when fixed. + var nativeSession = LifecycleManager.Instance.NativeSession; + var isTracking = LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking; + if (nativeSession != m_NativeSession) + { + // Anchors from another session are considered stopped. + return TrackingState.Stopped; + } + else if (!isTracking) + { + // If there are no new frames coming in we must manually return paused. + return TrackingState.Paused; + } + + return m_NativeSession.AnchorApi.GetTrackingState(m_AnchorNativeHandle); } } @@ -55,7 +69,7 @@ public TrackingState TrackingState [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", Justification = "Internal")] - public static Anchor AnchorFactory(IntPtr anchorNativeHandle, NativeApi nativeApi) + public static Anchor AnchorFactory(IntPtr anchorNativeHandle, NativeSession nativeApi, bool isCreate = true) { if (anchorNativeHandle == IntPtr.Zero) { @@ -66,18 +80,23 @@ public static Anchor AnchorFactory(IntPtr anchorNativeHandle, NativeApi nativeAp if (s_AnchorDict.TryGetValue(anchorNativeHandle, out result)) { // Release acquired handle and return cached result - result.m_NativeApi.Anchor.Release(anchorNativeHandle); + result.m_NativeSession.AnchorApi.Release(anchorNativeHandle); return result; } - Anchor anchor = (new GameObject()).AddComponent(); - anchor.gameObject.name = "Anchor"; - anchor.m_AnchorNativeHandle = anchorNativeHandle; - anchor.m_NativeApi = nativeApi; - anchor.Update(); + if (isCreate) + { + Anchor anchor = (new GameObject()).AddComponent(); + anchor.gameObject.name = "Anchor"; + anchor.m_AnchorNativeHandle = anchorNativeHandle; + anchor.m_NativeSession = nativeApi; + anchor.Update(); + + s_AnchorDict.Add(anchorNativeHandle, anchor); + return anchor; + } - s_AnchorDict.Add(anchorNativeHandle, anchor); - return anchor; + return null; } //// @endcond @@ -91,7 +110,7 @@ private void Update() return; } - var pose = m_NativeApi.Anchor.GetPose(m_AnchorNativeHandle); + var pose = m_NativeSession.AnchorApi.GetPose(m_AnchorNativeHandle); transform.position = pose.position; transform.rotation = pose.rotation; @@ -116,7 +135,7 @@ private void OnDestroy() } s_AnchorDict.Remove(m_AnchorNativeHandle); - m_NativeApi.Anchor.Release(m_AnchorNativeHandle); + m_NativeSession.AnchorApi.Release(m_AnchorNativeHandle); } } } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/AndroidPermissionsManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/AndroidPermissionsManager.cs index 4e3842851..36ed83f69 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/AndroidPermissionsManager.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/AndroidPermissionsManager.cs @@ -54,6 +54,11 @@ public AndroidPermissionsManager() : base("com.unity3d.plugin.UnityAndroidPermis /// false. public static bool IsPermissionGranted(string permissionName) { + if (Application.isEditor) + { + return true; + } + return GetPermissionsService().Call("IsPermissionGranted", GetUnityActivity(), permissionName); } @@ -66,6 +71,12 @@ public static bool IsPermissionGranted(string permissionName) /// when another permissions request is pending null will be returned instead. public static AsyncTask RequestPermission(string permissionName) { + if (AndroidPermissionsManager.IsPermissionGranted(permissionName)) + { + return new AsyncTask(new AndroidPermissionsRequestResult( + new string[] { permissionName }, new bool[] { true })); + } + if (s_CurrentRequest != null) { ARDebug.LogError("Attempted to make simultaneous Android permissions requests."); diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api.meta index 257b6382b..9f5462908 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api.meta +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 1a99e3cb6bf111645b59b61e6e275c1f +guid: 11813694e8abb437eb9ef46ed1cc67c5 folderAsset: yes -timeCreated: 1519217563 -licenseType: Pro +timeCreated: 1502400396 +licenseType: Free DefaultImporter: externalObjects: {} userData: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/AnchorApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/AnchorApi.cs index 920ac862f..266e9c5c8 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/AnchorApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/AnchorApi.cs @@ -31,33 +31,33 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class AnchorApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public AnchorApi(NativeApi nativeApi) + public AnchorApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } public Pose GetPose(IntPtr anchorHandle) { - var poseHandle = m_NativeApi.Pose.Create(); - ExternApi.ArAnchor_getPose(m_NativeApi.SessionHandle, anchorHandle, poseHandle); - Pose resultPose = m_NativeApi.Pose.ExtractPoseValue(poseHandle); - m_NativeApi.Pose.Destroy(poseHandle); + var poseHandle = m_NativeSession.PoseApi.Create(); + ExternApi.ArAnchor_getPose(m_NativeSession.SessionHandle, anchorHandle, poseHandle); + Pose resultPose = m_NativeSession.PoseApi.ExtractPoseValue(poseHandle); + m_NativeSession.PoseApi.Destroy(poseHandle); return resultPose; } public TrackingState GetTrackingState(IntPtr anchorHandle) { ApiTrackingState trackingState = ApiTrackingState.Stopped; - ExternApi.ArAnchor_getTrackingState(m_NativeApi.SessionHandle, anchorHandle, + ExternApi.ArAnchor_getTrackingState(m_NativeSession.SessionHandle, anchorHandle, ref trackingState); return trackingState.ToTrackingState(); } public void Detach(IntPtr anchorHandle) { - ExternApi.ArAnchor_detach(m_NativeApi.SessionHandle, anchorHandle); + ExternApi.ArAnchor_detach(m_NativeSession.SessionHandle, anchorHandle); } public void Release(IntPtr anchorHandle) @@ -68,21 +68,21 @@ public void Release(IntPtr anchorHandle) public IntPtr CreateList() { IntPtr listHandle = IntPtr.Zero; - ExternApi.ArAnchorList_create(m_NativeApi.SessionHandle, ref listHandle); + ExternApi.ArAnchorList_create(m_NativeSession.SessionHandle, ref listHandle); return listHandle; } public int GetListSize(IntPtr anchorListHandle) { int size = 0; - ExternApi.ArAnchorList_getSize(m_NativeApi.SessionHandle, anchorListHandle, ref size); + ExternApi.ArAnchorList_getSize(m_NativeSession.SessionHandle, anchorListHandle, ref size); return size; } public IntPtr AcquireListItem(IntPtr anchorListHandle, int index) { IntPtr anchorHandle = IntPtr.Zero; - ExternApi.ArAnchorList_acquireItem(m_NativeApi.SessionHandle, anchorListHandle, index, + ExternApi.ArAnchorList_acquireItem(m_NativeSession.SessionHandle, anchorListHandle, index, ref anchorHandle); return anchorHandle; } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs new file mode 100644 index 000000000..a719f1723 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + using GoogleARCore; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public static class ApiApkInstallStatusExtensions + { + public static ApkInstallationStatus ToApkInstallationStatus(this ApiApkInstallationStatus apiStatus) + { + switch (apiStatus) + { + case ApiApkInstallationStatus.Uninitialized: + return ApkInstallationStatus.Uninitialized; + case ApiApkInstallationStatus.Requested: + return ApkInstallationStatus.Requested; + case ApiApkInstallationStatus.Success: + return ApkInstallationStatus.Success; + case ApiApkInstallationStatus.Error: + return ApkInstallationStatus.Error; + case ApiApkInstallationStatus.ErrorDeviceNotCompatible: + return ApkInstallationStatus.ErrorDeviceNotCompatible; + case ApiApkInstallationStatus.ErrorAndroidVersionNotSupported: + return ApkInstallationStatus.ErrorAndroidVersionNotSupported; + case ApiApkInstallationStatus.ErrorUserDeclined: + return ApkInstallationStatus.ErrorUserDeclined; + default: + UnityEngine.Debug.LogErrorFormat("Unexpected ApiApkInstallStatus status {0}", apiStatus); + return ApkInstallationStatus.Error; + } + } + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs.meta new file mode 100644 index 000000000..2cac95948 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 3345208dea93f4ca6a361f8852a87704 +timeCreated: 1517873495 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs new file mode 100644 index 000000000..5cb248468 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System.Diagnostics.CodeAnalysis; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public enum ApiApkInstallationStatus + { + Uninitialized = 0, + Requested = 1, + Success = 100, + Error = 200, + ErrorDeviceNotCompatible = 201, + ErrorAndroidVersionNotSupported = 202, + ErrorUserDeclined = 203, + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs.meta new file mode 100644 index 000000000..ec82243b8 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 7aa753c5e597b4841b03ea5f7f21326f +timeCreated: 1517874709 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs new file mode 100644 index 000000000..e4d652cdb --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System.Diagnostics.CodeAnalysis; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public enum ApiAvailability + { + UnknownError = 0, + UnknownChecking = 1, + UnknownTimedOut = 2, + UnsupportedDeviceNotCapable = 100, + SupportedNotInstalled = 201, + SupportedApkTooOld = 202, + SupportedInstalled = 203 + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs.meta new file mode 100644 index 000000000..3d4bcc357 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: a2ff5d80474fa4dcf979bc5ec9b89ca4 +timeCreated: 1517858100 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs new file mode 100644 index 000000000..70abf8e0b --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + using GoogleARCore; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public static class ApiAvailabilityExtensions + { + public static ApkAvailabilityStatus ToApkAvailabilityStatus(this ApiAvailability apiStatus) + { + switch (apiStatus) + { + case ApiAvailability.UnknownError: + return ApkAvailabilityStatus.UnknownError; + case ApiAvailability.UnknownChecking: + return ApkAvailabilityStatus.UnknownChecking; + case ApiAvailability.UnknownTimedOut: + return ApkAvailabilityStatus.UnknownTimedOut; + case ApiAvailability.UnsupportedDeviceNotCapable: + return ApkAvailabilityStatus.UnsupportedDeviceNotCapable; + case ApiAvailability.SupportedNotInstalled: + return ApkAvailabilityStatus.SupportedNotInstalled; + case ApiAvailability.SupportedApkTooOld: + return ApkAvailabilityStatus.SupportedApkTooOld; + case ApiAvailability.SupportedInstalled: + return ApkAvailabilityStatus.SupportedInstalled; + default: + UnityEngine.Debug.LogErrorFormat("Unexpected ApiAvailability status {0}", apiStatus); + return ApkAvailabilityStatus.UnknownError; + } + } + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs.meta new file mode 100644 index 000000000..8d50e66d7 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: da78fe0b9a17c46dea099872f469ccd7 +timeCreated: 1517871435 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiConstants.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiConstants.cs index d023330ce..6bfa7a5b6 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiConstants.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiConstants.cs @@ -31,8 +31,13 @@ namespace GoogleARCoreInternal Justification = "Internal")] public static class ApiConstants { +#if !UNITY_EDITOR public const string ARCoreNativeApi = "arcore_sdk"; public const string ARCoreShimApi = "arcore_unity_api"; +#else + public const string ARCoreNativeApi = InstantPreviewManager.InstantPreviewNativeApi; + public const string ARCoreShimApi = InstantPreviewManager.InstantPreviewNativeApi; +#endif // NDK camera API is a system API after Android 24. public const string NdkCameraApi = "camera2ndk"; diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApiLightEstimationMode.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiLightEstimationMode.cs similarity index 100% rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/ApiLightEstimationMode.cs rename to sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiLightEstimationMode.cs diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApiLightEstimationMode.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiLightEstimationMode.cs.meta similarity index 77% rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/ApiLightEstimationMode.cs.meta rename to sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiLightEstimationMode.cs.meta index de2745c7c..e698b6147 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApiLightEstimationMode.cs.meta +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiLightEstimationMode.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 17818a5e2bd077f4fbaf893257754c05 -timeCreated: 1512178510 +guid: 31136b31f422e49a5b4307c1b3bff384 +timeCreated: 1512782847 licenseType: Pro MonoImporter: externalObjects: {} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs new file mode 100644 index 000000000..76e67235b --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System.Diagnostics.CodeAnalysis; + using System.Runtime.InteropServices; + using GoogleARCore; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + [StructLayout(LayoutKind.Sequential)] + public struct ApiPrestoConfig + { + public ApiUpdateMode UpdateMode; + public ApiPlaneFindingMode PlaneFindingMode; + public ApiLightEstimationMode LightEstimationMode; + + public ApiPrestoConfig(ARCoreSessionConfig config) + { + UpdateMode = config.MatchCameraFramerate ? + ApiUpdateMode.Blocking : ApiUpdateMode.LatestCameraImage; + PlaneFindingMode = config.EnablePlaneFinding ? + ApiPlaneFindingMode.Horizontal : ApiPlaneFindingMode.Disabled; + LightEstimationMode = config.EnableLightEstimation ? + ApiLightEstimationMode.AmbientIntensity : ApiLightEstimationMode.Disabled; + } + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs.meta new file mode 100644 index 000000000..66775228e --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: d8a0d471a5e1c486fb61de90a976a6d3 +timeCreated: 1518035095 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs new file mode 100644 index 000000000..85bdacc6a --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System.Diagnostics.CodeAnalysis; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public enum ApiPrestoStatus + { + Uninitialized = 0, + RequestingApkInstall = 1, + RequestingPermission = 2, + + Resumed = 100, + ResumedNotTracking = 101, + Paused = 102, + + ErrorFatal = 200, + ErrorApkNotAvailable = 201, + ErrorPermissionNotGranted = 202, + ErrorSessionConfigurationNotSupported = 203, + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs.meta new file mode 100644 index 000000000..6125bc008 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: f77bf9ab0d39f4875b26d70fce838285 +timeCreated: 1513291504 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs new file mode 100644 index 000000000..d223292f4 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System.Diagnostics.CodeAnalysis; + using GoogleARCore; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public static class ApiPrestoStatusExtensions + { + public static SessionStatus ToSessionStatus(this ApiPrestoStatus prestoStatus) + { + switch (prestoStatus) + { + case ApiPrestoStatus.Uninitialized: + return SessionStatus.None; + case ApiPrestoStatus.RequestingApkInstall: + case ApiPrestoStatus.RequestingPermission: + return SessionStatus.Initializing; + case ApiPrestoStatus.Resumed: + return SessionStatus.Tracking; + case ApiPrestoStatus.ResumedNotTracking: + return SessionStatus.LostTracking; + case ApiPrestoStatus.Paused: + return SessionStatus.NotTracking; + case ApiPrestoStatus.ErrorFatal: + return SessionStatus.FatalError; + case ApiPrestoStatus.ErrorApkNotAvailable: + return SessionStatus.ErrorApkNotAvailable; + case ApiPrestoStatus.ErrorPermissionNotGranted: + return SessionStatus.ErrorPermissionNotGranted; + case ApiPrestoStatus.ErrorSessionConfigurationNotSupported: + return SessionStatus.ErrorSessionConfigurationNotSupported; + default: + UnityEngine.Debug.LogErrorFormat("Unexpected presto status {0}", prestoStatus); + return SessionStatus.FatalError; + } + } + } +} \ No newline at end of file diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs.meta new file mode 100644 index 000000000..1a53f6ab2 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 20257a5d02b574ec8a372bb9e319d8b3 +timeCreated: 1513294266 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs new file mode 100644 index 000000000..fdc72ad8b --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System.Diagnostics.CodeAnalysis; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public enum ApiTrackedPointOrientationMode + { + Identity = 0, + SurfaceNormal = 1, + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs.meta new file mode 100644 index 000000000..ac3c10cfb --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 1e55289de34ec44b191ed1bdc5b17c9d +timeCreated: 1517185900 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs new file mode 100644 index 000000000..ef3a7668b --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System; + using System.Diagnostics.CodeAnalysis; + using GoogleARCore; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public static class ApiTrackedPointOrientationModeExtensions + { + public static TrackedPointOrientationMode ToTrackedPointOrientationMode( + this ApiTrackedPointOrientationMode apiMode) + { + switch (apiMode) + { + case ApiTrackedPointOrientationMode.Identity: + return TrackedPointOrientationMode.Identity; + case ApiTrackedPointOrientationMode.SurfaceNormal: + return TrackedPointOrientationMode.SurfaceNormal; + default: + ARDebug.LogError("Invalid value for ApiTrackedPointOrientationMode."); + return TrackedPointOrientationMode.Identity; + } + } + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs.meta new file mode 100644 index 000000000..c73b189fc --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: f7f21e3757d39475aae8f4a13d02253a +timeCreated: 1517185900 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraApi.cs index 1cb3847e0..aadf63a4e 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraApi.cs @@ -31,17 +31,17 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class CameraApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public CameraApi(NativeApi nativeApi) + public CameraApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } public TrackingState GetTrackingState(IntPtr cameraHandle) { ApiTrackingState apiTrackingState = ApiTrackingState.Stopped; - ExternApi.ArCamera_getTrackingState(m_NativeApi.SessionHandle, + ExternApi.ArCamera_getTrackingState(m_NativeSession.SessionHandle, cameraHandle, ref apiTrackingState); return apiTrackingState.ToTrackingState(); } @@ -53,18 +53,18 @@ public Pose GetPose(IntPtr cameraHandle) return Pose.identity; } - IntPtr poseHandle = m_NativeApi.Pose.Create(); - ExternApi.ArCamera_getDisplayOrientedPose(m_NativeApi.SessionHandle, cameraHandle, + IntPtr poseHandle = m_NativeSession.PoseApi.Create(); + ExternApi.ArCamera_getDisplayOrientedPose(m_NativeSession.SessionHandle, cameraHandle, poseHandle); - Pose resultPose = m_NativeApi.Pose.ExtractPoseValue(poseHandle); - m_NativeApi.Pose.Destroy(poseHandle); + Pose resultPose = m_NativeSession.PoseApi.ExtractPoseValue(poseHandle); + m_NativeSession.PoseApi.Destroy(poseHandle); return resultPose; } public Matrix4x4 GetProjectionMatrix(IntPtr cameraHandle, float near, float far) { Matrix4x4 matrix = Matrix4x4.identity; - ExternApi.ArCamera_getProjectionMatrix(m_NativeApi.SessionHandle, cameraHandle, + ExternApi.ArCamera_getProjectionMatrix(m_NativeSession.SessionHandle, cameraHandle, near, far, ref matrix); return matrix; } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraMetadataApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraMetadataApi.cs index 1112b02d6..bf92df7d5 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraMetadataApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraMetadataApi.cs @@ -31,11 +31,11 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class CameraMetadataApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public CameraMetadataApi(NativeApi nativeApi) + public CameraMetadataApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } public void Release(IntPtr arCameraMetadataHandle) @@ -47,7 +47,7 @@ public bool TryGetValues(IntPtr cameraMetadataHandle, CameraMetadataTag tag, List resultList) { IntPtr ndkMetadataHandle = IntPtr.Zero; - ExternApi.ArImageMetadata_getNdkCameraMetadata(m_NativeApi.SessionHandle, + ExternApi.ArImageMetadata_getNdkCameraMetadata(m_NativeSession.SessionHandle, cameraMetadataHandle, ref ndkMetadataHandle); resultList.Clear(); @@ -111,7 +111,7 @@ public bool TryGetValues(IntPtr cameraMetadataHandle, public bool GetAllCameraMetadataTags(IntPtr cameraMetadataHandle, List resultList) { IntPtr ndkMetadataHandle = IntPtr.Zero; - ExternApi.ArImageMetadata_getNdkCameraMetadata(m_NativeApi.SessionHandle, + ExternApi.ArImageMetadata_getNdkCameraMetadata(m_NativeSession.SessionHandle, cameraMetadataHandle, ref ndkMetadataHandle); IntPtr tagsHandle = IntPtr.Zero; diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/FrameApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/FrameApi.cs index ce1078614..a92eee9d0 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/FrameApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/FrameApi.cs @@ -31,87 +31,83 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class FrameApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public FrameApi(NativeApi nativeApi) + public FrameApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } - public long GetTimestamp(IntPtr frameHandle) + public long GetTimestamp() { long timestamp = 0; - ExternApi.ArFrame_getTimestamp(m_NativeApi.SessionHandle, frameHandle, + ExternApi.ArFrame_getTimestamp(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle, ref timestamp); return timestamp; } - public IntPtr AcquireCamera(IntPtr frameHandle) + public IntPtr AcquireCamera() { - if (frameHandle == IntPtr.Zero) - { - return IntPtr.Zero; - } - IntPtr cameraHandle = IntPtr.Zero; - ExternApi.ArFrame_acquireCamera(m_NativeApi.SessionHandle, frameHandle, + ExternApi.ArFrame_acquireCamera(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle, ref cameraHandle); return cameraHandle; } - public IntPtr AcquirePointCloud(IntPtr frameHandle) + public IntPtr AcquirePointCloud() { IntPtr pointCloudHandle = IntPtr.Zero; - ExternApi.ArFrame_acquirePointCloud(m_NativeApi.SessionHandle, frameHandle, + ExternApi.ArFrame_acquirePointCloud(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle, ref pointCloudHandle); return pointCloudHandle; } - public IntPtr AcquireImageMetadata(IntPtr frameHandle) + public IntPtr AcquireImageMetadata() { IntPtr imageMetadataHandle = IntPtr.Zero; - ExternApi.ArFrame_acquireImageMetadata(m_NativeApi.SessionHandle, frameHandle, ref imageMetadataHandle); + ExternApi.ArFrame_acquireImageMetadata(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle, + ref imageMetadataHandle); return imageMetadataHandle; } - public LightEstimate GetLightEstimate(IntPtr frameHandle) + public LightEstimate GetLightEstimate() { - IntPtr lightEstimateHandle = m_NativeApi.LightEstimate.Create(); - ExternApi.ArFrame_getLightEstimate(m_NativeApi.SessionHandle, frameHandle, + IntPtr lightEstimateHandle = m_NativeSession.LightEstimateApi.Create(); + ExternApi.ArFrame_getLightEstimate(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle, lightEstimateHandle); - LightEstimateState state = m_NativeApi.LightEstimate.GetState(lightEstimateHandle); - float pixelIntensity = m_NativeApi.LightEstimate.GetPixelIntensity(lightEstimateHandle); + LightEstimateState state = m_NativeSession.LightEstimateApi.GetState(lightEstimateHandle); + float pixelIntensity = m_NativeSession.LightEstimateApi.GetPixelIntensity(lightEstimateHandle); - m_NativeApi.LightEstimate.Destroy(lightEstimateHandle); + m_NativeSession.LightEstimateApi.Destroy(lightEstimateHandle); return new LightEstimate(state, pixelIntensity); } - public void TransformDisplayUvCoords(IntPtr frameHandle, ref ApiDisplayUvCoords uv) + public void TransformDisplayUvCoords(ref ApiDisplayUvCoords uv) { ApiDisplayUvCoords uvOut = new ApiDisplayUvCoords(); - ExternApi.ArFrame_transformDisplayUvCoords(m_NativeApi.SessionHandle, frameHandle, + ExternApi.ArFrame_transformDisplayUvCoords(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle, ApiDisplayUvCoords.NumFloats, ref uv, ref uvOut); uv = uvOut; } - public void GetUpdatedTrackables(IntPtr frameHandle, List trackables) + public void GetUpdatedTrackables(List trackables) { - IntPtr listHandle = m_NativeApi.TrackableList.Create(); - ExternApi.ArFrame_getUpdatedTrackables(m_NativeApi.SessionHandle, frameHandle, + IntPtr listHandle = m_NativeSession.TrackableListApi.Create(); + ExternApi.ArFrame_getUpdatedTrackables(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle, ApiTrackableType.BaseTrackable, listHandle); trackables.Clear(); - int count = m_NativeApi.TrackableList.GetCount(listHandle); + int count = m_NativeSession.TrackableListApi.GetCount(listHandle); for (int i = 0; i < count; i++) { - IntPtr trackableHandle = m_NativeApi.TrackableList.AcquireItem(listHandle, i); - trackables.Add(m_NativeApi.TrackableFactory(trackableHandle)); + IntPtr trackableHandle = m_NativeSession.TrackableListApi.AcquireItem(listHandle, i); + trackables.Add(m_NativeSession.TrackableFactory(trackableHandle)); } - m_NativeApi.TrackableList.Destroy(listHandle); + m_NativeSession.TrackableListApi.Destroy(listHandle); } private struct ExternApi diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/HitTestApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/HitTestApi.cs index 3bad319df..0f6899503 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/HitTestApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/HitTestApi.cs @@ -31,11 +31,11 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class HitTestApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public HitTestApi(NativeApi nativeApi) + public HitTestApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } public bool Raycast(IntPtr frameHandle, float x, float y, TrackableHitFlags filter, @@ -44,16 +44,16 @@ public bool Raycast(IntPtr frameHandle, float x, float y, TrackableHitFlags filt outHitList.Clear(); IntPtr hitResultListHandle = IntPtr.Zero; - ExternApi.ArHitResultList_create(m_NativeApi.SessionHandle, ref hitResultListHandle); - ExternApi.ArFrame_hitTest(m_NativeApi.SessionHandle, frameHandle, x, y, hitResultListHandle); + ExternApi.ArHitResultList_create(m_NativeSession.SessionHandle, ref hitResultListHandle); + ExternApi.ArFrame_hitTest(m_NativeSession.SessionHandle, frameHandle, x, y, hitResultListHandle); int hitListSize = 0; - ExternApi.ArHitResultList_getSize(m_NativeApi.SessionHandle, hitResultListHandle, ref hitListSize); + ExternApi.ArHitResultList_getSize(m_NativeSession.SessionHandle, hitResultListHandle, ref hitListSize); for (int i = 0; i < hitListSize; i++) { - TrackableHit trackableHit = new TrackableHit(); - if (HitResultListGetItemAt(hitResultListHandle, i, ref trackableHit)) + TrackableHit trackableHit; + if (HitResultListGetItemAt(hitResultListHandle, i, out trackableHit)) { if ((filter & trackableHit.Flags) != TrackableHitFlags.None) { @@ -66,12 +66,14 @@ public bool Raycast(IntPtr frameHandle, float x, float y, TrackableHitFlags filt return outHitList.Count != 0; } - private bool HitResultListGetItemAt(IntPtr hitResultListHandle, int index, ref TrackableHit outTrackableHit) + private bool HitResultListGetItemAt(IntPtr hitResultListHandle, int index, out TrackableHit outTrackableHit) { + outTrackableHit = new TrackableHit(); + // Query the hit result. IntPtr hitResultHandle = IntPtr.Zero; - ExternApi.ArHitResult_create(m_NativeApi.SessionHandle, ref hitResultHandle); - ExternApi.ArHitResultList_getItem(m_NativeApi.SessionHandle, hitResultListHandle, index, hitResultHandle); + ExternApi.ArHitResult_create(m_NativeSession.SessionHandle, ref hitResultHandle); + ExternApi.ArHitResultList_getItem(m_NativeSession.SessionHandle, hitResultListHandle, index, hitResultHandle); if (hitResultHandle == IntPtr.Zero) { ExternApi.ArHitResult_destroy(hitResultHandle); @@ -79,36 +81,36 @@ private bool HitResultListGetItemAt(IntPtr hitResultListHandle, int index, ref T } // Query the pose from hit result. - IntPtr poseHandle = m_NativeApi.Pose.Create(); - ExternApi.ArHitResult_getHitPose(m_NativeApi.SessionHandle, hitResultHandle, poseHandle); - Pose hitPose = m_NativeApi.Pose.ExtractPoseValue(poseHandle); + IntPtr poseHandle = m_NativeSession.PoseApi.Create(); + ExternApi.ArHitResult_getHitPose(m_NativeSession.SessionHandle, hitResultHandle, poseHandle); + Pose hitPose = m_NativeSession.PoseApi.ExtractPoseValue(poseHandle); // Query the distance from hit result. float hitDistance = 0.0f; - ExternApi.ArHitResult_getDistance(m_NativeApi.SessionHandle, hitResultHandle, ref hitDistance); + ExternApi.ArHitResult_getDistance(m_NativeSession.SessionHandle, hitResultHandle, ref hitDistance); // Query the trackable from hit result. IntPtr trackableHandle = IntPtr.Zero; - ExternApi.ArHitResult_acquireTrackable(m_NativeApi.SessionHandle, hitResultHandle, ref trackableHandle); - Trackable trackable = m_NativeApi.TrackableFactory(trackableHandle); - m_NativeApi.Trackable.Release(trackableHandle); + ExternApi.ArHitResult_acquireTrackable(m_NativeSession.SessionHandle, hitResultHandle, ref trackableHandle); + Trackable trackable = m_NativeSession.TrackableFactory(trackableHandle); + m_NativeSession.TrackableApi.Release(trackableHandle); // Calculate trackable hit flags. TrackableHitFlags flag = TrackableHitFlags.None; if (trackable == null) { Debug.Log("Could not create trackable from hit result."); - m_NativeApi.Pose.Destroy(poseHandle); + m_NativeSession.PoseApi.Destroy(poseHandle); return false; } else if (trackable is TrackedPlane) { - if (m_NativeApi.Plane.IsPoseInPolygon(trackableHandle, poseHandle)) + if (m_NativeSession.PlaneApi.IsPoseInPolygon(trackableHandle, poseHandle)) { flag |= TrackableHitFlags.PlaneWithinPolygon; } - if (m_NativeApi.Plane.IsPoseInExtents(trackableHandle, poseHandle)) + if (m_NativeSession.PlaneApi.IsPoseInExtents(trackableHandle, poseHandle)) { flag |= TrackableHitFlags.PlaneWithinBounds; } @@ -117,16 +119,21 @@ private bool HitResultListGetItemAt(IntPtr hitResultListHandle, int index, ref T } else if (trackable is TrackedPoint) { - flag |= TrackableHitFlags.PointCloud; + var point = trackable as TrackedPoint; + flag |= TrackableHitFlags.FeaturePoint; + if (point.OrientationMode == TrackedPointOrientationMode.SurfaceNormal) + { + flag |= TrackableHitFlags.FeaturePointWithSurfaceNormal; + } } else { - m_NativeApi.Pose.Destroy(poseHandle); + m_NativeSession.PoseApi.Destroy(poseHandle); return false; } outTrackableHit = new TrackableHit(hitPose, hitDistance, flag, trackable); - m_NativeApi.Pose.Destroy(poseHandle); + m_NativeSession.PoseApi.Destroy(poseHandle); return true; } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/LightEstimateApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/LightEstimateApi.cs index 318e7699f..ddf7da698 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/LightEstimateApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/LightEstimateApi.cs @@ -29,17 +29,17 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class LightEstimateApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public LightEstimateApi(NativeApi nativeApi) + public LightEstimateApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } public IntPtr Create() { IntPtr lightEstimateHandle = IntPtr.Zero; - ExternApi.ArLightEstimate_create(m_NativeApi.SessionHandle, ref lightEstimateHandle); + ExternApi.ArLightEstimate_create(m_NativeSession.SessionHandle, ref lightEstimateHandle); return lightEstimateHandle; } @@ -51,14 +51,14 @@ public void Destroy(IntPtr lightEstimateHandle) public LightEstimateState GetState(IntPtr lightEstimateHandle) { ApiLightEstimateState state = ApiLightEstimateState.NotValid; - ExternApi.ArLightEstimate_getState(m_NativeApi.SessionHandle, lightEstimateHandle, ref state); + ExternApi.ArLightEstimate_getState(m_NativeSession.SessionHandle, lightEstimateHandle, ref state); return state.ToLightEstimateState(); } public float GetPixelIntensity(IntPtr lightEstimateHandle) { float pixelIntensity = 0; - ExternApi.ArLightEstimate_getPixelIntensity(m_NativeApi.SessionHandle, + ExternApi.ArLightEstimate_getPixelIntensity(m_NativeSession.SessionHandle, lightEstimateHandle, ref pixelIntensity); return pixelIntensity; } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs deleted file mode 100644 index 599ec8998..000000000 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs +++ /dev/null @@ -1,186 +0,0 @@ -//----------------------------------------------------------------------- -// -// -// Copyright 2017 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// -//----------------------------------------------------------------------- - -namespace GoogleARCoreInternal -{ - using System; - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using System.Runtime.InteropServices; - using GoogleARCore; - using UnityEngine; - - [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", - Justification = "Internal")] - public class NativeApi - { - private Dictionary m_TrackableDict = new Dictionary(new IntPtrEqualityComparer()); - - private IntPtr m_SessionHandle = IntPtr.Zero; - - private EarlyUpdateCallback m_OnEarlyUpdate; - - private NativeApi() - { - } - - ~NativeApi() - { - Destroy(); - } - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void EarlyUpdateCallback(IntPtr frameHandle, int textureId); - - public IntPtr SessionHandle - { - get - { - return m_SessionHandle; - } - } - - public AnchorApi Anchor { get; private set; } - - public CameraApi Camera { get; private set; } - - public FrameApi Frame { get; private set; } - - public HitTestApi HitTest { get; private set; } - - public LightEstimateApi LightEstimate { get; private set; } - - public PlaneApi Plane { get; private set; } - - public PointApi Point { get; private set; } - - public PointCloudApi PointCloud { get; private set; } - - public PoseApi Pose { get; private set; } - - public SessionApi Session { get; private set; } - - public SessionConfigApi SessionConfig { get; private set; } - - public TrackableApi Trackable { get; private set; } - - public TrackableListApi TrackableList { get; private set; } - - public CameraMetadataApi CameraMetadata { get; private set; } - - public static NativeApi CreateSession() - { - NativeApi nativeApi = new NativeApi(); - ExternApi.ArCoreUnity_createSession(ref nativeApi.m_SessionHandle); - - if (nativeApi.m_SessionHandle == IntPtr.Zero) - { - Debug.LogError("ARCore failed to create a session."); - return null; - } - - nativeApi.Anchor = new AnchorApi(nativeApi); - nativeApi.Camera = new CameraApi(nativeApi); - nativeApi.Frame = new FrameApi(nativeApi); - nativeApi.HitTest = new HitTestApi(nativeApi); - nativeApi.LightEstimate = new LightEstimateApi(nativeApi); - nativeApi.Plane = new PlaneApi(nativeApi); - nativeApi.Point = new PointApi(nativeApi); - nativeApi.PointCloud = new PointCloudApi(nativeApi); - nativeApi.Pose = new PoseApi(nativeApi); - nativeApi.Session = new SessionApi(nativeApi); - nativeApi.SessionConfig = new SessionConfigApi(nativeApi); - nativeApi.Trackable = new TrackableApi(nativeApi); - nativeApi.TrackableList = new TrackableListApi(nativeApi); - nativeApi.CameraMetadata = new CameraMetadataApi(nativeApi); - - nativeApi.Session.ReportEngineType(); - - return nativeApi; - } - - public void Destroy() - { - if (m_SessionHandle != IntPtr.Zero) - { - ExternApi.ArCoreUnity_destroySession(); - m_SessionHandle = IntPtr.Zero; - } - } - - public bool Resume(EarlyUpdateCallback onEarlyUpdate) - { - m_OnEarlyUpdate = onEarlyUpdate; - return ExternApi.ArCoreUnity_resumeSession(m_OnEarlyUpdate); - } - - /// - /// Factory method for creating and reusing TrackedPlane references from native handles. - /// - /// A native handle to a plane that has been acquired. RELEASE WILL BE HANDLED BY - /// THIS METHOD. - /// A reference to a tracked plane. - public Trackable TrackableFactory(IntPtr nativeHandle) - { - if (nativeHandle == IntPtr.Zero) - { - return null; - } - - Trackable result; - if (m_TrackableDict.TryGetValue(nativeHandle, out result)) - { - // Release aquired handle and return cached result. - Trackable.Release(nativeHandle); - return result; - } - - ApiTrackableType trackableType = Trackable.GetType(nativeHandle); - if (trackableType == ApiTrackableType.Plane) - { - result = new TrackedPlane(nativeHandle, this); - } - else if (trackableType == ApiTrackableType.Point) - { - result = new TrackedPoint(nativeHandle, this); - } - else - { - UnityEngine.Debug.LogFormat("Cant find {0}", trackableType); - throw new NotImplementedException("TrackableFactory:: No contructor for requested trackable type."); - } - - m_TrackableDict.Add(nativeHandle, result); - return result; - } - - private struct ExternApi - { - [DllImport(ApiConstants.ARCoreShimApi)] - public static extern void ArCoreUnity_createSession(ref IntPtr sessionHandle); - - [DllImport(ApiConstants.ARCoreShimApi)] - public static extern void ArCoreUnity_destroySession(); - - [DllImport(ApiConstants.ARCoreShimApi)] - public static extern bool ArCoreUnity_resumeSession(EarlyUpdateCallback earlyUpdate); - } - } -} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs new file mode 100644 index 000000000..0c83d5545 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs @@ -0,0 +1,161 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System; + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.InteropServices; + using GoogleARCore; + using UnityEngine; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public class NativeSession + { + private IntPtr m_SessionHandle = IntPtr.Zero; + + private IntPtr m_FrameHandle = IntPtr.Zero; + + private IntPtr m_PointCloudHandle = IntPtr.Zero; + + private float m_LastReleasedPointcloudTimestamp = 0.0f; + + private TrackableManager m_TrackableManager = null; + + public NativeSession(IntPtr sessionHandle, IntPtr frameHandle) + { + m_SessionHandle = sessionHandle; + m_FrameHandle = frameHandle; + m_TrackableManager = new TrackableManager(this); + + AnchorApi = new AnchorApi(this); + CameraApi = new CameraApi(this); + CameraMetadataApi = new CameraMetadataApi(this); + FrameApi = new FrameApi(this); + HitTestApi = new HitTestApi(this); + LightEstimateApi = new LightEstimateApi(this); + PlaneApi = new PlaneApi(this); + PointApi = new PointApi(this); + PointCloudApi = new PointCloudApi(this); + PoseApi = new PoseApi(this); + SessionApi = new SessionApi(this); + SessionConfigApi = new SessionConfigApi(this); + TrackableApi = new TrackableApi(this); + TrackableListApi = new TrackableListApi(this); + } + + public IntPtr SessionHandle + { + get + { + return m_SessionHandle; + } + } + + public IntPtr FrameHandle + { + get + { + return m_FrameHandle; + } + } + + public IntPtr PointCloudHandle + { + get + { + return m_PointCloudHandle; + } + } + + public bool IsPointCloudNew + { + get + { + // TODO (b/73256094): Remove when fixed. + if (LifecycleManager.Instance.SessionStatus != SessionStatus.Tracking) + { + var previousLastTimestamp = m_LastReleasedPointcloudTimestamp; + m_LastReleasedPointcloudTimestamp = 0.0f; + return previousLastTimestamp != 0; + } + + return PointCloudApi.GetTimestamp(PointCloudHandle) != m_LastReleasedPointcloudTimestamp; + } + } + + public AnchorApi AnchorApi { get; private set; } + + public CameraApi CameraApi { get; private set; } + + public CameraMetadataApi CameraMetadataApi { get; private set; } + + public FrameApi FrameApi { get; private set; } + + public HitTestApi HitTestApi { get; private set; } + + public LightEstimateApi LightEstimateApi { get; private set; } + + public PlaneApi PlaneApi { get; private set; } + + public PointApi PointApi { get; private set; } + + public PointCloudApi PointCloudApi { get; private set; } + + public PoseApi PoseApi { get; private set; } + + public SessionApi SessionApi { get; private set; } + + public SessionConfigApi SessionConfigApi { get; private set; } + + public TrackableApi TrackableApi { get; private set; } + + public TrackableListApi TrackableListApi { get; private set; } + + public Trackable TrackableFactory(IntPtr nativeHandle) + { + return m_TrackableManager.TrackableFactory(nativeHandle); + } + + public void GetTrackables(List trackables, TrackableQueryFilter filter) where T : Trackable + { + m_TrackableManager.GetTrackables(trackables, filter); + } + + public void OnUpdate() + { + // After first frame, release previous frame's point cloud. + if (m_PointCloudHandle != IntPtr.Zero) + { + m_LastReleasedPointcloudTimestamp = PointCloudApi.GetTimestamp(m_PointCloudHandle); + PointCloudApi.Release(m_PointCloudHandle); + m_PointCloudHandle = IntPtr.Zero; + } + + // TODO (b/73256094): Remove when fixed. + if (LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking) + { + m_PointCloudHandle = FrameApi.AcquirePointCloud(); + } + } + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs.meta new file mode 100644 index 000000000..23addb5f7 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: d592900cfcf4d46c69256dbe400dec56 +timeCreated: 1516388608 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PlaneApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PlaneApi.cs index 9355ba215..a8e752c9f 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PlaneApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PlaneApi.cs @@ -32,13 +32,13 @@ namespace GoogleARCoreInternal public class PlaneApi { private const int k_MaxPolygonSize = 1024; - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; private float[] m_TmpPoints; private GCHandle m_TmpPointsHandle; - public PlaneApi(NativeApi nativeApi) + public PlaneApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; m_TmpPoints = new float[k_MaxPolygonSize * 2]; m_TmpPointsHandle = GCHandle.Alloc(m_TmpPoints, GCHandleType.Pinned); } @@ -50,24 +50,24 @@ public PlaneApi(NativeApi nativeApi) public Pose GetCenterPose(IntPtr planeHandle) { - var poseHandle = m_NativeApi.Pose.Create(); - ExternApi.ArPlane_getCenterPose(m_NativeApi.SessionHandle, planeHandle, poseHandle); - Pose resultPose = m_NativeApi.Pose.ExtractPoseValue(poseHandle); - m_NativeApi.Pose.Destroy(poseHandle); + var poseHandle = m_NativeSession.PoseApi.Create(); + ExternApi.ArPlane_getCenterPose(m_NativeSession.SessionHandle, planeHandle, poseHandle); + Pose resultPose = m_NativeSession.PoseApi.ExtractPoseValue(poseHandle); + m_NativeSession.PoseApi.Destroy(poseHandle); return resultPose; } public float GetExtentX(IntPtr planeHandle) { float extentX = 0.0f; - ExternApi.ArPlane_getExtentX(m_NativeApi.SessionHandle, planeHandle, ref extentX); + ExternApi.ArPlane_getExtentX(m_NativeSession.SessionHandle, planeHandle, ref extentX); return extentX; } public float GetExtentZ(IntPtr planeHandle) { float extentZ = 0.0f; - ExternApi.ArPlane_getExtentZ(m_NativeApi.SessionHandle, planeHandle, ref extentZ); + ExternApi.ArPlane_getExtentZ(m_NativeSession.SessionHandle, planeHandle, ref extentZ); return extentZ; } @@ -75,7 +75,7 @@ public void GetPolygon(IntPtr planeHandle, List points) { points.Clear(); int pointCount = 0; - ExternApi.ArPlane_getPolygonSize(m_NativeApi.SessionHandle, planeHandle, ref pointCount); + ExternApi.ArPlane_getPolygonSize(m_NativeSession.SessionHandle, planeHandle, ref pointCount); if (pointCount < 1) { return; @@ -86,7 +86,7 @@ public void GetPolygon(IntPtr planeHandle, List points) pointCount = k_MaxPolygonSize; } - ExternApi.ArPlane_getPolygon(m_NativeApi.SessionHandle, planeHandle, m_TmpPointsHandle.AddrOfPinnedObject()); + ExternApi.ArPlane_getPolygon(m_NativeSession.SessionHandle, planeHandle, m_TmpPointsHandle.AddrOfPinnedObject()); var planeCenter = GetCenterPose(planeHandle); var unityWorldTPlane = Matrix4x4.TRS(planeCenter.position, planeCenter.rotation, Vector3.one); @@ -100,17 +100,17 @@ public void GetPolygon(IntPtr planeHandle, List points) public TrackedPlane GetSubsumedBy(IntPtr planeHandle) { IntPtr subsumerHandle = IntPtr.Zero; - ExternApi.ArPlane_acquireSubsumedBy(m_NativeApi.SessionHandle, planeHandle, ref subsumerHandle); - return m_NativeApi.TrackableFactory(subsumerHandle) as TrackedPlane; + ExternApi.ArPlane_acquireSubsumedBy(m_NativeSession.SessionHandle, planeHandle, ref subsumerHandle); + return m_NativeSession.TrackableFactory(subsumerHandle) as TrackedPlane; } public bool IsPoseInExtents(IntPtr planeHandle, Pose pose) { // The int is used as a boolean value as the C API expects a int32_t value to represent a boolean. int isPoseInExtents = 0; - var poseHandle = m_NativeApi.Pose.Create(pose); - ExternApi.ArPlane_isPoseInExtents(m_NativeApi.SessionHandle, planeHandle, poseHandle, ref isPoseInExtents); - m_NativeApi.Pose.Destroy(poseHandle); + var poseHandle = m_NativeSession.PoseApi.Create(pose); + ExternApi.ArPlane_isPoseInExtents(m_NativeSession.SessionHandle, planeHandle, poseHandle, ref isPoseInExtents); + m_NativeSession.PoseApi.Destroy(poseHandle); return isPoseInExtents != 0; } @@ -118,7 +118,7 @@ public bool IsPoseInExtents(IntPtr planeHandle, IntPtr poseHandle) { // The int is used as a boolean value as the C API expects a int32_t value to represent a boolean. int isPoseInExtents = 0; - ExternApi.ArPlane_isPoseInExtents(m_NativeApi.SessionHandle, planeHandle, poseHandle, ref isPoseInExtents); + ExternApi.ArPlane_isPoseInExtents(m_NativeSession.SessionHandle, planeHandle, poseHandle, ref isPoseInExtents); return isPoseInExtents != 0; } @@ -126,9 +126,9 @@ public bool IsPoseInPolygon(IntPtr planeHandle, Pose pose) { // The int is used as a boolean value as the C API expects a int32_t value to represent a boolean. int isPoseInPolygon = 0; - var poseHandle = m_NativeApi.Pose.Create(pose); - ExternApi.ArPlane_isPoseInPolygon(m_NativeApi.SessionHandle, planeHandle, poseHandle, ref isPoseInPolygon); - m_NativeApi.Pose.Destroy(poseHandle); + var poseHandle = m_NativeSession.PoseApi.Create(pose); + ExternApi.ArPlane_isPoseInPolygon(m_NativeSession.SessionHandle, planeHandle, poseHandle, ref isPoseInPolygon); + m_NativeSession.PoseApi.Destroy(poseHandle); return isPoseInPolygon != 0; } @@ -136,7 +136,7 @@ public bool IsPoseInPolygon(IntPtr planeHandle, IntPtr poseHandle) { // The int is used as a boolean value as the C API expects a int32_t value to represent a boolean. int isPoseInPolygon = 0; - ExternApi.ArPlane_isPoseInPolygon(m_NativeApi.SessionHandle, planeHandle, poseHandle, ref isPoseInPolygon); + ExternApi.ArPlane_isPoseInPolygon(m_NativeSession.SessionHandle, planeHandle, poseHandle, ref isPoseInPolygon); return isPoseInPolygon != 0; } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointApi.cs index dc2d3103c..05a81f759 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointApi.cs @@ -31,26 +31,39 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class PointApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public PointApi(NativeApi nativeApi) + public PointApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } - public Pose GetPose(IntPtr planeHandle) + public Pose GetPose(IntPtr pointHandle) { - var poseHandle = m_NativeApi.Pose.Create(); - ExternApi.ArPoint_getPose(m_NativeApi.SessionHandle, planeHandle, poseHandle); - Pose resultPose = m_NativeApi.Pose.ExtractPoseValue(poseHandle); - m_NativeApi.Pose.Destroy(poseHandle); + var poseHandle = m_NativeSession.PoseApi.Create(); + ExternApi.ArPoint_getPose(m_NativeSession.SessionHandle, pointHandle, poseHandle); + Pose resultPose = m_NativeSession.PoseApi.ExtractPoseValue(poseHandle); + m_NativeSession.PoseApi.Destroy(poseHandle); return resultPose; } + public TrackedPointOrientationMode GetOrientationMode(IntPtr pointHandle) + { + ApiTrackedPointOrientationMode orientationMode = + ApiTrackedPointOrientationMode.Identity; + ExternApi.ArPoint_getOrientationMode(m_NativeSession.SessionHandle, pointHandle, + ref orientationMode); + return orientationMode.ToTrackedPointOrientationMode(); + } + private struct ExternApi { [DllImport(ApiConstants.ARCoreNativeApi)] public static extern void ArPoint_getPose(IntPtr session, IntPtr point, IntPtr out_pose); + + [DllImport(ApiConstants.ARCoreNativeApi)] + public static extern void ArPoint_getOrientationMode(IntPtr session, IntPtr point, + ref ApiTrackedPointOrientationMode orientationMode); } } } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointCloudApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointCloudApi.cs index 8aac312de..c120520c4 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointCloudApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointCloudApi.cs @@ -31,35 +31,34 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class PointCloudApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; private float[] m_CachedVector = new float[4]; - public PointCloudApi(NativeApi nativeApi) + public PointCloudApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } public long GetTimestamp(IntPtr pointCloudHandle) { long timestamp = 0; - ExternApi.ArPointCloud_getTimestamp(m_NativeApi.SessionHandle, pointCloudHandle, ref timestamp); + ExternApi.ArPointCloud_getTimestamp(m_NativeSession.SessionHandle, pointCloudHandle, ref timestamp); return timestamp; } public int GetNumberOfPoints(IntPtr pointCloudHandle) { int pointCount = 0; - ExternApi.ArPointCloud_getNumberOfPoints(m_NativeApi.SessionHandle, pointCloudHandle, ref pointCount); + ExternApi.ArPointCloud_getNumberOfPoints(m_NativeSession.SessionHandle, pointCloudHandle, ref pointCount); - // TODO (xuguo): remove the divide by 4 after b/69389164 is fixed. - return pointCount / 4; + return pointCount; } public Vector4 GetPoint(IntPtr pointCloudHandle, int index) { IntPtr pointCloudNativeHandle = IntPtr.Zero; - ExternApi.ArPointCloud_getData(m_NativeApi.SessionHandle, pointCloudHandle, ref pointCloudNativeHandle); + ExternApi.ArPointCloud_getData(m_NativeSession.SessionHandle, pointCloudHandle, ref pointCloudNativeHandle); IntPtr pointHandle = new IntPtr(pointCloudNativeHandle.ToInt64() + (Marshal.SizeOf(typeof(Vector4)) * index)); Marshal.Copy(pointHandle, m_CachedVector, 0, 4); @@ -75,7 +74,7 @@ public void CopyPoints(IntPtr pointCloudHandle, List points) IntPtr pointCloudNativeHandle = IntPtr.Zero; int pointCloudSize = GetNumberOfPoints(pointCloudHandle); - ExternApi.ArPointCloud_getData(m_NativeApi.SessionHandle, pointCloudHandle, ref pointCloudNativeHandle); + ExternApi.ArPointCloud_getData(m_NativeSession.SessionHandle, pointCloudHandle, ref pointCloudNativeHandle); MarshalingHelper.AddUnmanagedStructArrayToList(pointCloudNativeHandle, pointCloudSize, points); diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PoseApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PoseApi.cs index a1910d18e..b7b9ba203 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PoseApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PoseApi.cs @@ -31,11 +31,11 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class PoseApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public PoseApi(NativeApi nativeApi) + public PoseApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } public IntPtr Create() @@ -48,7 +48,7 @@ public IntPtr Create(Pose pose) ApiPoseData rawPose = new ApiPoseData(pose); IntPtr poseHandle = IntPtr.Zero; - ExternApi.ArPose_create(m_NativeApi.SessionHandle, ref rawPose, ref poseHandle); + ExternApi.ArPose_create(m_NativeSession.SessionHandle, ref rawPose, ref poseHandle); return poseHandle; } @@ -60,7 +60,7 @@ public void Destroy(IntPtr nativePose) public Pose ExtractPoseValue(IntPtr poseHandle) { ApiPoseData poseValue = new ApiPoseData(Pose.identity); - ExternApi.ArPose_getPoseRaw(m_NativeApi.SessionHandle, poseHandle, ref poseValue); + ExternApi.ArPose_getPoseRaw(m_NativeSession.SessionHandle, poseHandle, ref poseValue); return poseValue.ToUnityPose(); } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionApi.cs index 5161a7b86..b57e0f2f9 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionApi.cs @@ -31,16 +31,16 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class SessionApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public SessionApi(NativeApi nativeApi) + public SessionApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } public void ReportEngineType() { - ExternApi.ArSession_reportEngineType(m_NativeApi.SessionHandle, "Unity", + ExternApi.ArSession_reportEngineType(m_NativeSession.SessionHandle, "Unity", Application.unityVersion); } @@ -54,49 +54,49 @@ public ApiArStatus CheckSupported(ARCoreSessionConfig config) } else { - configHandle = m_NativeApi.SessionConfig.Create(); - m_NativeApi.SessionConfig.UpdateApiConfigWithArCoreSessionConfig(configHandle, config); + configHandle = m_NativeSession.SessionConfigApi.Create(); + m_NativeSession.SessionConfigApi.UpdateApiConfigWithArCoreSessionConfig(configHandle, config); } - ApiArStatus ret = ExternApi.ArSession_checkSupported(m_NativeApi.SessionHandle, configHandle); - m_NativeApi.SessionConfig.Destroy(configHandle); + ApiArStatus ret = ExternApi.ArSession_checkSupported(m_NativeSession.SessionHandle, configHandle); + m_NativeSession.SessionConfigApi.Destroy(configHandle); return ret; } public bool SetConfiguration(ARCoreSessionConfig sessionConfig) { - IntPtr configHandle = m_NativeApi.SessionConfig.Create(); - m_NativeApi.SessionConfig.UpdateApiConfigWithArCoreSessionConfig(configHandle, sessionConfig); + IntPtr configHandle = m_NativeSession.SessionConfigApi.Create(); + m_NativeSession.SessionConfigApi.UpdateApiConfigWithArCoreSessionConfig(configHandle, sessionConfig); - bool ret = ExternApi.ArSession_configure(m_NativeApi.SessionHandle, configHandle) == 0; - m_NativeApi.SessionConfig.Destroy(configHandle); + bool ret = ExternApi.ArSession_configure(m_NativeSession.SessionHandle, configHandle) == 0; + m_NativeSession.SessionConfigApi.Destroy(configHandle); return ret; } public void GetAllTrackables(List trackables) { - IntPtr listHandle = m_NativeApi.TrackableList.Create(); - ExternApi.ArSession_getAllTrackables(m_NativeApi.SessionHandle, ApiTrackableType.BaseTrackable, listHandle); + IntPtr listHandle = m_NativeSession.TrackableListApi.Create(); + ExternApi.ArSession_getAllTrackables(m_NativeSession.SessionHandle, ApiTrackableType.BaseTrackable, listHandle); trackables.Clear(); - int count = m_NativeApi.TrackableList.GetCount(listHandle); + int count = m_NativeSession.TrackableListApi.GetCount(listHandle); for (int i = 0; i < count; i++) { - IntPtr trackableHandle = m_NativeApi.TrackableList.AcquireItem(listHandle, i); - trackables.Add(m_NativeApi.TrackableFactory(trackableHandle)); + IntPtr trackableHandle = m_NativeSession.TrackableListApi.AcquireItem(listHandle, i); + trackables.Add(m_NativeSession.TrackableFactory(trackableHandle)); } - m_NativeApi.TrackableList.Destroy(listHandle); + m_NativeSession.TrackableListApi.Destroy(listHandle); } public Anchor CreateAnchor(Pose pose) { - IntPtr poseHandle = m_NativeApi.Pose.Create(pose); + IntPtr poseHandle = m_NativeSession.PoseApi.Create(pose); IntPtr anchorHandle = IntPtr.Zero; - ExternApi.ArSession_acquireNewAnchor(m_NativeApi.SessionHandle, poseHandle, ref anchorHandle); - var anchorResult = Anchor.AnchorFactory(anchorHandle, m_NativeApi); - m_NativeApi.Pose.Destroy(poseHandle); + ExternApi.ArSession_acquireNewAnchor(m_NativeSession.SessionHandle, poseHandle, ref anchorHandle); + var anchorResult = Anchor.AnchorFactory(anchorHandle, m_NativeSession); + m_NativeSession.PoseApi.Destroy(poseHandle); return anchorResult; } @@ -125,7 +125,7 @@ public void SetDisplayGeometry(ScreenOrientation orientation, int width, int hei break; } - ExternApi.ArSession_setDisplayGeometry(m_NativeApi.SessionHandle, androidOrientation, width, height); + ExternApi.ArSession_setDisplayGeometry(m_NativeSession.SessionHandle, androidOrientation, width, height); } private struct ExternApi diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionConfigApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionConfigApi.cs index e8a160a38..8f9e91ad7 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionConfigApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionConfigApi.cs @@ -31,17 +31,17 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class SessionConfigApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public SessionConfigApi(NativeApi nativeApi) + public SessionConfigApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } public IntPtr Create() { IntPtr configHandle = IntPtr.Zero; - ExternApi.ArConfig_create(m_NativeApi.SessionHandle, ref configHandle); + ExternApi.ArConfig_create(m_NativeSession.SessionHandle, ref configHandle); return configHandle; } @@ -58,7 +58,7 @@ public void UpdateApiConfigWithArCoreSessionConfig(IntPtr configHandle, ARCoreSe lightingMode = ApiLightEstimationMode.AmbientIntensity; } - ExternApi.ArConfig_setLightEstimationMode(m_NativeApi.SessionHandle, configHandle, lightingMode); + ExternApi.ArConfig_setLightEstimationMode(m_NativeSession.SessionHandle, configHandle, lightingMode); var planeFindingMode = ApiPlaneFindingMode.Disabled; if (arCoreSessionConfig.EnablePlaneFinding) @@ -66,7 +66,7 @@ public void UpdateApiConfigWithArCoreSessionConfig(IntPtr configHandle, ARCoreSe planeFindingMode = ApiPlaneFindingMode.Horizontal; } - ExternApi.ArConfig_setPlaneFindingMode(m_NativeApi.SessionHandle, configHandle, planeFindingMode); + ExternApi.ArConfig_setPlaneFindingMode(m_NativeSession.SessionHandle, configHandle, planeFindingMode); var updateMode = ApiUpdateMode.LatestCameraImage; if (arCoreSessionConfig.MatchCameraFramerate) @@ -77,7 +77,7 @@ public void UpdateApiConfigWithArCoreSessionConfig(IntPtr configHandle, ARCoreSe QualitySettings.vSyncCount = 0; } - ExternApi.ArConfig_setUpdateMode(m_NativeApi.SessionHandle, configHandle, updateMode); + ExternApi.ArConfig_setUpdateMode(m_NativeSession.SessionHandle, configHandle, updateMode); } private struct ExternApi diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableApi.cs index fc7209ec7..52290b99e 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableApi.cs @@ -31,35 +31,35 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class TrackableApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public TrackableApi(NativeApi nativeApi) + public TrackableApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } public ApiTrackableType GetType(IntPtr trackableHandle) { ApiTrackableType type = ApiTrackableType.Plane; - ExternApi.ArTrackable_getType(m_NativeApi.SessionHandle, trackableHandle, ref type); + ExternApi.ArTrackable_getType(m_NativeSession.SessionHandle, trackableHandle, ref type); return type; } public TrackingState GetTrackingState(IntPtr trackableHandle) { ApiTrackingState apiTrackingState = ApiTrackingState.Stopped; - ExternApi.ArTrackable_getTrackingState(m_NativeApi.SessionHandle, trackableHandle, + ExternApi.ArTrackable_getTrackingState(m_NativeSession.SessionHandle, trackableHandle, ref apiTrackingState); return apiTrackingState.ToTrackingState(); } public bool AcquireNewAnchor(IntPtr trackableHandle, Pose pose, out IntPtr anchorHandle) { - IntPtr poseHandle = m_NativeApi.Pose.Create(pose); + IntPtr poseHandle = m_NativeSession.PoseApi.Create(pose); anchorHandle = IntPtr.Zero; - int status = ExternApi.ArTrackable_acquireNewAnchor(m_NativeApi.SessionHandle, trackableHandle, poseHandle, + int status = ExternApi.ArTrackable_acquireNewAnchor(m_NativeSession.SessionHandle, trackableHandle, poseHandle, ref anchorHandle); - m_NativeApi.Pose.Destroy(poseHandle); + m_NativeSession.PoseApi.Destroy(poseHandle); return status == 0; } @@ -70,15 +70,15 @@ public void Release(IntPtr trackableHandle) public void GetAnchors(IntPtr trackableHandle, List anchors) { - IntPtr anchorListHandle = m_NativeApi.Anchor.CreateList(); - ExternApi.ArTrackable_getAnchors(m_NativeApi.SessionHandle, trackableHandle, anchorListHandle); + IntPtr anchorListHandle = m_NativeSession.AnchorApi.CreateList(); + ExternApi.ArTrackable_getAnchors(m_NativeSession.SessionHandle, trackableHandle, anchorListHandle); anchors.Clear(); - int anchorCount = m_NativeApi.Anchor.GetListSize(anchorListHandle); + int anchorCount = m_NativeSession.AnchorApi.GetListSize(anchorListHandle); for (int i = 0; i < anchorCount; i++) { - IntPtr anchorHandle = m_NativeApi.Anchor.AcquireListItem(anchorListHandle, i); - Anchor anchor = Anchor.AnchorFactory(anchorHandle, m_NativeApi); + IntPtr anchorHandle = m_NativeSession.AnchorApi.AcquireListItem(anchorListHandle, i); + Anchor anchor = Anchor.AnchorFactory(anchorHandle, m_NativeSession, false); if (anchor == null) { Debug.LogFormat("Unable to find Anchor component for handle {0}", anchorHandle); @@ -88,8 +88,8 @@ public void GetAnchors(IntPtr trackableHandle, List anchors) anchors.Add(anchor); } } - - m_NativeApi.Anchor.DestroyList(anchorListHandle); + + m_NativeSession.AnchorApi.DestroyList(anchorListHandle); } private struct ExternApi diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableListApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableListApi.cs index 6893674f9..44c4bd745 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableListApi.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableListApi.cs @@ -31,17 +31,17 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class TrackableListApi { - private NativeApi m_NativeApi; + private NativeSession m_NativeSession; - public TrackableListApi(NativeApi nativeApi) + public TrackableListApi(NativeSession nativeSession) { - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } public IntPtr Create() { IntPtr handle = IntPtr.Zero; - ExternApi.ArTrackableList_create(m_NativeApi.SessionHandle, ref handle); + ExternApi.ArTrackableList_create(m_NativeSession.SessionHandle, ref handle); return handle; } @@ -53,14 +53,14 @@ public void Destroy(IntPtr listHandle) public int GetCount(IntPtr listHandle) { int count = 0; - ExternApi.ArTrackableList_getSize(m_NativeApi.SessionHandle, listHandle, ref count); + ExternApi.ArTrackableList_getSize(m_NativeSession.SessionHandle, listHandle, ref count); return count; } public IntPtr AcquireItem(IntPtr listHandle, int index) { IntPtr trackableHandle = IntPtr.Zero; - ExternApi.ArTrackableList_acquireItem(m_NativeApi.SessionHandle, listHandle, index, + ExternApi.ArTrackableList_acquireItem(m_NativeSession.SessionHandle, listHandle, index, ref trackableHandle); return trackableHandle; } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs new file mode 100644 index 000000000..67183481f --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCore +{ + /// + /// Possible statuses for the ARCore APK availability on a device. + /// + public enum ApkAvailabilityStatus + { + UnknownError = 0, + UnknownChecking = 1, + UnknownTimedOut = 2, + UnsupportedDeviceNotCapable = 100, + SupportedNotInstalled = 201, + SupportedApkTooOld = 202, + SupportedInstalled = 203 + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs.meta new file mode 100644 index 000000000..dfb8a7e0b --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 56892237bd519491d9a60f5ebd3e0f72 +timeCreated: 1517868046 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs new file mode 100644 index 000000000..c0d96a7b9 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCore +{ + /// + /// Possible statuses for an ARCore APK installation request on a device. + /// + public enum ApkInstallationStatus + { + Uninitialized = 0, + Requested = 1, + Success = 100, + Error = 200, + ErrorDeviceNotCompatible = 201, + ErrorAndroidVersionNotSupported = 202, + ErrorUserDeclined = 203, + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs.meta new file mode 100644 index 000000000..a5e7994a5 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: a1de1e6e76a30499e970bb552522dec7 +timeCreated: 1517858804 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/AsyncTask.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/AsyncTask.cs index 5cbe9bfac..428ce1ef5 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/AsyncTask.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/AsyncTask.cs @@ -132,42 +132,8 @@ public AsyncTask ThenAction(Action doAfterTaskComplete) public class AsyncTask { private static Queue s_UpdateActionQueue = new Queue(); - - private static Queue s_UiThreadActionQueue = new Queue(); - - private static AndroidJavaObject s_Activity; - - private static AndroidJavaRunnable s_CallOnUIThread; - private static object s_LockObject = new object(); - static AsyncTask() - { - AndroidJavaClass unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); - s_Activity = unityPlayerClass.GetStatic("currentActivity"); - - s_CallOnUIThread = new AndroidJavaRunnable(() => { OnUIThread(); }); - } - - /// - /// Queues an action to be performed on Android UI thread. This method can be called by any thread. - /// - /// The action to perfom. - public static void PerformActionInUIThread(Action action) - { - lock (s_LockObject) - { - if (s_UiThreadActionQueue.Count == 0) - { - // Ensure that runOnUiThread is only called once if this method is called twice quickly before - // the UI thread responds. - s_Activity.Call("runOnUiThread", s_CallOnUIThread); - } - - s_UiThreadActionQueue.Enqueue(action); - } - } - /// /// Queues an action to be performed on Unity thread in Update(). This method can be called by any thread. /// @@ -194,18 +160,6 @@ public static void OnUpdate() } } } - - private static void OnUIThread() - { - lock (s_LockObject) - { - while (s_UiThreadActionQueue.Count > 0) - { - Action action = s_UiThreadActionQueue.Dequeue(); - action(); - } - } - } } /// @endcond diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor.meta new file mode 100644 index 000000000..2aad0c912 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: cfb05be3ca34b4826b62df99f182da2b +folderAsset: yes +timeCreated: 1518226182 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs new file mode 100644 index 000000000..d82e27edb --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs @@ -0,0 +1,51 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System; + using System.Diagnostics.CodeAnalysis; + using System.IO; + using UnityEditor; + using UnityEngine; + + [InitializeOnLoad] + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public static class ARCoreRequiredMenuItem + { + private const string k_MenuName = "Edit/Project Settings/ARCore/ARCore Required"; + private const int k_MenuPriority = 901; + + [MenuItem(k_MenuName, false, k_MenuPriority)] + private static void ToggleARCoreRequiredMenuItem() + { + ARCoreProjectSettings.Instance.IsARCoreRequired = !ARCoreProjectSettings.Instance.IsARCoreRequired; + ARCoreProjectSettings.Instance.Save(); + } + + [MenuItem(k_MenuName, true, k_MenuPriority)] + private static bool ValidateARCoreRequiredMenuItem() + { + Menu.SetChecked(k_MenuName, ARCoreProjectSettings.Instance.IsARCoreRequired); + return true; + } + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs.meta new file mode 100644 index 000000000..eb0f191dc --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 09ecd63d3da8a410a90244cc9a8a049f +timeCreated: 1518228501 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs new file mode 100644 index 000000000..6ec83a2cf --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs @@ -0,0 +1,73 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System.Diagnostics.CodeAnalysis; + using UnityEditor; + using UnityEditor.Build; +#if UNITY_2018_1_OR_NEWER + using UnityEditor.Build.Reporting; +#endif + using UnityEngine; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public class BuildHelper : IPreprocessBuild + { + [SuppressMessage("UnityRules.UnityStyleRules", "US1000:FieldsMustBeUpperCamelCase", + Justification = "Overriden property.")] + public int callbackOrder + { + get + { + return 0; + } + } + +#if UNITY_2018_1_OR_NEWER + public void OnPreprocessBuild(BuildReport report) + { +#else + public void OnPreprocessBuild(BuildTarget target, string path) + { +#endif + var isARCoreRequired = ARCoreProjectSettings.Instance.IsARCoreRequired; + + Debug.LogFormat("Building application with {0} ARCore support.", + isARCoreRequired ? "REQUIRED" : "OPTIONAL"); + + const string k_RequiredAARPath = "Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar"; + const string k_OptionalAARPath = "Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar"; + PluginImporter arRequiredAAR = AssetImporter.GetAtPath(k_RequiredAARPath) as PluginImporter; + PluginImporter arOptionalAAR = AssetImporter.GetAtPath(k_OptionalAARPath) as PluginImporter; + + if (arRequiredAAR == null || arOptionalAAR == null) + { + throw new UnityEditor.Build.BuildFailedException( + "Not finding google_ar_required.aar and google_ar_optional.aar files needed for ARCore support. " + + "Were they moved from the ARCore SDK?"); + } + + arRequiredAAR.SetCompatibleWithPlatform(BuildTarget.Android, isARCoreRequired); + arOptionalAAR.SetCompatibleWithPlatform(BuildTarget.Android, !isARCoreRequired); + } + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs.meta new file mode 100644 index 000000000..8bc81ad30 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 51b018421df5e4defbf0a70c95a5f749 +timeCreated: 1518228237 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Frame.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Frame.cs index ab7058a60..c0b77463c 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Frame.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Frame.cs @@ -35,32 +35,10 @@ public class Frame { //// @cond EXCLUDE_FROM_DOXYGEN - /// - /// Gets the manager for the static frame. - /// - private static FrameManager s_FrameManager; + private static List s_TmpTrackableHitList = new List(); //// @endcond - /// - /// Gets the tracking state of the ARCore device for the frame. If the state is not Tracking, - /// the values in the frame may be very inaccurate and generally should not be used. - /// Tracking loss is often caused when the camera does not have enough visual features to track (e.g. a white - /// wall) or the device is being moved very rapidly. - /// - public static TrackingState TrackingState - { - get - { - if (s_FrameManager == null) - { - return TrackingState.Stopped; - } - - return s_FrameManager.GetCameraTrackingState(); - } - } - /// /// Gets the pose of the ARCore device for the frame in Unity world coordinates. /// @@ -68,12 +46,16 @@ public static Pose Pose { get { - if (s_FrameManager == null) + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null) { return Pose.identity; } - return s_FrameManager.GetPose(); + var cameraHandle = nativeSession.FrameApi.AcquireCamera(); + Pose result = nativeSession.CameraApi.GetPose(cameraHandle); + nativeSession.CameraApi.Release(cameraHandle); + return result; } } @@ -84,51 +66,75 @@ public static LightEstimate LightEstimate { get { - if (s_FrameManager == null) + // TODO (b/73256094): Remove isTracking when fixed. + var nativeSession = LifecycleManager.Instance.NativeSession; + var isTracking = LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking; + if (nativeSession == null || !isTracking) { return new LightEstimate(LightEstimateState.NotValid, 0.0f); } - return s_FrameManager.GetLightEstimate(); + return nativeSession.FrameApi.GetLightEstimate(); } } /// - /// Gets planes ARCore has tracked. + /// Performs a raycast against physical objects being tracked by ARCore. + /// Output the closest hit from the camera. + /// Note that the Unity's screen coordinate (0, 0) + /// starts from bottom left. /// - /// A reference to a list of TrackedPlane that will be filled by the method call. - /// A filter on the type of data to return. - public static void GetPlanes(List planes, TrackableQueryFilter filter = TrackableQueryFilter.All) + /// Horizontal touch position in Unity's screen coordiante. + /// Vertical touch position in Unity's screen coordiante. + /// A filter bitmask where each {@link TrackableHitFlag} which is set represents a category + /// of raycast hits the method call should consider valid. + /// A {@link TrackableHit} that will be set if the raycast is successful. + /// true if the raycast had a hit, otherwise false. + public static bool Raycast(float x, float y, TrackableHitFlags filter, + out TrackableHit hitResult) { - if (s_FrameManager == null) + hitResult = new TrackableHit(); + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null) { - planes.Clear(); - return; + return false; } - s_FrameManager.GetTrackables(planes, filter); - } + // Note that the Unity's screen coordinate (0, 0) starts from bottom left. + bool foundHit = nativeSession.HitTestApi.Raycast(nativeSession.FrameHandle, x, Screen.height - y, filter, + s_TmpTrackableHitList, true); - //// @cond EXCLUDE_FROM_DOXYGEN + if (foundHit && s_TmpTrackableHitList.Count != 0) + { + hitResult = s_TmpTrackableHitList[0]; + } - /// - /// Initializes the static Frame. - /// - /// The manager for the static frame. - public static void Initialize(FrameManager frameManager) - { - Frame.s_FrameManager = frameManager; + return foundHit; } /// - /// Cleans up the static frame. + /// Performs a raycast against physical objects being tracked by ARCore. + /// Output all hits from the camera. + /// Note that the Unity's screen coordinate (0, 0) + /// starts from bottom left. /// - public static void Destroy() + /// Horizontal touch position in Unity's screen coordiante. + /// Vertical touch position in Unity's screen coordiante. + /// A filter bitmask where each {@link TrackableHitFlag} which is set represents a category + /// of raycast hits the method call should consider valid. + /// A list of {@link TrackableHit} that will be set if the raycast is successful. + /// true if the raycast had a hit, otherwise false. + public static bool RaycastAll(float x, float y, TrackableHitFlags filter, List hitResults) { - s_FrameManager = null; - } + hitResults.Clear(); + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null) + { + return false; + } - //// @endcond + return nativeSession.HitTestApi.Raycast(nativeSession.FrameHandle, x, Screen.height - y, filter, hitResults, true); + } /// /// Container for state related to the ARCore camera image metadata for the Frame. @@ -142,10 +148,19 @@ public static class CameraMetadata /// Metadata type. /// Result list of the requested values. /// true if getting metadata value successfully, otherwise false. - public static bool TryGetValues(CameraMetadataTag metadataTag, - List outMetadataList) + public static bool TryGetValues(CameraMetadataTag metadataTag, List outMetadataList) { - return Frame.s_FrameManager.CameraMetadataManager.TryGetValues(metadataTag, outMetadataList); + outMetadataList.Clear(); + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null) + { + return false; + } + + var metadataHandle = nativeSession.FrameApi.AcquireImageMetadata(); + var isSuccess = nativeSession.CameraMetadataApi.TryGetValues(metadataHandle, metadataTag, outMetadataList); + nativeSession.CameraMetadataApi.Release(metadataHandle); + return isSuccess; } /// @@ -155,7 +170,18 @@ public static bool TryGetValues(CameraMetadataTag metadataTag, /// true if getting tags successfully, otherwise false. public static bool GetAllCameraMetadataTags(List outMetadataTags) { - return Frame.s_FrameManager.CameraMetadataManager.GetAllCameraMetadataTags(outMetadataTags); + outMetadataTags.Clear(); + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null) + { + return false; + } + + var metadataHandle = nativeSession.FrameApi.AcquireImageMetadata(); + var isSuccess = nativeSession.CameraMetadataApi.GetAllCameraMetadataTags(metadataHandle, + outMetadataTags); + nativeSession.CameraMetadataApi.Release(metadataHandle); + return isSuccess; } } @@ -173,12 +199,13 @@ public static bool IsUpdatedThisFrame { get { - if (Frame.s_FrameManager == null) + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null) { return false; } - return Frame.s_FrameManager.PointCloudManager.GetIsUpdatedThisFrame(); + return nativeSession.IsPointCloudNew; } } @@ -189,12 +216,15 @@ public static int PointCount { get { - if (Frame.s_FrameManager == null) + // TODO (b/73256094): Remove isTracking when fixed. + var nativeSession = LifecycleManager.Instance.NativeSession; + var isTracking = LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking; + if (nativeSession == null || !isTracking) { return 0; } - return Frame.s_FrameManager.PointCloudManager.GetPointCount(); + return nativeSession.PointCloudApi.GetNumberOfPoints(nativeSession.PointCloudHandle); } } @@ -205,12 +235,13 @@ public static int PointCount /// The point from the point cloud at index. public static Vector3 GetPoint(int index) { - if (Frame.s_FrameManager == null) + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null) { return Vector3.zero; } - return Frame.s_FrameManager.PointCloudManager.GetPoint(index); + return nativeSession.PointCloudApi.GetPoint(nativeSession.PointCloudHandle, index); } /// @@ -219,18 +250,19 @@ public static Vector3 GetPoint(int index) /// A list that will be filled with point cloud points by this method call. public static void CopyPoints(List points) { - if (Frame.s_FrameManager == null) + points.Clear(); + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null) { - points.Clear(); return; } - Frame.s_FrameManager.PointCloudManager.CopyPoints(points); + nativeSession.PointCloudApi.CopyPoints(nativeSession.PointCloudHandle, points); } } /// - /// Container for state related to the ARCore camera for the Frame. + /// Container for state related to the ARCore camera for the frame. /// public static class CameraImage { @@ -241,12 +273,7 @@ public static Texture Texture { get { - if (Frame.s_FrameManager == null) - { - return null; - } - - return Frame.s_FrameManager.GetCameraTexture(); + return LifecycleManager.Instance.BackgroundTexture; } } @@ -260,30 +287,35 @@ public static ApiDisplayUvCoords DisplayUvCoords ApiDisplayUvCoords displayUvCoords = new ApiDisplayUvCoords(new Vector2(0, 1), new Vector2(1, 1), new Vector2(0, 0), new Vector2(1, 0)); - if (Frame.s_FrameManager == null) + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null || Texture == null) { return displayUvCoords; } - Frame.s_FrameManager.TransformDisplayUvCoords(ref displayUvCoords); + nativeSession.FrameApi.TransformDisplayUvCoords(ref displayUvCoords); return displayUvCoords; } } /// - /// Gets the current projection matrix for this frame. - /// The near clipping plane for the projection matrix. - /// The near clipping plane for the projection matrix. + /// The far clipping plane for the projection matrix. + /// The projection matrix for the frame. public static Matrix4x4 GetCameraProjectionMatrix(float nearClipping, float farClipping) { - if (Frame.s_FrameManager == null) + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null || Texture == null) { return Matrix4x4.identity; } - return Frame.s_FrameManager.GetCameraProjectionMatrix(nearClipping, farClipping); + var cameraHandle = nativeSession.FrameApi.AcquireCamera(); + var result = nativeSession.CameraApi.GetProjectionMatrix(cameraHandle, nearClipping, farClipping); + nativeSession.CameraApi.Release(cameraHandle); + return result; } } } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs deleted file mode 100644 index 8e77aabfe..000000000 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs +++ /dev/null @@ -1,73 +0,0 @@ -//----------------------------------------------------------------------- -// -// -// Copyright 2017 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// -//----------------------------------------------------------------------- - -namespace GoogleARCoreInternal -{ - using System; - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using GoogleARCore; - using UnityEngine; - - [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", - Justification = "Internal")] - public class CameraMetadataManager - { - private NativeApi m_NativeApi; - - private IntPtr m_ArCameraMetadataHandle = IntPtr.Zero; - - public CameraMetadataManager(NativeApi nativeApi) - { - m_NativeApi = nativeApi; - } - - public void UpdateFrame(IntPtr frameHandle) - { - if (m_ArCameraMetadataHandle != IntPtr.Zero) - { - // After first frame, release previous frame's image metadata. - m_NativeApi.CameraMetadata.Release(m_ArCameraMetadataHandle); - m_ArCameraMetadataHandle = IntPtr.Zero; - } - - m_ArCameraMetadataHandle = m_NativeApi.Frame.AcquireImageMetadata(frameHandle); - } - - public bool TryGetValues(CameraMetadataTag metadataTag, List outMetadataList) - { - if (m_ArCameraMetadataHandle == IntPtr.Zero) - { - // Intentionally ignored logging as the camera metadata is expected to be - // unavailable in between frames. - return false; - } - - return m_NativeApi.CameraMetadata.TryGetValues(m_ArCameraMetadataHandle, - metadataTag, outMetadataList); - } - - public bool GetAllCameraMetadataTags(List outMetadataTags) - { - return m_NativeApi.CameraMetadata.GetAllCameraMetadataTags(m_ArCameraMetadataHandle, - outMetadataTags); - } - } -} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs deleted file mode 100644 index 5a5e100ec..000000000 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs +++ /dev/null @@ -1,150 +0,0 @@ -//----------------------------------------------------------------------- -// -// -// Copyright 2017 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// -//----------------------------------------------------------------------- - -namespace GoogleARCoreInternal -{ - using System; - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using GoogleARCore; - using UnityEngine; - - [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", - Justification = "Internal")] - public class FrameManager - { - private NativeApi m_NativeApi; - - private IntPtr m_FrameHandle = IntPtr.Zero; - - private Texture2D m_BackgroundTexture; - - private TrackableManager m_TrackableManager; - - private List m_TrackableHitList = new List(); - - public FrameManager(NativeApi nativeApi) - { - m_NativeApi = nativeApi; - m_TrackableManager = new TrackableManager(nativeApi); - PointCloudManager = new PointCloudManager(nativeApi); - CameraMetadataManager = new CameraMetadataManager(nativeApi); - } - - public PointCloudManager PointCloudManager { get; private set; } - - public CameraMetadataManager CameraMetadataManager { get; private set; } - - public Pose GetPose() - { - var cameraHandle = m_NativeApi.Frame.AcquireCamera(m_FrameHandle); - Pose result = m_NativeApi.Camera.GetPose(cameraHandle); - m_NativeApi.Camera.Release(cameraHandle); - return result; - } - - public LightEstimate GetLightEstimate() - { - return m_NativeApi.Frame.GetLightEstimate(m_FrameHandle); - } - - public Texture GetCameraTexture() - { - return m_BackgroundTexture; - } - - public void TransformDisplayUvCoords(ref ApiDisplayUvCoords uvQuad) - { - m_NativeApi.Frame.TransformDisplayUvCoords(m_FrameHandle, ref uvQuad); - } - - public Matrix4x4 GetCameraProjectionMatrix(float nearClipping, float farClipping) - { - var cameraHandle = m_NativeApi.Frame.AcquireCamera(m_FrameHandle); - var result = m_NativeApi.Camera.GetProjectionMatrix(cameraHandle, nearClipping, farClipping); - m_NativeApi.Camera.Release(cameraHandle); - return result; - } - - public TrackingState GetCameraTrackingState() - { - var cameraHandle = m_NativeApi.Frame.AcquireCamera(m_FrameHandle); - TrackingState result = m_NativeApi.Camera.GetTrackingState(cameraHandle); - m_NativeApi.Camera.Release(cameraHandle); - return result; - } - - public void GetTrackables(List trackables, TrackableQueryFilter filter) where T : Trackable - { - m_TrackableManager.GetTrackables(trackables, filter); - } - - public bool Raycast(float x, float y, TrackableHitFlags filter, out TrackableHit hitResult) - { - hitResult = new TrackableHit(); - - // Note that the Unity's screen coordinate (0, 0) starts from bottom left. - bool ret = m_NativeApi.HitTest.Raycast(m_FrameHandle, x, Screen.height - y, filter, m_TrackableHitList, - true); - if (ret && m_TrackableHitList.Count != 0) - { - hitResult = m_TrackableHitList[0]; - } - - return ret; - } - - public bool RaycastAll(float x, float y, TrackableHitFlags filter, List hitResults) - { - // Note that the Unity's screen coordinate (0, 0) starts from bottom left. - return m_NativeApi.HitTest.Raycast(m_FrameHandle, x, Screen.height - y, filter, hitResults, true); - } - - public void UpdateFrame(IntPtr frameHandle, uint cameraTextureId) - { - m_FrameHandle = frameHandle; - _UpdateTextureIfNeeded(cameraTextureId); - PointCloudManager.UpdateFrame(m_FrameHandle); - CameraMetadataManager.UpdateFrame(m_FrameHandle); - } - - private void _UpdateTextureIfNeeded(uint cameraTextureId) - { - if (m_BackgroundTexture != null && - m_BackgroundTexture.GetNativeTexturePtr().ToInt32() == cameraTextureId) - { - return; - } - - if (m_BackgroundTexture == null) - { - // The Unity-cached size and format of the texture (0x0, ARGB) is not the - // actual format of the texture. This is okay because the texture is not - // accessed by pixels, it is accessed with UV coordinates. - m_BackgroundTexture = Texture2D.CreateExternalTexture(0, 0, TextureFormat.ARGB32, false, - false, new IntPtr(cameraTextureId)); - } - else - { - m_BackgroundTexture.UpdateExternalTexture(new IntPtr(cameraTextureId)); - } - } - } -} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs new file mode 100644 index 000000000..27daf42d2 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs @@ -0,0 +1,361 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System; + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.InteropServices; + using GoogleARCore; + using UnityEngine; + + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public class LifecycleManager + { + private static LifecycleManager s_Instance = new LifecycleManager(); + + private CheckApkAvailabilityResultCallback m_CheckApkAvailabilityResultCallback; + + private RequestApkInstallationResultCallback m_RequestApkInstallationResultCallback; + + private CameraPermissionRequestProvider m_RequestCameraPermissionCallback; + + private EarlyUpdateCallback m_EarlyUpdateCallback; + + private Texture2D m_BackgroundTexture; + + private ARCoreSession m_SessionComponent; + + private NativeSession m_NativeSession; + + private List> m_PendingAvailabilityCheckCallbacks = + new List>(); + + private List> m_PendingInstallationRequestCallbacks = + new List>(); + + static LifecycleManager() + { + Instance._Initialize(); + } + + private delegate void CheckApkAvailabilityResultCallback(ApiAvailability status, + IntPtr context); + + private delegate void RequestApkInstallationResultCallback( + ApiApkInstallationStatus status, IntPtr context); + + private delegate void CameraPermissionsResultCallback(bool granted, + IntPtr context); + + private delegate void CameraPermissionRequestProvider( + CameraPermissionsResultCallback onComplete, IntPtr context); + + private delegate void SessionCreationResultCallback( + IntPtr sessionHandle, IntPtr frameHandle, IntPtr context, ApiArStatus status); + + private delegate void EarlyUpdateCallback(); + + public static LifecycleManager Instance + { + get + { + return s_Instance; + } + } + + public Texture2D BackgroundTexture + { + get + { + return m_BackgroundTexture; + } + } + + public NativeSession NativeSession + { + get + { + if (m_NativeSession != null) + { + return m_NativeSession; + } + + IntPtr sessionHandle = IntPtr.Zero; + ExternApi.ArPresto_getSession(ref sessionHandle); + + IntPtr frameHandle = IntPtr.Zero; + ExternApi.ArPresto_getFrame(ref frameHandle); + + if (sessionHandle == IntPtr.Zero || frameHandle == IntPtr.Zero) + { + return null; + } + + m_NativeSession = new NativeSession(sessionHandle, frameHandle); + return m_NativeSession; + } + } + + public SessionStatus SessionStatus + { + get + { + ApiPrestoStatus prestoStatus = ApiPrestoStatus.Uninitialized; + ExternApi.ArPresto_getStatus(ref prestoStatus); + return prestoStatus.ToSessionStatus(); + } + } + + public void CreateSession(ARCoreSession session) + { + session.StartCoroutine(InstantPreviewManager.InitializeIfNeeded()); + + if (m_SessionComponent != null) + { + Debug.LogError("Multiple session components cannot exist in the scene. " + + "Destroying the newest."); + GameObject.Destroy(session); + return; + } + + m_SessionComponent = session; + } + + public void EnableSession() + { + var config = m_SessionComponent.SessionConfig; + if (config != null) + { + ExternApi.ArPresto_setConfiguration(new ApiPrestoConfig(config)); + } + + ExternApi.ArPresto_setEnabled(true); + } + + public void DisableSession() + { + ExternApi.ArPresto_setEnabled(false); + } + + public void DestroySession() + { + m_SessionComponent = null; + } + + public AsyncTask CheckApkAvailability() + { + Action onComplete; + AsyncTask task = + new AsyncTask(out onComplete); + + ExternApi.ArPresto_checkApkAvailability(m_CheckApkAvailabilityResultCallback, + IntPtr.Zero); + + m_PendingAvailabilityCheckCallbacks.Add(onComplete); + + return task; + } + + public AsyncTask RequestApkInstallation(bool userRequested) + { + Action onComplete; + AsyncTask task = + new AsyncTask(out onComplete); + + ExternApi.ArPresto_requestApkInstallation(userRequested, + m_RequestApkInstallationResultCallback, IntPtr.Zero); + + m_PendingInstallationRequestCallbacks.Add(onComplete); + + return task; + } + + [AOT.MonoPInvokeCallback(typeof(CheckApkAvailabilityResultCallback))] + private static void OnCheckApkAvailabilityResultTrampoline( + ApiAvailability status, IntPtr context) + { + Instance._OnCheckApkAvailabilityResult(status.ToApkAvailabilityStatus()); + } + + [AOT.MonoPInvokeCallback(typeof(RequestApkInstallationResultCallback))] + private static void OnApkInstallationResultTrampoline( + ApiApkInstallationStatus status, IntPtr context) + { + Instance._OnRequestApkInstallationResult(status.ToApkInstallationStatus()); + } + + [AOT.MonoPInvokeCallback(typeof(CameraPermissionRequestProvider))] + private static void RequestCameraPermissionTrampoline( + CameraPermissionsResultCallback onComplete, IntPtr context) + { + Instance._RequestCameraPermission(onComplete, context); + } + + [AOT.MonoPInvokeCallback(typeof(EarlyUpdateCallback))] + private static void EarlyUpdateTrampoline() + { + Instance._EarlyUpdate(); + } + + private void _Initialize() + { + m_EarlyUpdateCallback = new EarlyUpdateCallback(EarlyUpdateTrampoline); + ExternApi.ArCoreUnity_setArPrestoInitialized(m_EarlyUpdateCallback); + + IntPtr javaVMHandle = IntPtr.Zero; + IntPtr activityHandle = IntPtr.Zero; + ExternApi.ArCoreUnity_getJniInfo(ref javaVMHandle, ref activityHandle); + + m_CheckApkAvailabilityResultCallback = + new CheckApkAvailabilityResultCallback(OnCheckApkAvailabilityResultTrampoline); + + m_RequestApkInstallationResultCallback = + new RequestApkInstallationResultCallback(OnApkInstallationResultTrampoline); + + m_RequestCameraPermissionCallback = + new CameraPermissionRequestProvider(RequestCameraPermissionTrampoline); + + ExternApi.ArPresto_initialize(javaVMHandle, activityHandle, + m_RequestCameraPermissionCallback); + } + + private void _RequestCameraPermission(CameraPermissionsResultCallback onComplete, + IntPtr context) + { + const string cameraPermissionName = "android.permission.CAMERA"; + AndroidPermissionsManager.RequestPermission(cameraPermissionName).ThenAction((grantResult) => + { + onComplete(grantResult.IsAllGranted, context); + }); + } + + private void _EarlyUpdate() + { + AsyncTask.OnUpdate(); + _UpdateTextureIfNeeded(); + + if (m_NativeSession != null) + { + m_NativeSession.SessionApi.SetDisplayGeometry( + Screen.orientation, Screen.width, Screen.height); + m_NativeSession.OnUpdate(); + } + } + + private void _OnCheckApkAvailabilityResult(ApkAvailabilityStatus status) + { + foreach (var onComplete in m_PendingAvailabilityCheckCallbacks) + { + onComplete(status); + } + + m_PendingAvailabilityCheckCallbacks.Clear(); + } + + private void _OnRequestApkInstallationResult(ApkInstallationStatus status) + { + foreach (var onComplete in m_PendingInstallationRequestCallbacks) + { + onComplete(status); + } + + m_PendingInstallationRequestCallbacks.Clear(); + } + + private void _UpdateTextureIfNeeded() + { + // If running in editor, updates background texture from Instant Preview only. + if (InstantPreviewManager.UpdateBackgroundTextureIfNeeded(ref m_BackgroundTexture)) + { + return; + } + + int backgroundTextureId = ExternApi.ArCoreUnity_getBackgroundTextureId(); + + if (NativeSession == null) + { + // This prevents using a texture that has not been filled out by ARCore. + return; + } + else if (backgroundTextureId == -1) + { + return; + } + else if (m_BackgroundTexture != null && + m_BackgroundTexture.GetNativeTexturePtr().ToInt32() == backgroundTextureId) + { + return; + } + else if (m_BackgroundTexture == null) + { + // The Unity-cached size and format of the texture (0x0, ARGB) is not the + // actual format of the texture. This is okay because the texture is not + // accessed by pixels, it is accessed with UV coordinates. + m_BackgroundTexture = Texture2D.CreateExternalTexture(0, 0, TextureFormat.ARGB32, false, + false, new IntPtr(backgroundTextureId)); + return; + } + + m_BackgroundTexture.UpdateExternalTexture(new IntPtr(backgroundTextureId)); + } + + private struct ExternApi + { + [DllImport(ApiConstants.ARCoreShimApi)] + public static extern void ArCoreUnity_getJniInfo(ref IntPtr javaVM, ref IntPtr activity); + + [DllImport(ApiConstants.ARCoreShimApi)] + public static extern void ArCoreUnity_setArPrestoInitialized(EarlyUpdateCallback onEarlyUpdate); + + [DllImport(ApiConstants.ARCoreShimApi)] + public static extern int ArCoreUnity_getBackgroundTextureId(); + + [DllImport(ApiConstants.ARCoreShimApi)] + public static extern void ArPresto_initialize(IntPtr javaVM, IntPtr activity, + CameraPermissionRequestProvider requestCameraPermission); + + [DllImport(ApiConstants.ARCoreShimApi)] + public static extern void ArPresto_checkApkAvailability( + CheckApkAvailabilityResultCallback onResult, IntPtr context); + + [DllImport(ApiConstants.ARCoreShimApi)] + public static extern void ArPresto_requestApkInstallation(bool user_requested, + RequestApkInstallationResultCallback onResult, IntPtr context); + + [DllImport(ApiConstants.ARCoreShimApi)] + public static extern void ArPresto_getSession(ref IntPtr sessionHandle); + + [DllImport(ApiConstants.ARCoreShimApi)] + public static extern void ArPresto_setConfiguration(ApiPrestoConfig config); + + [DllImport(ApiConstants.ARCoreShimApi)] + public static extern void ArPresto_setEnabled(bool isEnabled); + + [DllImport(ApiConstants.ARCoreShimApi)] + public static extern void ArPresto_getFrame(ref IntPtr frameHandle); + + [DllImport(ApiConstants.ARCoreShimApi)] + public static extern void ArPresto_getStatus(ref ApiPrestoStatus prestoStatus); + } + } +} \ No newline at end of file diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs.meta new file mode 100644 index 000000000..47689ce8e --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 864c8242be03c4aec8427b8a2286c601 +timeCreated: 1517519681 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs deleted file mode 100644 index 4c84f79d7..000000000 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs +++ /dev/null @@ -1,82 +0,0 @@ -//----------------------------------------------------------------------- -// -// -// Copyright 2017 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// -//----------------------------------------------------------------------- - -namespace GoogleARCoreInternal -{ - using System; - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using GoogleARCore; - using UnityEngine; - - [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", - Justification = "Internal")] - public class PointCloudManager - { - private NativeApi m_NativeApi; - - private IntPtr m_PointCloudHandle = IntPtr.Zero; - - private long m_LastUpdateTimeStamp = -1; - - public PointCloudManager(NativeApi nativeApi) - { - m_NativeApi = nativeApi; - } - - public void UpdateFrame(IntPtr frameHandle) - { - if (m_PointCloudHandle != IntPtr.Zero) - { - // After first frame, release previous frame's point cloud. - m_NativeApi.PointCloud.Release(m_PointCloudHandle); - } - - m_PointCloudHandle = m_NativeApi.Frame.AcquirePointCloud(frameHandle); - } - - public bool GetIsUpdatedThisFrame() - { - long currentTimestamp = m_NativeApi.PointCloud.GetTimestamp(m_PointCloudHandle); - if (m_LastUpdateTimeStamp != currentTimestamp) - { - m_LastUpdateTimeStamp = currentTimestamp; - return true; - } - - return false; - } - - public int GetPointCount() - { - return m_NativeApi.PointCloud.GetNumberOfPoints(m_PointCloudHandle); - } - - public Vector4 GetPoint(int index) - { - return m_NativeApi.PointCloud.GetPoint(m_PointCloudHandle, index); - } - - public void CopyPoints(List points) - { - m_NativeApi.PointCloud.CopyPoints(m_PointCloudHandle, points); - } - } -} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs deleted file mode 100644 index 06362c492..000000000 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs +++ /dev/null @@ -1,105 +0,0 @@ -//----------------------------------------------------------------------- -// -// -// Copyright 2017 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// -//----------------------------------------------------------------------- - -namespace GoogleARCoreInternal -{ - using System; - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using GoogleARCore; - using UnityEngine; - - [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", - Justification = "Internal")] - public class SessionManager - { - private NativeApi m_NativeApi; - - private SessionManager() - { - } - - ~SessionManager() - { - Destroy(); - } - - public SessionConnectionState ConnectionState { get; set; } - - public FrameManager FrameManager { get; private set; } - - public static SessionManager CreateSession() - { - var sessionManager = new SessionManager(); - sessionManager.m_NativeApi = NativeApi.CreateSession(); - if (sessionManager.m_NativeApi != null) - { - sessionManager.FrameManager = new FrameManager(sessionManager.m_NativeApi); - sessionManager.ConnectionState = SessionConnectionState.Uninitialized; - } - else - { - // Eventually we will provide more detail here: ARCore not installed, device not - // supported, ARCore version not supported, etc.; however the API to support these - // details does not exist yet. - // - // For now, just bundle all the possible errors into a generic connection failed. - sessionManager.ConnectionState = SessionConnectionState.ConnectToServiceFailed; - } - - return sessionManager; - } - - public void Destroy() - { - if (m_NativeApi != null) - { - m_NativeApi.Destroy(); - m_NativeApi = null; - } - } - - public bool CheckSupported(ARCoreSessionConfig config) - { - return m_NativeApi.Session.CheckSupported(config) == ApiArStatus.Success; - } - - public bool SetConfiguration(ARCoreSessionConfig config) - { - return m_NativeApi.Session.SetConfiguration(config); - } - - public bool Resume() - { - return m_NativeApi.Resume(_EarlyUpdate); - } - - public Anchor CreateWorldAnchor(Pose pose) - { - return m_NativeApi.Session.CreateAnchor(pose); - } - - private void _EarlyUpdate(IntPtr frameHandle, int textureId) - { - m_NativeApi.Session.SetDisplayGeometry(Screen.orientation, Screen.width, Screen.height); - FrameManager.UpdateFrame(frameHandle, (uint)textureId); - } - } -} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/TrackableManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/TrackableManager.cs index a607d76b9..0484e0925 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/TrackableManager.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/TrackableManager.cs @@ -30,7 +30,10 @@ namespace GoogleARCoreInternal Justification = "Internal")] public class TrackableManager { - private NativeApi m_NativeApi; + private Dictionary m_TrackableDict = + new Dictionary(new IntPtrEqualityComparer()); + + private NativeSession m_NativeSession; private int m_LastUpdateFrame = -1; @@ -38,19 +41,64 @@ public class TrackableManager private List m_AllTrackables = new List(); + private List m_UpdatedTrackables = new List(); + private HashSet m_OldTrackables = new HashSet(); - public TrackableManager(NativeApi nativeApi) + public TrackableManager(NativeSession nativeSession) + { + m_NativeSession = nativeSession; + } + + /// + /// Factory method for creating and reusing TrackedPlane references from native handles. + /// + /// A native handle to a plane that has been acquired. RELEASE WILL BE HANDLED BY + /// THIS METHOD. + /// A reference to a tracked plane. + public Trackable TrackableFactory(IntPtr nativeHandle) { - m_NativeApi = nativeApi; + if (nativeHandle == IntPtr.Zero) + { + return null; + } + + Trackable result; + if (m_TrackableDict.TryGetValue(nativeHandle, out result)) + { + // Release aquired handle and return cached result. + m_NativeSession.TrackableApi.Release(nativeHandle); + return result; + } + + ApiTrackableType trackableType = m_NativeSession.TrackableApi.GetType(nativeHandle); + if (trackableType == ApiTrackableType.Plane) + { + result = new TrackedPlane(nativeHandle, m_NativeSession); + } + else if (trackableType == ApiTrackableType.Point) + { + result = new TrackedPoint(nativeHandle, m_NativeSession); + } + else + { + UnityEngine.Debug.LogFormat("Cant find {0}", trackableType); + throw new NotImplementedException("TrackableFactory:: No constructor for requested trackable type."); + } + + m_TrackableDict.Add(nativeHandle, result); + return result; } public void GetTrackables(List trackables, TrackableQueryFilter filter) where T : Trackable { if (m_LastUpdateFrame < Time.frameCount) { + // Get trackables updated this frame. + m_NativeSession.FrameApi.GetUpdatedTrackables(m_UpdatedTrackables); + // Get all the trackables in the session. - m_NativeApi.Session.GetAllTrackables(m_AllTrackables); + m_NativeSession.SessionApi.GetAllTrackables(m_AllTrackables); // Find trackables that are not in the hashset (new). m_NewTrackables.Clear(); @@ -83,6 +131,13 @@ public void GetTrackables(List trackables, TrackableQueryFilter filter) wh _SafeAdd(m_NewTrackables[i], trackables); } } + else if (filter == TrackableQueryFilter.Updated) + { + for (int i = 0; i < m_NewTrackables.Count; i++) + { + _SafeAdd(m_UpdatedTrackables[i], trackables); + } + } } private void _SafeAdd(Trackable trackable, List trackables) where T : Trackable @@ -93,4 +148,4 @@ private void _SafeAdd(Trackable trackable, List trackables) where T : Trac } } } -} \ No newline at end of file +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Session.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Session.cs index 34b9c727a..0cb911cd0 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Session.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Session.cs @@ -33,127 +33,80 @@ namespace GoogleARCore /// public static class Session { - //// @cond EXCLUDE_FROM_DOXYGEN - - /// - /// Gets the manager for the sttatic session. - /// - public static SessionManager SessionManager { get; private set; } - - //// @endcond - /// - /// Gets current connection state. - /// - /// Members of the Session class (apart from ConnectionState itself) are only considered valid for access when - /// Session.ConnectionState == SessionConnectionState.Connected. Access to members of Session outside of this - /// state is considered undefined and may use stale data or throw an exception. + /// Gets current session status. /// - public static SessionConnectionState ConnectionState + public static SessionStatus Status { get { - if (SessionManager == null) - { - return SessionConnectionState.Uninitialized; - } - - return SessionManager.ConnectionState; + return LifecycleManager.Instance.SessionStatus; } } /// - /// Creates a new anchor at a world pose. As ARCore updates its understading of the space, it will update the + /// Creates a new Anchor at the given Pose that is attached to the Trackable. + /// If trackable is null, it creates a new anchor at a world pose. + /// As ARCore updates its understading of the space, it will update the /// virtual pose of the of the anchor to attempt to keep the anchor in the same real world location. /// /// The Unity world pose where the anchor is to be creates. + /// The Trackable to attach the Anchor to. /// The newly created anchor or null. - public static Anchor CreateWorldAnchor(Pose pose) + public static Anchor CreateAnchor(Pose pose, Trackable trackable = null) { - if (SessionManager == null) + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null) { return null; } - return SessionManager.CreateWorldAnchor(pose); - } - - /// - /// Performs a raycast against physical objects being tracked by ARCore. - /// Output the closest hit from the camera. - /// Note that the Unity's screen coordinate (0, 0) - /// starts from bottom left. - /// - /// Horizontal touch position in Unity's screen coordiante. - /// Vertical touch position in Unity's screen coordiante. - /// A filter bitmask where each {@link TrackableHitFlag} which is set represents a category - /// of raycast hits the method call should consider valid. - /// A {@link TrackableHit} that will be set if the raycast is successful. - /// true if the raycast had a hit, otherwise false. - public static bool Raycast(float x, float y, TrackableHitFlags filter, - out TrackableHit hitResult) - { - if (SessionManager == null) + if (trackable == null) { - hitResult = new TrackableHit(); - return false; + return nativeSession.SessionApi.CreateAnchor(pose); + } + else + { + return trackable.CreateAnchor(pose); } - - return SessionManager.FrameManager.Raycast(x, y, filter, out hitResult); } /// - /// Performs a raycast against physical objects being tracked by ARCore. - /// Output all hits from the camera. - /// Note that the Unity's screen coordinate (0, 0) - /// starts from bottom left. + /// Gets Trackables ARCore has tracked. /// - /// Horizontal touch position in Unity's screen coordiante. - /// Vertical touch position in Unity's screen coordiante. - /// A filter bitmask where each {@link TrackableHitFlag} which is set represents a category - /// of raycast hits the method call should consider valid. - /// A list of {@link TrackableHit} that will be set if the raycast is successful. - /// true if the raycast had a hit, otherwise false. - public static bool RaycastAll(float x, float y, TrackableHitFlags filter, List hitResults) + /// The Trackable type to get. + /// A reference to a list of T that will be filled by the method call. + /// A filter on the type of data to return. + public static void GetTrackables(List trackables, TrackableQueryFilter filter = TrackableQueryFilter.All) where T : Trackable { - if (SessionManager == null) + trackables.Clear(); + var nativeSession = LifecycleManager.Instance.NativeSession; + if (nativeSession == null) { - hitResults.Clear(); - return false; + return; } - return SessionManager.FrameManager.RaycastAll(x, Screen.height - y, filter, hitResults); + nativeSession.GetTrackables(trackables, filter); } - //// @cond EXCLUDE_FROM_DOXYGEN - /// - /// Initialized the static session. + /// Checks the availability of the ARCore APK on the device. /// - /// The manaager for the static session. - public static void Initialize(SessionManager sessionManager) + /// An AsyncTask that completes with an ApkAvailabilityStatus when the availability is known. + public static AsyncTask CheckApkAvailability() { - if (Session.SessionManager != null) - { - Debug.LogWarning("Cleaning up old session that was not destroyed."); - Session.SessionManager.Destroy(); - } - - Session.SessionManager = sessionManager; + return LifecycleManager.Instance.CheckApkAvailability(); } /// - /// Destroys the context of the static session class. + /// Requests an installation of the ARCore APK on the device. /// - public static void Destroy() + /// Whether the installation was requested explicity by a user action. + /// An AsyncTask that completes with an ApkInstallationStatus when the installation + /// status is resolved. + public static AsyncTask RequestApkInstallation(bool userRequested) { - if (SessionManager != null) - { - SessionManager.Destroy(); - SessionManager = null; - } + return LifecycleManager.Instance.RequestApkInstallation(userRequested); } - - //// @endcond } } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs deleted file mode 100644 index 056876fb4..000000000 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs +++ /dev/null @@ -1,58 +0,0 @@ -//----------------------------------------------------------------------- -// -// -// Copyright 2017 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// -//----------------------------------------------------------------------- - -namespace GoogleARCore -{ - /// - /// Possible states for the ARCore session connection. - /// - public enum SessionConnectionState - { - /// - /// The ARCore session has not been initialized. - /// - Uninitialized = 0, - - /// - /// The ARCore session is connected. - /// - Connected, - - /// - /// The ARCore session failed to connect because no configuration was supplied. - /// - MissingConfiguration, - - /// - /// The ARCore session failed to connect because an invalid configuration was supplied. - /// - InvalidConfiguration, - - /// - /// The ARCore session failed to connect because the user rejected at least one needed permission. - /// - UserRejectedNeededPermission, - - /// - /// The ARCore session failed to connect for unknown reason. - /// - ConnectToServiceFailed, - } -} \ No newline at end of file diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs.meta deleted file mode 100644 index 85e8f1618..000000000 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 8ee375b70bec246e2ba1aa45b534a9c6 -timeCreated: 1503354175 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs new file mode 100644 index 000000000..6de73ac2c --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs @@ -0,0 +1,74 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCore +{ + /// + /// Possible states for the ARCore session. + /// + public enum SessionStatus + { + /// + /// The ARCore session has not been initialized. + /// + None = 0, + + /// + /// The ARCore session is initializing. + /// + Initializing = 1, + + /// + /// The ARCore session is tracking. + /// + Tracking = 100, + + /// + /// The ARCore session has lost tracking and is attempting to recover. + /// + LostTracking = 101, + + /// + /// The ARCore session is paused. + /// + NotTracking = 102, + + /// + /// An ARCore session cannot begin tracking because a fatal error was encountered. + /// + FatalError = 200, + + /// + /// An ARCore session cannot begin tracking because the ARCore service APK is not available on the device. + /// + ErrorApkNotAvailable = 201, + + /// + /// An ARCore session cannot begin tracking because the Android camera permission is not granted. + /// + ErrorPermissionNotGranted = 202, + + /// + /// An ARCore session cannot begin tracking because the session configuration supplied is not supported or no + /// session configuration was supplied. + /// + ErrorSessionConfigurationNotSupported = 203, + } +} \ No newline at end of file diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs.meta new file mode 100644 index 000000000..40427c87d --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 30a41262cba2646c98f6d3cf4e46fb2a +timeCreated: 1516741153 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs new file mode 100644 index 000000000..6a0851328 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCore +{ + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + + /// + /// Extension methods for the SessionStatus enumeration. + /// + public static class SessionStatusExtensions + { + private const int k_NotInitializedGroupStart = 0; + private const int k_ValidSessionGroupStart = 100; + private const int k_ErrorGroupStart = 200; + + /// + /// Gets whether a SessionStatus is not yet initialized. + /// + /// The SessionStatus to check. + /// true if the SessionStatus is not initialized, otherwise false. + public static bool IsNotInitialized(this SessionStatus status) + { + int normalizedValue = (int)status - k_NotInitializedGroupStart; + return normalizedValue >= 0 && normalizedValue < 100; + } + + /// + /// Gets whether a SessionStatus is initialized and valid. + /// + /// The SessionStatus to check. + /// true if the SessionStatus is initialized and valid, + /// otherwise false. + public static bool IsValid(this SessionStatus status) + { + int normalizedValue = (int)status - k_ValidSessionGroupStart; + return normalizedValue >= 0 && normalizedValue < 100; + } + + /// + /// Gets whether a SessionStatus is an error. + /// + /// The SessionStatus to check. + /// true if the SessionStatus is an error, + /// otherwise false. + public static bool IsError(this SessionStatus status) + { + int normalizedValue = (int)status - k_ErrorGroupStart; + return normalizedValue >= 0 && normalizedValue < 100; + } + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs.meta new file mode 100644 index 000000000..5e626eed2 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: b8d6e0fc3b3bc44218e96690668c05b4 +timeCreated: 1517519681 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Trackable.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Trackable.cs index d4857ed24..e6da5d780 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Trackable.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Trackable.cs @@ -40,7 +40,7 @@ public abstract class Trackable /// /// The native api for ARCore. /// - protected NativeApi m_NativeApi; + protected NativeSession m_NativeSession; /// /// Constructs a new ARCore Trackable. @@ -53,16 +53,16 @@ protected Trackable() /// Constructs a new ARCore Trackable. /// /// The native handle. - /// The native api. - protected Trackable(IntPtr trackableNativeHandle, NativeApi nativeApi) + /// The native session. + protected Trackable(IntPtr trackableNativeHandle, NativeSession nativeSession) { m_TrackableNativeHandle = trackableNativeHandle; - m_NativeApi = nativeApi; + m_NativeSession = nativeSession; } ~Trackable() { - m_NativeApi.Trackable.Release(m_TrackableNativeHandle); + m_NativeSession.TrackableApi.Release(m_TrackableNativeHandle); } //// @endcond @@ -75,7 +75,21 @@ public virtual TrackingState TrackingState { get { - return m_NativeApi.Trackable.GetTrackingState(m_TrackableNativeHandle); + // TODO (b/73256094): Remove isTracking when fixed. + var nativeSession = LifecycleManager.Instance.NativeSession; + var isTracking = LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking; + if (nativeSession != m_NativeSession) + { + // Trackables from another session are considered stopped. + return TrackingState.Stopped; + } + else if (!isTracking) + { + // If there are no new frames coming in we must manually return paused. + return TrackingState.Paused; + } + + return m_NativeSession.TrackableApi.GetTrackingState(m_TrackableNativeHandle); } } @@ -90,13 +104,13 @@ public virtual TrackingState TrackingState public virtual Anchor CreateAnchor(Pose pose) { IntPtr anchorHandle; - if (!m_NativeApi.Trackable.AcquireNewAnchor(m_TrackableNativeHandle, pose, out anchorHandle)) + if (!m_NativeSession.TrackableApi.AcquireNewAnchor(m_TrackableNativeHandle, pose, out anchorHandle)) { Debug.Log("Failed to create anchor on trackable."); return null; } - return Anchor.AnchorFactory(anchorHandle, m_NativeApi); + return Anchor.AnchorFactory(anchorHandle, m_NativeSession); } /// @@ -105,7 +119,7 @@ public virtual Anchor CreateAnchor(Pose pose) /// A list of anchors to be filled by the method. public virtual void GetAllAnchors(List anchors) { - m_NativeApi.Trackable.GetAnchors(m_TrackableNativeHandle, anchors); + m_NativeSession.TrackableApi.GetAnchors(m_TrackableNativeHandle, anchors); } } } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableHitFlags.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableHitFlags.cs index 6b129203e..8827d6e9e 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableHitFlags.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableHitFlags.cs @@ -34,27 +34,33 @@ public enum TrackableHitFlags /// /// If you pass this into Raycast, you will not get any collision results. /// - None = 0, + None = 0, /// /// The collision is within the the TrackedPlane's convex bounding polygon. /// - PlaneWithinPolygon = 1 << 0, + PlaneWithinPolygon = 1 << 0, /// /// The collision is within the TrackedPlane's bounding box. /// - PlaneWithinBounds = 1 << 1, + PlaneWithinBounds = 1 << 1, /// /// The collision is on the TrackedPlane, but not limited to the bounding box or polygon. /// This acts as if the plane extends out to infinity. /// - PlaneWithinInfinity = 1 << 2, + PlaneWithinInfinity = 1 << 2, /// - /// The collision is on points in the current frame's point cloud. + /// The collision is on a feature point in the current frame's point cloud. /// - PointCloud = 1 << 3, + FeaturePoint = 1 << 3, + + /// + /// The collision is on a feature point in the current frame's point cloud + /// that has a surface normal estimate (orientation). + /// + FeaturePointWithSurfaceNormal = 1 << 4, } } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableQueryFilter.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableQueryFilter.cs index 74d474892..4b5fe7bf3 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableQueryFilter.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableQueryFilter.cs @@ -39,5 +39,10 @@ public enum TrackableQueryFilter /// Indicates new trackables detected in the current ARCore Frame. /// New, + + /// + /// Indicates trackables that were updated in the current ARCore Frame. + /// + Updated, } } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPlane.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPlane.cs index 79866abdf..5d7ee6e48 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPlane.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPlane.cs @@ -38,11 +38,11 @@ public class TrackedPlane : Trackable /// /// A handle to the native ARCore API Trackable. /// The ARCore native api. - public TrackedPlane(IntPtr nativeHandle, NativeApi nativeApi) + public TrackedPlane(IntPtr nativeHandle, NativeSession nativeApi) : base(nativeHandle, nativeApi) { m_TrackableNativeHandle = nativeHandle; - m_NativeApi = nativeApi; + m_NativeSession = nativeApi; } //// @endcond @@ -55,29 +55,18 @@ public TrackedPlane SubsumedBy { get { - return m_NativeApi.Plane.GetSubsumedBy(m_TrackableNativeHandle); + return m_NativeSession.PlaneApi.GetSubsumedBy(m_TrackableNativeHandle); } } /// - /// Gets the center position of the plane. + /// Gets the position and orientation of the plane's center. /// - public Vector3 Position + public Pose CenterPose { get { - return m_NativeApi.Plane.GetCenterPose(m_TrackableNativeHandle).position; - } - } - - /// - /// Gets the rotation of the plane. - /// - public Quaternion Rotation - { - get - { - return m_NativeApi.Plane.GetCenterPose(m_TrackableNativeHandle).rotation; + return m_NativeSession.PlaneApi.GetCenterPose(m_TrackableNativeHandle); } } @@ -88,7 +77,7 @@ public float ExtentX { get { - return m_NativeApi.Plane.GetExtentX(m_TrackableNativeHandle); + return m_NativeSession.PlaneApi.GetExtentX(m_TrackableNativeHandle); } } @@ -99,7 +88,7 @@ public float ExtentZ { get { - return m_NativeApi.Plane.GetExtentZ(m_TrackableNativeHandle); + return m_NativeSession.PlaneApi.GetExtentZ(m_TrackableNativeHandle); } } @@ -110,7 +99,7 @@ public float ExtentZ /// A list of Vector3 to be filled by the method call. public void GetBoundaryPolygon(List boundaryPolygonPoints) { - m_NativeApi.Plane.GetPolygon(m_TrackableNativeHandle, boundaryPolygonPoints); + m_NativeSession.PlaneApi.GetPolygon(m_TrackableNativeHandle, boundaryPolygonPoints); } } } \ No newline at end of file diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPoint.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPoint.cs index 5f5ffa1f8..b7c90a01b 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPoint.cs +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPoint.cs @@ -38,20 +38,31 @@ public class TrackedPoint : Trackable /// /// A handle to the native ARCore API Trackable. /// The ARCore native api. - public TrackedPoint(IntPtr nativeHandle, NativeApi nativeApi) : base(nativeHandle, nativeApi) + public TrackedPoint(IntPtr nativeHandle, NativeSession nativeApi) : base(nativeHandle, nativeApi) { } //// @endcond /// - /// Gets the pose of the point. + /// Gets the pose of the TrackedPoint. /// public Pose Pose { get { - return m_NativeApi.Point.GetPose(m_TrackableNativeHandle); + return m_NativeSession.PointApi.GetPose(m_TrackableNativeHandle); + } + } + + /// + /// Gets the orientation mode of the TrackedPoint. + /// + public TrackedPointOrientationMode OrientationMode + { + get + { + return m_NativeSession.PointApi.GetOrientationMode(m_TrackableNativeHandle); } } } diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs new file mode 100644 index 000000000..bd381cc8b --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs @@ -0,0 +1,31 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCore +{ + /// + /// The orientation mode for a TrackedPoint. + /// + public enum TrackedPointOrientationMode + { + Identity = 0, + SurfaceNormal = 1, + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs.meta new file mode 100644 index 000000000..582f1e37b --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: f605e8f0dd31a453083b47fb68477792 +timeCreated: 1516989852 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs new file mode 100644 index 000000000..35461c2c6 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs @@ -0,0 +1,75 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace GoogleARCoreInternal +{ + using System; + using System.Diagnostics.CodeAnalysis; + using System.IO; + using UnityEngine; + + [Serializable] + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", + Justification = "Internal")] + public class ARCoreProjectSettings + { + public string Version; + public bool IsARCoreRequired; + public bool IsInstantPreviewEnabled; + private const string k_VersionString = "V1.0.0"; + private const string k_ProjectSettingsPath = "ProjectSettings/ARCoreProjectSettings.json"; + + static ARCoreProjectSettings() + { + if (Application.isEditor) + { + Instance = new ARCoreProjectSettings(); + Instance.Load(); + } + else + { + Instance = null; + Debug.LogError("Cannot access ARCoreProjectSettings outside of Unity Editor."); + } + } + + public static ARCoreProjectSettings Instance { get; private set; } + + public void Load() + { + Version = k_VersionString; + IsARCoreRequired = true; + IsInstantPreviewEnabled = false; + + if (File.Exists(k_ProjectSettingsPath)) + { + ARCoreProjectSettings settings = JsonUtility.FromJson( + File.ReadAllText(k_ProjectSettingsPath)); + Version = settings.Version; + IsARCoreRequired = settings.IsARCoreRequired; + } + } + + public void Save() + { + File.WriteAllText(k_ProjectSettingsPath, JsonUtility.ToJson(this)); + } + } +} \ No newline at end of file diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs.meta new file mode 100644 index 000000000..5a47a84f5 --- /dev/null +++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 68605a05829544832b871afc8bf03168 +timeCreated: 1518470830 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Map/VectorTile.cs b/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Map/VectorTile.cs index 57549d8cc..53a72bbf4 100644 --- a/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Map/VectorTile.cs +++ b/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Map/VectorTile.cs @@ -197,7 +197,6 @@ internal override bool ParseTileData(byte[] data) { var decompressed = Compression.Decompress(data); this.data = new Mapbox.VectorTile.VectorTile(decompressed); - return true; } catch (Exception ex) diff --git a/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Platform/TileJSON/TileJSON.cs b/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Platform/TileJSON/TileJSON.cs index 57b5266a0..0491354e4 100644 --- a/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Platform/TileJSON/TileJSON.cs +++ b/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Platform/TileJSON/TileJSON.cs @@ -37,6 +37,10 @@ public IAsyncRequest Get(string tilesetName, Action callback) { string json = Encoding.UTF8.GetString(response.Data); TileJSONResponse tileJSONResponse = JsonConvert.DeserializeObject(json); + if (tileJSONResponse != null) + { + tileJSONResponse.Source = tilesetName; + } callback(tileJSONResponse); } , _timeout diff --git a/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Utils/CircularBuffer.cs b/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Utils/CircularBuffer.cs new file mode 100644 index 000000000..90916b0c9 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Utils/CircularBuffer.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace Mapbox.Utils +{ + + + public interface ICircularBuffer + { + int Count { get; } + void Add(T item); + T this[int index] { get; } + } + + + + /// + /// http://geekswithblogs.net/blackrob/archive/2014/09/01/circular-buffer-in-c.aspx + /// https://social.msdn.microsoft.com/Forums/vstudio/en-US/416a2175-b05d-43b1-b99a-a01c56550dbe/circular-buffer-in-net?forum=netfxbcl + /// https://en.wikipedia.org/wiki/Circular_buffer + /// + /// + public class CircularBuffer : ICircularBuffer, IEnumerable + + { + private T[] _buffer; + private int _head; + private int _tail; + + + public CircularBuffer(int capacity) + { + if (capacity < 0) { throw new ArgumentOutOfRangeException("capacity", "must be positive"); } + _buffer = new T[capacity]; + _head = 0; + } + + + public int Count { get; private set; } + + + public void Add(T item) + { + _head = (_head + 1) % _buffer.Length; + _buffer[_head] = item; + if (Count == _buffer.Length) + { + _tail = (_tail + 1) % _buffer.Length; + } + else + { + ++Count; + } + } + + + /// + /// ATTENTION!!! order is flipped like in rolling window + /// [0] is newest value + /// + /// + /// + public T this[int index] + { + get + { + if (index < 0 || index >= _buffer.Length) { throw new ArgumentOutOfRangeException("index: " + index.ToString()); } + + return _buffer[mod((_head - index), _buffer.Length)]; + } + } + + + private int mod(int x, int m) // x mod m works for both positive and negative x (unlike x % m). + { + return (x % m + m) % m; + } + + public IEnumerator GetEnumerator() + { + if (Count == 0 || _buffer.Length == 0) + { + yield break; + } + + for (var i = 0; i < Count; ++i) { yield return this[i]; } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + + public IEnumerable GetEnumerable() + { + IEnumerator enumerator = GetEnumerator(); + while (enumerator.MoveNext()) + { + yield return enumerator.Current; + } + } + + + } +} diff --git a/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Utils/CircularBuffer.cs.meta b/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Utils/CircularBuffer.cs.meta new file mode 100644 index 000000000..7d3518bd0 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Utils/CircularBuffer.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: bfee2b258d221f741a76c90caaa027db +timeCreated: 1524828267 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Utils/UnixTimestampUtils.cs b/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Utils/UnixTimestampUtils.cs index 502a440f5..b07d9a47b 100644 --- a/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Utils/UnixTimestampUtils.cs +++ b/sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Utils/UnixTimestampUtils.cs @@ -39,6 +39,17 @@ public static DateTime From(double timestamp) return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Add(TimeSpan.FromSeconds(timestamp)); } + /// + /// Convert from Unitx timestamp to DateTime. Uses TimeSpan.FromSeconds to caluclate offset since epoch 0 + /// + /// + /// + public static DateTime FromMilliseconds(double timestamp) + { + //return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Add(TimeSpan.FromSeconds(timestamp)).ToLocalTime(); + return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Add(TimeSpan.FromMilliseconds(timestamp)); + } + /// /// Convert from Unitx timestamp to DateTime. Uses TimeSpan.FromTicks to caluclate offset since epoch 0 /// diff --git a/sdkproject/Assets/Mapbox/Core/probe-extractor-cs/Probe.cs b/sdkproject/Assets/Mapbox/Core/probe-extractor-cs/Probe.cs index 5d1d3f07a..6328a5a32 100644 --- a/sdkproject/Assets/Mapbox/Core/probe-extractor-cs/Probe.cs +++ b/sdkproject/Assets/Mapbox/Core/probe-extractor-cs/Probe.cs @@ -27,7 +27,7 @@ public static TracePoint FromLocation(Location location) Timestamp = (long)location.Timestamp, Latitude = location.LatitudeLongitude.x, Longitude = location.LatitudeLongitude.y, - Bearing = location.Heading, + Bearing = location.UserHeading, HDop = location.Accuracy }; } diff --git a/sdkproject/Assets/Mapbox/Examples/0_PrefabScenes/LocationBasedGame.unity b/sdkproject/Assets/Mapbox/Examples/0_PrefabScenes/LocationBasedGame.unity index 7511f1e8a..295ef705b 100644 --- a/sdkproject/Assets/Mapbox/Examples/0_PrefabScenes/LocationBasedGame.unity +++ b/sdkproject/Assets/Mapbox/Examples/0_PrefabScenes/LocationBasedGame.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657844, g: 0.49641222, b: 0.57481694, a: 1} + m_IndirectSpecularColor: {r: 0.4465785, g: 0.49641252, b: 0.574817, a: 1} --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 @@ -259,12 +259,48 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} ---- !u!114 &1097789541 stripped -MonoBehaviour: - m_PrefabParentObject: {fileID: 114586318175614768, guid: 35ce2bb4caba9434db5e656796b632b1, - type: 2} - m_PrefabInternal: {fileID: 1312888759} - m_Script: {fileID: 11500000, guid: 60712efc3153a4819b0c79437175846d, type: 3} +--- !u!1001 &843921207 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4886150424162858, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4886150424162858, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4886150424162858, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4886150424162858, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4886150424162858, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4886150424162858, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4886150424162858, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4886150424162858, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} + m_IsPrefabParent: 0 --- !u!1 &1188978833 GameObject: m_ObjectHideFlags: 0 @@ -434,58 +470,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _statusText: {fileID: 1962332873} ---- !u!1001 &1312888759 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 4601654966360252, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4601654966360252, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4601654966360252, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4601654966360252, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4601654966360252, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4601654966360252, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4601654966360252, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4601654966360252, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 114375948512099040, guid: 35ce2bb4caba9434db5e656796b632b1, - type: 2} - propertyPath: _editorLocationProvider - value: - objectReference: {fileID: 1097789541} - - target: {fileID: 114664232128227002, guid: 35ce2bb4caba9434db5e656796b632b1, - type: 2} - propertyPath: _updateDistanceInMeters - value: 1 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2} - m_IsPrefabParent: 0 --- !u!1 &1962332871 GameObject: m_ObjectHideFlags: 0 diff --git a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/DataExplorer.unity b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/DataExplorer.unity index 8130376a2..8253ca410 100644 --- a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/DataExplorer.unity +++ b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/DataExplorer.unity @@ -379,12 +379,41 @@ MonoBehaviour: wallMaterial: {fileID: 0} _vectorData: _layerProperty: - sourceType: 0 + tileJsonData: + tileJSONLoaded: 0 + LayerDisplayNames: + - admin + - aeroway + - airport_label + - barrier_line + - building + - contour + - country_label + - hillshade + - housenum_label + - landcover + - landuse + - landuse_overlay + - marine_label + - motorway_junction + - mountain_peak_label + - place_label + - poi_label + - rail_station_label + - road + - road_label + - state_label + - traffic + - water + - water_label + - waterway + - waterway_label + _sourceType: 2 sourceOptions: isActive: 1 layerSource: Name: Mapbox Streets - Id: mapbox.3d-buildings,mapbox.mapbox-streets-v7 + Id: mapbox.3d-buildings,mapbox.mapbox-streets-v7,mapbox.mapbox-traffic-v1,mapbox.mapbox-terrain-v2 Modified: UserName: useOptimizedStyle: 0 @@ -406,19 +435,21 @@ MonoBehaviour: groupFeatures: 1 lineWidth: 1 filterOptions: + _selectedLayerName: building filters: [] combinerType: 2 extrusionOptions: + _selectedLayerName: building extrusionType: 1 extrusionGeometryType: 0 propertyName: height + propertyDescription: Number. Height of building or part of building. minimumHeight: 0 maximumHeight: 0 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 3 materials: - Materials: @@ -428,6 +459,7 @@ MonoBehaviour: atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 11400000, guid: e1b79d6caac0144adada0c548ef06705, type: 2} + honorBuildingIdSetting: 1 buildingsWithUniqueIds: 1 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -441,24 +473,27 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: landuse filters: - Key: type + KeyDescription: OSM tag, more specific than class PropertyValue: park Min: 0 Max: 0 filterOperator: 0 combinerType: 0 extrusionOptions: + _selectedLayerName: landuse extrusionType: 0 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0 extrusionScaleFactor: 1 colliderOptions: colliderType: 2 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -467,13 +502,13 @@ MonoBehaviour: - {fileID: 2100000, guid: 1843a50abea6fa448a61d143054f2166, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 1 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] GoModifiers: - {fileID: 11400000, guid: 3505ec4e61e3f4c4d88fc3c5548e7144, type: 2} - {fileID: 11400000, guid: d5cfd67d46b2f4892ae231737f3a95f8, type: 2} - - {fileID: 11400000, guid: 14ec972a1cec2dc429f5eca7d22b572f, type: 2} - {fileID: 11400000, guid: 4aeb0629486794f25bf199af8a4f4830, type: 2} - coreOptions: isActive: 1 @@ -484,19 +519,21 @@ MonoBehaviour: groupFeatures: 1 lineWidth: 3 filterOptions: + _selectedLayerName: road filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: road extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0.5 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -505,6 +542,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -518,24 +556,28 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: poi_label filters: - Key: localrank + KeyDescription: Number. Priority relative to nearby POIs. Useful for limiting + label density. PropertyValue: Min: 1 Max: 0 filterOperator: 1 combinerType: 0 extrusionOptions: + _selectedLayerName: poi_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0.5 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -544,6 +586,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -558,19 +601,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: poi_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: poi_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0.5 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -579,6 +624,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -594,19 +640,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: water filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: water extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0.4 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -615,6 +663,7 @@ MonoBehaviour: - {fileID: 2100000, guid: 55643c4fd976d7e429bda0a90c976b14, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 1 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -628,19 +677,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 3 filterOptions: + _selectedLayerName: waterway filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: waterway extrusionType: 5 extrusionGeometryType: 1 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0.5 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -649,6 +700,7 @@ MonoBehaviour: - {fileID: 2100000, guid: ab4ee1288a054a84b85ba5cf5a0abf34, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -662,19 +714,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: aeroway filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: aeroway extrusionType: 5 extrusionGeometryType: 1 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0.5 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -683,6 +737,7 @@ MonoBehaviour: - {fileID: 2100000, guid: c0be5c38e1944584b89f81505e3c4446, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -696,19 +751,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: barrier_line filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: barrier_line extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 1 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -717,6 +774,7 @@ MonoBehaviour: - {fileID: 2100000, guid: a4c397925829de8438fa9bb51535fd17, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -730,19 +788,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: landuse_overlay filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: landuse_overlay extrusionType: 5 extrusionGeometryType: 1 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 1 extrusionScaleFactor: 1 colliderOptions: colliderType: 2 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -751,6 +811,7 @@ MonoBehaviour: - {fileID: 0} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 1 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 2 MeshModifiers: [] @@ -764,19 +825,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 3 filterOptions: + _selectedLayerName: admin filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: admin extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -785,6 +848,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 1 MeshModifiers: [] @@ -798,19 +862,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: country_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: country_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -819,6 +885,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -833,19 +900,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: marine_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: marine_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -854,6 +923,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -868,19 +938,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: state_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: state_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -889,6 +961,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -903,19 +976,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: water_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: water_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -924,6 +999,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -938,19 +1014,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: place_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: place_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -959,6 +1037,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -973,19 +1052,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: road_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: road_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -994,6 +1075,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -1008,19 +1090,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: waterway_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: waterway_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1029,6 +1113,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -1043,19 +1128,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: airport_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: airport_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1064,6 +1151,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -1078,19 +1166,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: rail_station_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: rail_station_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1099,6 +1189,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -1113,19 +1204,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: mountain_peak_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: mountain_peak_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1134,6 +1227,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -1148,19 +1242,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: housenum_label filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: housenum_label extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1169,6 +1265,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -1183,19 +1280,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: motorway_junction filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: motorway_junction extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1204,6 +1303,7 @@ MonoBehaviour: - {fileID: 2100000, guid: dd63290cb53906349af7ea675627a697, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -1218,19 +1318,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: building filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: building extrusionType: 5 extrusionGeometryType: 1 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0.2 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1239,32 +1341,35 @@ MonoBehaviour: - {fileID: 0} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 1 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] GoModifiers: [] - coreOptions: - isActive: 1 - sublayerName: HIllshade + isActive: 0 + sublayerName: Hillshade geometryType: 2 layerName: hillshade snapToTerrain: 1 groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: hillshade filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: hillshade extrusionType: 5 extrusionGeometryType: 1 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 3 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1273,6 +1378,7 @@ MonoBehaviour: - {fileID: 0} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 1 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -1286,19 +1392,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 3 filterOptions: + _selectedLayerName: contour filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: contour extrusionType: 5 extrusionGeometryType: 1 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0.5 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1307,12 +1415,13 @@ MonoBehaviour: - {fileID: 0} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] GoModifiers: [] - coreOptions: - isActive: 0 + isActive: 1 sublayerName: LowTrafficCongestion geometryType: 1 layerName: traffic @@ -1320,24 +1429,28 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 3 filterOptions: + _selectedLayerName: traffic filters: - Key: congestion + KeyDescription: 'Congestion severity. One of: ''low'', ''moderate'', ''heavy'', + ''severe''' PropertyValue: low Min: 0 Max: 0 filterOperator: 0 combinerType: 1 extrusionOptions: + _selectedLayerName: traffic extrusionType: 5 extrusionGeometryType: 1 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 1 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1346,12 +1459,13 @@ MonoBehaviour: - {fileID: 0} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] GoModifiers: [] - coreOptions: - isActive: 0 + isActive: 1 sublayerName: ModerateTrafficCongestion geometryType: 1 layerName: traffic @@ -1359,24 +1473,28 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 3 filterOptions: + _selectedLayerName: traffic filters: - Key: congestion + KeyDescription: 'Congestion severity. One of: ''low'', ''moderate'', ''heavy'', + ''severe''' PropertyValue: moderate Min: 0 Max: 0 filterOperator: 0 combinerType: 1 extrusionOptions: + _selectedLayerName: traffic extrusionType: 5 extrusionGeometryType: 1 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 1 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1385,6 +1503,7 @@ MonoBehaviour: - {fileID: 0} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] @@ -1398,24 +1517,28 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 3 filterOptions: + _selectedLayerName: traffic filters: - Key: congestion + KeyDescription: 'Congestion severity. One of: ''low'', ''moderate'', ''heavy'', + ''severe''' PropertyValue: heavy Min: 0 Max: 0 filterOperator: 0 combinerType: 1 extrusionOptions: + _selectedLayerName: traffic extrusionType: 5 extrusionGeometryType: 1 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 1 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1424,12 +1547,13 @@ MonoBehaviour: - {fileID: 0} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] GoModifiers: [] - coreOptions: - isActive: 0 + isActive: 1 sublayerName: SevereTrafficCongestion geometryType: 1 layerName: traffic @@ -1437,24 +1561,28 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 3 filterOptions: + _selectedLayerName: traffic filters: - Key: congestion + KeyDescription: 'Congestion severity. One of: ''low'', ''moderate'', ''heavy'', + ''severe''' PropertyValue: severe Min: 0 Max: 0 filterOperator: 0 combinerType: 1 extrusionOptions: + _selectedLayerName: traffic extrusionType: 5 extrusionGeometryType: 1 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 1 extrusionScaleFactor: 1 colliderOptions: colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -1463,10 +1591,12 @@ MonoBehaviour: - {fileID: 0} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] GoModifiers: [] + locationPrefabList: [] _tileProvider: {fileID: 0} --- !u!1 &165147574 GameObject: @@ -2696,47 +2826,47 @@ Prefab: - target: {fileID: 224907993215804030, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMin.y - value: 0.000000059604645 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224907993215804030, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224907993215804030, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchoredPosition.x - value: 116.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchoredPosition.y - value: -98.25222 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_SizeDelta.x - value: 213 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_SizeDelta.y - value: 176.50444 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224857786874416376, guid: 98be219873e6d4dffb5949746f515a33, type: 2} @@ -2746,17 +2876,17 @@ Prefab: - target: {fileID: 224907856650798614, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224907856650798614, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224907856650798614, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_SizeDelta.x - value: -17 + value: 0 objectReference: {fileID: 0} - target: {fileID: 114603753021256032, guid: 98be219873e6d4dffb5949746f515a33, type: 2} @@ -2792,7 +2922,7 @@ Prefab: - target: {fileID: 224857786874416376, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchoredPosition.y - value: -0.000015258789 + value: 0 objectReference: {fileID: 0} - target: {fileID: 114731470950229392, guid: 98be219873e6d4dffb5949746f515a33, type: 2} @@ -3024,12 +3154,12 @@ Prefab: - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, type: 2} propertyPath: m_LocalPosition.x - value: 371 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, type: 2} propertyPath: m_LocalPosition.y - value: 197.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, type: 2} diff --git a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/InteractiveStyledVectorMap.unity b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/InteractiveStyledVectorMap.unity index 588ba3d39..5f2d72eec 100644 --- a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/InteractiveStyledVectorMap.unity +++ b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/InteractiveStyledVectorMap.unity @@ -379,7 +379,32 @@ MonoBehaviour: wallMaterial: {fileID: 0} _vectorData: _layerProperty: - sourceType: 0 + tileJsonData: + tileJSONLoaded: 0 + LayerDisplayNames: + - admin + - aeroway + - airport_label + - barrier_line + - building + - country_label + - housenum_label + - landuse + - landuse_overlay + - marine_label + - motorway_junction + - mountain_peak_label + - place_label + - poi_label + - rail_station_label + - road + - road_label + - state_label + - water + - water_label + - waterway + - waterway_label + _sourceType: 0 sourceOptions: isActive: 1 layerSource: @@ -398,6 +423,7 @@ MonoBehaviour: entityPerCoroutine: 20 vectorSubLayers: - coreOptions: + sourceId: isActive: 1 sublayerName: ResidentialBuildings geometryType: 2 @@ -406,17 +432,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: filters: - Key: type + KeyDescription: PropertyValue: residential Min: 0 Max: 0 filterOperator: 0 combinerType: 0 extrusionOptions: + _selectedLayerName: extrusionType: 1 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0 extrusionScaleFactor: 1 @@ -440,6 +470,7 @@ MonoBehaviour: - {fileID: 11400000, guid: 14ec972a1cec2dc429f5eca7d22b572f, type: 2} - {fileID: 11400000, guid: aa354e89f869a4db0a6c3ceb3c79d0be, type: 2} - coreOptions: + sourceId: isActive: 1 sublayerName: CommercialBuildings geometryType: 2 @@ -448,17 +479,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: filters: - Key: type + KeyDescription: PropertyValue: commercial Min: 0 Max: 0 filterOperator: 0 combinerType: 0 extrusionOptions: + _selectedLayerName: extrusionType: 1 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0 extrusionScaleFactor: 1 @@ -482,6 +517,7 @@ MonoBehaviour: - {fileID: 11400000, guid: 14ec972a1cec2dc429f5eca7d22b572f, type: 2} - {fileID: 11400000, guid: aa354e89f869a4db0a6c3ceb3c79d0be, type: 2} - coreOptions: + sourceId: isActive: 1 sublayerName: OtherBuildings geometryType: 2 @@ -490,22 +526,27 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: filters: - Key: type + KeyDescription: PropertyValue: commercial Min: 0 Max: 0 filterOperator: 0 - Key: type + KeyDescription: PropertyValue: residential Min: 0 Max: 0 filterOperator: 0 combinerType: 2 extrusionOptions: + _selectedLayerName: extrusionType: 1 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0 extrusionScaleFactor: 1 @@ -530,6 +571,7 @@ MonoBehaviour: - {fileID: 11400000, guid: aa354e89f869a4db0a6c3ceb3c79d0be, type: 2} - {fileID: 11400000, guid: d534c6a861f735c4dab3990ac3c05158, type: 2} - coreOptions: + sourceId: isActive: 1 sublayerName: Parks geometryType: 2 @@ -538,17 +580,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: filters: - Key: type + KeyDescription: PropertyValue: park Min: 0 Max: 0 filterOperator: 0 combinerType: 0 extrusionOptions: + _selectedLayerName: extrusionType: 0 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 0 extrusionScaleFactor: 1 @@ -572,6 +618,7 @@ MonoBehaviour: - {fileID: 11400000, guid: d5cfd67d46b2f4892ae231737f3a95f8, type: 2} - {fileID: 11400000, guid: 14ec972a1cec2dc429f5eca7d22b572f, type: 2} - {fileID: 11400000, guid: 4aeb0629486794f25bf199af8a4f4830, type: 2} + locationPrefabList: [] _tileProvider: {fileID: 0} --- !u!1 &165147574 GameObject: @@ -1846,7 +1893,7 @@ Prefab: - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchoredPosition.y - value: -69.16049 + value: -67.20215 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} @@ -1856,12 +1903,12 @@ Prefab: - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_SizeDelta.y - value: 118.32098 + value: 114.404305 objectReference: {fileID: 0} - target: {fileID: 224857786874416376, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_SizeDelta.y - value: 138.32098 + value: 134.4043 objectReference: {fileID: 0} - target: {fileID: 224907856650798614, guid: 98be219873e6d4dffb5949746f515a33, type: 2} diff --git a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/MotorwayJunctionLayer/ExplorerPointPrefabModifier.asset b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/MotorwayJunctionLayer/ExplorerPointPrefabModifier.asset index 20d4c129c..ffe382a72 100644 --- a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/MotorwayJunctionLayer/ExplorerPointPrefabModifier.asset +++ b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/MotorwayJunctionLayer/ExplorerPointPrefabModifier.asset @@ -12,5 +12,6 @@ MonoBehaviour: m_Name: ExplorerPointPrefabModifier m_EditorClassIdentifier: Active: 1 - _prefab: {fileID: 1918270036827452, guid: cef2154b086ac7244b859a4cb18fe659, type: 2} - _scaleDownWithWorld: 1 + _options: + prefab: {fileID: 1706413382388718, guid: 0940fff5996150e4cb6c1f69c781a29a, type: 2} + scaleDownWithWorld: 1 diff --git a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/Resources/ExplorerCountryLabelPrefabModifier.asset b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/Resources/ExplorerCountryLabelPrefabModifier.asset index dbfcc1220..a8ddd1f19 100644 --- a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/Resources/ExplorerCountryLabelPrefabModifier.asset +++ b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/Resources/ExplorerCountryLabelPrefabModifier.asset @@ -12,5 +12,6 @@ MonoBehaviour: m_Name: ExplorerCountryLabelPrefabModifier m_EditorClassIdentifier: Active: 1 - _prefab: {fileID: 1706413382388718, guid: 0940fff5996150e4cb6c1f69c781a29a, type: 2} - _scaleDownWithWorld: 1 + _options: + prefab: {fileID: 1706413382388718, guid: 0940fff5996150e4cb6c1f69c781a29a, type: 2} + scaleDownWithWorld: 1 diff --git a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/Resources/LabelPrefab.prefab b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/Resources/LabelPrefab.prefab index f8a8b5910..86f52ad10 100644 --- a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/Resources/LabelPrefab.prefab +++ b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Modules/Resources/LabelPrefab.prefab @@ -38,6 +38,7 @@ GameObject: - component: {fileID: 4774780138522716} - component: {fileID: 23069974456502518} - component: {fileID: 102549506598402298} + - component: {fileID: 114504824515177124} m_Layer: 10 m_Name: TextMesh m_TagString: Untagged @@ -81,6 +82,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -96,6 +98,7 @@ MeshRenderer: m_PreserveUVs: 0 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -118,13 +121,13 @@ TextMesh: m_Anchor: 4 m_Alignment: 1 m_TabSize: 4 - m_FontSize: 200 + m_FontSize: 300 m_FontStyle: 0 m_RichText: 1 m_Font: {fileID: 12800000, guid: 218956a5c2a6e42d6a60afccf80b002b, type: 3} m_Color: serializedVersion: 2 - rgba: 4278190080 + rgba: 4294967295 --- !u!114 &114031264422835886 MonoBehaviour: m_ObjectHideFlags: 1 @@ -137,6 +140,21 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _camera: {fileID: 0} +--- !u!114 &114504824515177124 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1961071164979864} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f9b2b4cc337b3479a9f4365ea51ff65c, type: 3} + m_Name: + m_EditorClassIdentifier: + pixelSize: 1 + outlineColor: {r: 0, g: 0, b: 0, a: 1} + resolutionDependant: 0 + doubleResolution: 1024 --- !u!114 &114543158922302552 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Scripts.meta b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Scripts.meta new file mode 100644 index 000000000..198de5f83 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Scripts.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 885272a0cfaef4ce8b15754b37c4fe76 +folderAsset: yes +timeCreated: 1525975542 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Scripts/TextMeshOutline.cs b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Scripts/TextMeshOutline.cs new file mode 100644 index 000000000..ecd179540 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Scripts/TextMeshOutline.cs @@ -0,0 +1,91 @@ +namespace Mapbox.Examples +{ + using UnityEngine; + using System.Collections; + + /// + /// Text mesh outline. Script source: https://answers.unity.com/questions/542646/3d-text-strokeoutline.html + /// + public class TextMeshOutline : MonoBehaviour + { + + public float pixelSize = 1; + public Color outlineColor = Color.black; + public bool resolutionDependant = false; + public int doubleResolution = 1024; + + private TextMesh textMesh; + private MeshRenderer meshRenderer; + + void Start() + { + textMesh = GetComponent(); + meshRenderer = GetComponent(); + + for (int i = 0; i < 8; i++) + { + GameObject outline = new GameObject("outline", typeof(TextMesh)); + outline.transform.parent = transform; + outline.transform.localScale = new Vector3(1, 1, 1); + + MeshRenderer otherMeshRenderer = outline.GetComponent(); + otherMeshRenderer.material = new Material(meshRenderer.material); + otherMeshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; + otherMeshRenderer.receiveShadows = false; + otherMeshRenderer.sortingLayerID = meshRenderer.sortingLayerID; + otherMeshRenderer.sortingLayerName = meshRenderer.sortingLayerName; + } + } + + void LateUpdate() + { + Vector3 screenPoint = Camera.main.WorldToScreenPoint(transform.position); + + outlineColor.a = textMesh.color.a * textMesh.color.a; + + // copy attributes + for (int i = 0; i < transform.childCount; i++) + { + + TextMesh other = transform.GetChild(i).GetComponent(); + other.color = outlineColor; + other.text = textMesh.text; + other.alignment = textMesh.alignment; + other.anchor = textMesh.anchor; + other.characterSize = textMesh.characterSize; + other.font = textMesh.font; + other.fontSize = textMesh.fontSize; + other.fontStyle = textMesh.fontStyle; + other.richText = textMesh.richText; + other.tabSize = textMesh.tabSize; + other.lineSpacing = textMesh.lineSpacing; + other.offsetZ = textMesh.offsetZ; + + bool doublePixel = resolutionDependant && (Screen.width > doubleResolution || Screen.height > doubleResolution); + Vector3 pixelOffset = GetOffset(i) * (doublePixel ? 2.0f * pixelSize : pixelSize); + Vector3 worldPoint = Camera.main.ScreenToWorldPoint(screenPoint + pixelOffset); + other.transform.position = worldPoint; + + MeshRenderer otherMeshRenderer = transform.GetChild(i).GetComponent(); + otherMeshRenderer.sortingLayerID = meshRenderer.sortingLayerID; + otherMeshRenderer.sortingLayerName = meshRenderer.sortingLayerName; + } + } + + Vector3 GetOffset(int i) + { + switch (i % 8) + { + case 0: return new Vector3(0, 1, 0); + case 1: return new Vector3(1, 1, 0); + case 2: return new Vector3(1, 0, 0); + case 3: return new Vector3(1, -1, 0); + case 4: return new Vector3(0, -1, 0); + case 5: return new Vector3(-1, -1, 0); + case 6: return new Vector3(-1, 0, 0); + case 7: return new Vector3(-1, 1, 0); + default: return Vector3.zero; + } + } + } +} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Scripts/TextMeshOutline.cs.meta b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Scripts/TextMeshOutline.cs.meta new file mode 100644 index 000000000..c03d17323 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/1_DataExplorer/Scripts/TextMeshOutline.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: f9b2b4cc337b3479a9f4365ea51ff65c +timeCreated: 1525975558 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/2_ZoomableMap/ZoomableMap.unity b/sdkproject/Assets/Mapbox/Examples/2_ZoomableMap/ZoomableMap.unity index c5ca57abf..8b5646ad8 100644 --- a/sdkproject/Assets/Mapbox/Examples/2_ZoomableMap/ZoomableMap.unity +++ b/sdkproject/Assets/Mapbox/Examples/2_ZoomableMap/ZoomableMap.unity @@ -218,62 +218,62 @@ Prefab: - target: {fileID: 224907993215804030, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224907993215804030, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchoredPosition.x - value: 116.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchoredPosition.y - value: -56.40388 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_SizeDelta.x - value: 213 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_SizeDelta.y - value: 92.80776 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224857786874416376, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_SizeDelta.y - value: 112.80776 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224907856650798614, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224907856650798614, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224907856650798614, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_SizeDelta.x - value: -17 + value: 0 objectReference: {fileID: 0} - target: {fileID: 114603753021256032, guid: 98be219873e6d4dffb5949746f515a33, type: 2} @@ -447,7 +447,7 @@ MonoBehaviour: disposeBuffer: 0 placementOptions: placementType: 1 - snapMapToZero: 0 + snapMapToZero: 1 scalingOptions: scalingType: 1 unityTileSize: 100 @@ -494,9 +494,34 @@ MonoBehaviour: wallMaterial: {fileID: 0} _vectorData: _layerProperty: - sourceType: 3 + tileJsonData: + tileJSONLoaded: 0 + LayerDisplayNames: + - admin + - aeroway + - airport_label + - barrier_line + - building + - country_label + - housenum_label + - landuse + - landuse_overlay + - marine_label + - motorway_junction + - mountain_peak_label + - place_label + - poi_label + - rail_station_label + - road + - road_label + - state_label + - water + - water_label + - waterway + - waterway_label + _sourceType: 1 sourceOptions: - isActive: 0 + isActive: 1 layerSource: Name: Mapbox Streets Id: mapbox.mapbox-streets-v7 @@ -512,6 +537,7 @@ MonoBehaviour: isEnabled: 1 entityPerCoroutine: 20 vectorSubLayers: [] + locationPrefabList: [] _tileProvider: {fileID: 0} --- !u!4 &555018384 Transform: @@ -662,42 +688,42 @@ Prefab: - target: {fileID: 224771389989224222, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_AnchorMax.x - value: 0.8 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224771389989224222, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224722295744740158, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_AnchorMin.x - value: 0.8 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224722295744740158, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_AnchorMax.x - value: 0.8 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224722295744740158, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224178813210018432, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224178813210018432, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224178813210018432, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_AnchoredPosition.x - value: 127.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224178813210018432, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} @@ -707,7 +733,7 @@ Prefab: - target: {fileID: 224178813210018432, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_SizeDelta.x - value: 231 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224178813210018432, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} @@ -717,17 +743,17 @@ Prefab: - target: {fileID: 224538534500426518, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224538534500426518, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224538534500426518, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_AnchoredPosition.x - value: 127.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224538534500426518, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} @@ -737,7 +763,7 @@ Prefab: - target: {fileID: 224538534500426518, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} propertyPath: m_SizeDelta.x - value: 231 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224538534500426518, guid: 00f5bf1ff996842fc82384f8f686fda6, type: 2} diff --git a/sdkproject/Assets/Mapbox/Examples/3_Globe/Globe.unity b/sdkproject/Assets/Mapbox/Examples/3_Globe/Globe.unity index c730925a9..e833d1b59 100644 --- a/sdkproject/Assets/Mapbox/Examples/3_Globe/Globe.unity +++ b/sdkproject/Assets/Mapbox/Examples/3_Globe/Globe.unity @@ -243,7 +243,7 @@ Prefab: - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchoredPosition.y - value: -76.65533 + value: -73.557945 objectReference: {fileID: 0} - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} @@ -253,12 +253,12 @@ Prefab: - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_SizeDelta.y - value: 133.31065 + value: 127.11589 objectReference: {fileID: 0} - target: {fileID: 224857786874416376, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_SizeDelta.y - value: 153.31065 + value: 147.11589 objectReference: {fileID: 0} - target: {fileID: 224907856650798614, guid: 98be219873e6d4dffb5949746f515a33, type: 2} @@ -287,7 +287,7 @@ Prefab: - target: {fileID: 224857786874416376, guid: 98be219873e6d4dffb5949746f515a33, type: 2} propertyPath: m_AnchoredPosition.y - value: -0.000015258789 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 98be219873e6d4dffb5949746f515a33, type: 2} @@ -647,7 +647,10 @@ MonoBehaviour: wallMaterial: {fileID: 0} _vectorData: _layerProperty: - sourceType: 3 + tileJsonData: + tileJSONLoaded: 0 + LayerDisplayNames: [] + _sourceType: 1 sourceOptions: isActive: 0 layerSource: @@ -665,6 +668,7 @@ MonoBehaviour: isEnabled: 1 entityPerCoroutine: 20 vectorSubLayers: [] + locationPrefabList: [] _tileProvider: {fileID: 1461465689} --- !u!4 &1461465688 Transform: @@ -701,7 +705,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c9407d2a4576149b18a84d9addc9c8a4, type: 3} m_Name: m_EditorClassIdentifier: - _globeFactory: {fileID: 11400000, guid: 6dee93d9a198a4699800e20d1e1ea6b6, type: 2} + _map: {fileID: 1461465687} _locations: - 37.7648, -122.463 - 40.7825, -73.966111111111 @@ -847,6 +851,10 @@ Prefab: value: objectReference: {fileID: 11400000, guid: da299adc49d7140ffbce3aa9e794407c, type: 2} + - target: {fileID: 1393483683185582, guid: b95c449128f3b44bca8b83258c669aa5, type: 2} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: b95c449128f3b44bca8b83258c669aa5, type: 2} m_IsPrefabParent: 0 diff --git a/sdkproject/Assets/Mapbox/Examples/3_Globe/Scripts/SpawnOnGlobeExample.cs b/sdkproject/Assets/Mapbox/Examples/3_Globe/Scripts/SpawnOnGlobeExample.cs index 3874dc9ac..c549ddb27 100644 --- a/sdkproject/Assets/Mapbox/Examples/3_Globe/Scripts/SpawnOnGlobeExample.cs +++ b/sdkproject/Assets/Mapbox/Examples/3_Globe/Scripts/SpawnOnGlobeExample.cs @@ -3,11 +3,13 @@ using UnityEngine; using Mapbox.Unity.MeshGeneration.Factories; using Mapbox.Unity.Utilities; + using Mapbox.Unity.MeshGeneration.Factories.TerrainStrategies; + using Mapbox.Unity.Map; public class SpawnOnGlobeExample : MonoBehaviour { [SerializeField] - FlatSphereTerrainFactory _globeFactory; + AbstractMap _map; [SerializeField] [Geocode] @@ -25,7 +27,8 @@ void Start() { var instance = Instantiate(_markerPrefab); var location = Conversions.StringToLatLon(locationString); - instance.transform.position = Conversions.GeoToWorldGlobePosition(location, _globeFactory.Radius); + var earthRadius = (_map.Terrain.LayerProperty as ElevationLayerProperties).modificationOptions.earthRadius; + instance.transform.position = Conversions.GeoToWorldGlobePosition(location, earthRadius); instance.transform.localScale = Vector3.one * _spawnScale; instance.transform.SetParent(transform); } diff --git a/sdkproject/Assets/Mapbox/Examples/5_Playground/Materials.meta b/sdkproject/Assets/Mapbox/Examples/5_Playground/Materials.meta new file mode 100644 index 000000000..b4884f3ef --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/5_Playground/Materials.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: bd59039d9bee14a6f90b5544ce66788a +folderAsset: yes +timeCreated: 1525982888 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/5_Playground/Materials/HeadingMat.mat b/sdkproject/Assets/Mapbox/Examples/5_Playground/Materials/HeadingMat.mat new file mode 100644 index 000000000..618e31ba2 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/5_Playground/Materials/HeadingMat.mat @@ -0,0 +1,77 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: HeadingMat + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _ALPHATEST_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2450 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 1 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.11724138, g: 1, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/sdkproject/Assets/Mapbox/Examples/_sharedModules/FlatTerrainFactory.asset.meta b/sdkproject/Assets/Mapbox/Examples/5_Playground/Materials/HeadingMat.mat.meta similarity index 50% rename from sdkproject/Assets/Mapbox/Examples/_sharedModules/FlatTerrainFactory.asset.meta rename to sdkproject/Assets/Mapbox/Examples/5_Playground/Materials/HeadingMat.mat.meta index 0a9cf819f..05a7e640f 100644 --- a/sdkproject/Assets/Mapbox/Examples/_sharedModules/FlatTerrainFactory.asset.meta +++ b/sdkproject/Assets/Mapbox/Examples/5_Playground/Materials/HeadingMat.mat.meta @@ -1,8 +1,10 @@ fileFormatVersion: 2 -guid: 6b6c6a798b018ed449bccff86fbf6fd8 -timeCreated: 1502761717 +guid: 0ac9a851f526145d988d06970008482d +timeCreated: 1524792279 licenseType: Pro NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 userData: assetBundleName: assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/5_Playground/Scenes/LocationProvider.unity b/sdkproject/Assets/Mapbox/Examples/5_Playground/Scenes/LocationProvider.unity new file mode 100644 index 000000000..dc0d8ba69 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/5_Playground/Scenes/LocationProvider.unity @@ -0,0 +1,1477 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 8 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.4465785, g: 0.49641252, b: 0.574817, a: 1} +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 9 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &295714336 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 295714338} + - component: {fileID: 295714337} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &295714337 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 295714336} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 0.5 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &295714338 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 295714336} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &314272577 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 314272578} + - component: {fileID: 314272579} + m_Layer: 0 + m_Name: EditorLocationArrayProvider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &314272578 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 314272577} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1908994634} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &314272579 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 314272577} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6b5c815d91f9d4c3690891f3ed4c3162, type: 3} + m_Name: + m_EditorClassIdentifier: + _accuracy: 5 + _autoFireEvent: 1 + _updateInterval: 1 + _sendEvent: 0 + _latitudeLongitude: + - 48.859489, 2.32000 + - 48.859489, 2.32015 + - 48.859489, 2.32030 + - 48.859489, 2.32045 + - 48.859489, 2.32060 + _heading: 112 +--- !u!1 &424127797 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 424127798} + - component: {fileID: 424127800} + - component: {fileID: 424127799} + m_Layer: 5 + m_Name: LocationProviderLogText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &424127798 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 424127797} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1304608539} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &424127799 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 424127797} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: waiting on location provider ... +--- !u!222 &424127800 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 424127797} +--- !u!1 &536971210 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 536971212} + - component: {fileID: 536971211} + m_Layer: 0 + m_Name: LogLocationProviderData + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &536971211 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 536971210} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1e59fc6e7b8a20469944d48968f397f, type: 3} + m_Name: + m_EditorClassIdentifier: + _logText: {fileID: 424127799} +--- !u!4 &536971212 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 536971210} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -19.623516, y: 0, z: -1.3808823} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &541353170 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 541353175} + - component: {fileID: 541353174} + - component: {fileID: 541353173} + - component: {fileID: 541353172} + - component: {fileID: 541353171} + m_Layer: 0 + m_Name: Position + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &541353171 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 541353170} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9ae53785b0839d54aae88d6fc40b8f7a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!23 &541353172 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 541353170} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: d55ccb0db00e54a1696c1e96094d706d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!135 &541353173 +SphereCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 541353170} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &541353174 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 541353170} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &541353175 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 541353170} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 561771269} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &561771267 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 561771269} + m_Layer: 0 + m_Name: Player + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &561771269 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 561771267} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 541353175} + - {fileID: 1383156768} + - {fileID: 1972204561} + - {fileID: 1390435045} + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &849657520 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 849657522} + - component: {fileID: 849657521} + m_Layer: 0 + m_Name: DefaultDeviceLocationProvider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &849657521 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 849657520} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0a38712e93231418a84665190b8473d0, type: 3} + m_Name: + m_EditorClassIdentifier: + _desiredAccuracyInMeters: 100 + _updateDistanceInMeters: 0 + _updateTimeInMilliSeconds: 1000 +--- !u!4 &849657522 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 849657520} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1908994634} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1304608535 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1304608539} + - component: {fileID: 1304608538} + - component: {fileID: 1304608537} + - component: {fileID: 1304608536} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1304608536 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1304608535} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1304608537 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1304608535} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 400 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 600, y: 800} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 441 + m_DefaultSpriteDPI: 441 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &1304608538 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1304608535} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1304608539 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1304608535} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 424127798} + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1363590662 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1363590664} + - component: {fileID: 1363590663} + m_Layer: 0 + m_Name: EditorGpsLogLocationProvider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1363590663 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1363590662} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b7aa6be6e90405940b281e996bcb2f20, type: 3} + m_Name: + m_EditorClassIdentifier: + _accuracy: 5 + _autoFireEvent: 1 + _updateInterval: 1 + _sendEvent: 0 + _gpsLogFile: {fileID: 4900000, guid: b9abe7d031734c34e83d93fc4b21fa58, type: 3} +--- !u!4 &1363590664 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1363590662} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1908994634} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1383156764 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1383156768} + - component: {fileID: 1383156767} + - component: {fileID: 1383156766} + - component: {fileID: 1383156765} + - component: {fileID: 1383156769} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1383156765 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1383156764} + m_Enabled: 1 +--- !u!124 &1383156766 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1383156764} + m_Enabled: 1 +--- !u!20 &1383156767 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1383156764} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1383156768 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1383156764} + m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 50, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 561771269} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} +--- !u!114 &1383156769 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1383156764} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 061d2afb48ace4fd19611279b6cf732f, type: 3} + m_Name: + m_EditorClassIdentifier: + _useDeviceOrientation: 0 + _subtractUserHeading: 0 + _rotationFollowFactor: 2 + _rotateZ: 0 + _useNegativeAngle: 0 + _useTransformLocationProvider: 0 +--- !u!1 &1390435044 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1390435045} + - component: {fileID: 1390435050} + - component: {fileID: 1390435049} + - component: {fileID: 1390435048} + - component: {fileID: 1390435047} + m_Layer: 0 + m_Name: UserHeading + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1390435045 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1390435044} + m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 1.1, z: 0} + m_LocalScale: {x: 1, y: 1.0000005, z: 1.0000005} + m_Children: [] + m_Father: {fileID: 561771269} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} +--- !u!114 &1390435047 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1390435044} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9ae53785b0839d54aae88d6fc40b8f7a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!23 &1390435048 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1390435044} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: 0ac9a851f526145d988d06970008482d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1390435049 +MeshCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1390435044} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1390435050 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1390435044} + m_Mesh: {fileID: 1856438662} +--- !u!1 &1411663280 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1411663282} + - component: {fileID: 1411663281} + - component: {fileID: 1411663284} + - component: {fileID: 1411663283} + - component: {fileID: 1411663286} + m_Layer: 0 + m_Name: Map + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1411663281 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1411663280} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cd961b1c9541a4cee99686069ecce852, type: 3} + m_Name: + m_EditorClassIdentifier: + _initializeOnStart: 0 + _options: + locationOptions: + latitudeLongitude: 48.85825,2.29450 + zoom: 16 + extentOptions: + extentType: 1 + cameraBoundsOptions: + camera: {fileID: 1383156767} + visibleBuffer: 0 + disposeBuffer: 0 + updateInterval: 0 + rangeAroundCenterOptions: + west: 1 + north: 1 + east: 1 + south: 1 + rangeAroundTransformOptions: + targetTransform: {fileID: 0} + visibleBuffer: 0 + disposeBuffer: 0 + placementOptions: + placementType: 1 + snapMapToZero: 1 + scalingOptions: + scalingType: 1 + unityTileSize: 100 + loadingTexture: {fileID: 2800000, guid: e2896a92727704803a9c422b043eae89, type: 3} + _imagery: + _layerProperty: + sourceType: 0 + sourceOptions: + isActive: 1 + layerSource: + Name: Streets + Id: mapbox://styles/mapbox/streets-v10 + Modified: + UserName: + rasterOptions: + useRetina: 1 + useCompression: 0 + useMipMap: 0 + _terrain: + _layerProperty: + sourceType: 0 + sourceOptions: + isActive: 1 + layerSource: + Name: + Id: mapbox.terrain-rgb + Modified: + UserName: + elevationLayerType: 0 + requiredOptions: + baseMaterial: {fileID: 2100000, guid: b9f23e9bce724fa4daac57ecded470b8, type: 2} + addCollider: 0 + exaggerationFactor: 1 + modificationOptions: + sampleCount: 10 + useRelativeHeight: 0 + earthRadius: 1000 + unityLayerOptions: + addToLayer: 0 + layerId: 0 + sideWallOptions: + isActive: 0 + wallHeight: 10 + wallMaterial: {fileID: 0} + _vectorData: + _layerProperty: + tileJsonData: + tileJSONLoaded: 0 + LayerDisplayNames: [] + _sourceType: 1 + sourceOptions: + isActive: 1 + layerSource: + Name: Mapbox Streets + Id: mapbox.mapbox-streets-v7 + Modified: + UserName: + useOptimizedStyle: 0 + optimizedStyle: + Name: + Id: + Modified: + UserName: + performanceOptions: + isEnabled: 1 + entityPerCoroutine: 20 + vectorSubLayers: [] + locationPrefabList: [] + _tileProvider: {fileID: 0} +--- !u!4 &1411663282 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1411663280} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1411663283 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1411663280} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b45b6cb0c94914eb6a1fac86abfc6aba, type: 3} + m_Name: + m_EditorClassIdentifier: + _map: {fileID: 1411663281} + timeTakenDuringLerp: 1 +--- !u!114 &1411663284 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1411663280} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 96f0fa82f89d64bb9a6524c72d538179, type: 3} + m_Name: + m_EditorClassIdentifier: + _map: {fileID: 1411663281} +--- !u!114 &1411663286 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1411663280} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 061d2afb48ace4fd19611279b6cf732f, type: 3} + m_Name: + m_EditorClassIdentifier: + _useDeviceOrientation: 0 + _subtractUserHeading: 0 + _rotationFollowFactor: 2 + _rotateZ: 0 + _useNegativeAngle: 1 + _useTransformLocationProvider: 0 +--- !u!1 &1830401241 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1830401243} + - component: {fileID: 1830401242} + m_Layer: 0 + m_Name: TransformLocationProvider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1830401242 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1830401241} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a034c4eeb3293418aab101c1895844a4, type: 3} + m_Name: + m_EditorClassIdentifier: + _accuracy: 0 + _autoFireEvent: 0 + _updateInterval: 0 + _sendEvent: 0 + _targetTransform: {fileID: 1411663282} +--- !u!4 &1830401243 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1830401241} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1908994634} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!43 &1856438662 +Mesh: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Quad Instance + serializedVersion: 8 + m_SubMeshes: + - serializedVersion: 2 + firstByte: 0 + indexCount: 6 + topology: 0 + baseVertex: 0 + firstVertex: 0 + vertexCount: 4 + localAABB: + m_Center: {x: 0, y: 0.125, z: 0} + m_Extent: {x: 0.5, y: 1.375, z: 0} + m_Shapes: + vertices: [] + shapes: [] + channels: [] + fullWeights: [] + m_BindPose: [] + m_BoneNameHashes: + m_RootBoneNameHash: 0 + m_MeshCompression: 0 + m_IsReadable: 1 + m_KeepVertices: 1 + m_KeepIndices: 1 + m_IndexFormat: 0 + m_IndexBuffer: 000001000200010000000300 + m_Skin: [] + m_VertexData: + m_CurrentChannels: 139 + m_VertexCount: 4 + m_Channels: + - stream: 0 + offset: 0 + format: 0 + dimension: 3 + - stream: 0 + offset: 12 + format: 0 + dimension: 3 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 24 + format: 0 + dimension: 2 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 32 + format: 0 + dimension: 4 + m_DataSize: 192 + _typelessdata: 000000bf0000a0bf000000000000000000000000000080bf00000000000000000000803f0000000000000000000080bf000000000000c03f000000800000000000000000000080bf0000803f0000803f0000803f0000000000000000000080bf0000003f0000a0bf000000000000000000000000000080bf0000803f000000000000803f0000000000000000000080bf000000000000c03f00000080000000000000000000000000000000000000803f0000803f0000000000000000000080bf + m_CompressedMesh: + m_Vertices: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_UV: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_Normals: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_Tangents: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_Weights: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_NormalSigns: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_TangentSigns: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_FloatColors: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_BoneIndices: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_Triangles: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_UVInfo: 0 + m_LocalAABB: + m_Center: {x: 0, y: 0.125, z: 0} + m_Extent: {x: 0.5, y: 1.375, z: 0} + m_MeshUsageFlags: 0 + m_BakedConvexCollisionMesh: + m_BakedTriangleCollisionMesh: + m_MeshOptimized: 1 +--- !u!1 &1908994629 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1908994634} + - component: {fileID: 1908994633} + m_Layer: 0 + m_Name: LocationProviderFactory + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1908994633 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1908994629} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b55f37f9a6f7e44f7bb35e6bc3863847, type: 3} + m_Name: + m_EditorClassIdentifier: + mapManager: {fileID: 1411663281} + _deviceLocationProviderUnity: {fileID: 849657521} + _deviceLocationProviderAndroid: {fileID: 2054056459} + _editorLocationProvider: {fileID: 1363590663} + _transformLocationProvider: {fileID: 1830401242} + _dontDestroyOnLoad: 0 +--- !u!4 &1908994634 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1908994629} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -18.677399, y: 12.257265, z: 21.646572} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 849657522} + - {fileID: 314272578} + - {fileID: 1830401243} + - {fileID: 2054056460} + - {fileID: 1363590664} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1972204560 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1972204561} + - component: {fileID: 1972204564} + - component: {fileID: 1972204563} + - component: {fileID: 1972204562} + - component: {fileID: 1972204565} + - component: {fileID: 1972204566} + m_Layer: 0 + m_Name: DeviceOrientation + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1972204561 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1972204560} + m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 1, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 561771269} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} +--- !u!23 &1972204562 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1972204560} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: 0de83c8715792fe43aceecafcdbd8b24, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1972204563 +MeshCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1972204560} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1972204564 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1972204560} + m_Mesh: {fileID: 1856438662} +--- !u!114 &1972204565 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1972204560} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9ae53785b0839d54aae88d6fc40b8f7a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1972204566 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1972204560} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 061d2afb48ace4fd19611279b6cf732f, type: 3} + m_Name: + m_EditorClassIdentifier: + _useDeviceOrientation: 1 + _subtractUserHeading: 1 + _rotationFollowFactor: 2 + _rotateZ: 0 + _useNegativeAngle: 0 + _useTransformLocationProvider: 0 +--- !u!1 &2032640978 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 2032640981} + - component: {fileID: 2032640980} + - component: {fileID: 2032640979} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2032640979 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2032640978} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &2032640980 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2032640978} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &2032640981 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2032640978} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2054056458 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 2054056460} + - component: {fileID: 2054056459} + m_Layer: 0 + m_Name: AndroidDeviceLocationProvider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2054056459 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2054056458} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d3d557417079b1446999d2d86ff71dfb, type: 3} + m_Name: + m_EditorClassIdentifier: + _updateDistanceInMeters: 0 + _updateTimeInMilliSeconds: 500 +--- !u!4 &2054056460 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2054056458} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1908994634} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/sdkproject/Assets/Mapbox/Examples/5_Playground/Scenes/LocationProvider.unity.meta b/sdkproject/Assets/Mapbox/Examples/5_Playground/Scenes/LocationProvider.unity.meta new file mode 100644 index 000000000..ccde1d419 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/5_Playground/Scenes/LocationProvider.unity.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 12e74a80942ad194fb4ddd66ed099b5b +timeCreated: 1524215094 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/5_Playground/Scripts/LogLocationProviderData.cs b/sdkproject/Assets/Mapbox/Examples/5_Playground/Scripts/LogLocationProviderData.cs new file mode 100644 index 000000000..49839ebee --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/5_Playground/Scripts/LogLocationProviderData.cs @@ -0,0 +1,77 @@ +namespace Mapbox.Examples.Scripts +{ + using Mapbox.Unity.Location; + using Mapbox.Utils; + using System; + using System.Collections; + using System.Collections.Generic; + using System.Globalization; + using System.Text; + using UnityEngine; + using UnityEngine.UI; + + public class LogLocationProviderData : MonoBehaviour + { + + [SerializeField] + private Text _logText; + + + private CultureInfo _invariantCulture = CultureInfo.InvariantCulture; + + + // Use this for initialization + void Start() + { + LocationProviderFactory.Instance.DefaultLocationProvider.OnLocationUpdated += LocationProvider_OnLocationUpdated; + } + + + void OnDestroy() + { + LocationProviderFactory.Instance.DefaultLocationProvider.OnLocationUpdated -= LocationProvider_OnLocationUpdated; + } + + + void LocationProvider_OnLocationUpdated(Location location) + { + StringBuilder sb = new StringBuilder(); + + sb.AppendLine(string.Format("IsLocationServiceEnabled: {0}", location.IsLocationServiceEnabled)); + sb.AppendLine(string.Format("IsLocationServiceInitializing: {0}", location.IsLocationServiceInitializing)); + sb.AppendLine(string.Format("IsLocationUpdated: {0}", location.IsLocationUpdated)); + sb.AppendLine(string.Format("IsHeadingUpdated: {0}", location.IsUserHeadingUpdated)); + string locationProviderClass = LocationProviderFactory.Instance.DefaultLocationProvider.GetType().Name; + sb.AppendLine(string.Format("location provider: {0} ({1})", location.Provider, locationProviderClass)); + sb.AppendLine(string.Format("UTC time:{0} - device: {1}{0} - location:{2}", Environment.NewLine, DateTime.UtcNow.ToString("yyyyMMdd HHmmss"), UnixTimestampUtils.From(location.Timestamp).ToString("yyyyMMdd HHmmss"))); + sb.AppendLine(string.Format(_invariantCulture, "position: {0:0.00000000} / {1:0.00000000}", location.LatitudeLongitude.x, location.LatitudeLongitude.y)); + sb.AppendLine(string.Format(_invariantCulture, "accuracy: {0:0.0}m", location.Accuracy)); + sb.AppendLine(string.Format(_invariantCulture, "user heading: {0:0.0}°", location.UserHeading)); + sb.AppendLine(string.Format(_invariantCulture, "device orientation: {0:0.0}°", location.DeviceOrientation)); + sb.AppendLine(nullableAsStr(location.SpeedKmPerHour, "speed: {0:0.0}km/h")); + sb.AppendLine(nullableAsStr(location.HasGpsFix, "HasGpsFix: {0}")); + sb.AppendLine(nullableAsStr(location.SatellitesUsed, "SatellitesUsed:{0} ") + nullableAsStr(location.SatellitesInView, "SatellitesInView:{0}")); + + _logText.text = sb.ToString(); + } + + + private string nullableAsStr(T? val, string formatString = null) where T : struct + { + if (null == val && null == formatString) { return "[not supported by provider]"; } + if (null == val && null != formatString) { return string.Format(_invariantCulture, formatString, "[not supported by provider]"); } + if (null != val && null == formatString) { return val.Value.ToString(); } + return string.Format(_invariantCulture, formatString, val); + } + + + // Update is called once per frame + void Update() + { + + } + + + + } +} diff --git a/sdkproject/Assets/Mapbox/Examples/5_Playground/Scripts/LogLocationProviderData.cs.meta b/sdkproject/Assets/Mapbox/Examples/5_Playground/Scripts/LogLocationProviderData.cs.meta new file mode 100644 index 000000000..3e14eee9e --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/5_Playground/Scripts/LogLocationProviderData.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: b1e59fc6e7b8a20469944d48968f397f +timeCreated: 1524490509 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement.meta new file mode 100644 index 000000000..e10dcb48b --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b2a92e3867dce4a86bc35292a11d246a +folderAsset: yes +timeCreated: 1525985177 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers.meta new file mode 100644 index 000000000..e1b9fbb9d --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: eb0c09a0a3cf9406386943cdbecbf362 +folderAsset: yes +timeCreated: 1524001615 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/_sharedModules/FlatTerrainFactory.asset b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ArtsPoiLabelModifier.asset similarity index 51% rename from sdkproject/Assets/Mapbox/Examples/_sharedModules/FlatTerrainFactory.asset rename to sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ArtsPoiLabelModifier.asset index 92496026e..e36ac5c91 100644 --- a/sdkproject/Assets/Mapbox/Examples/_sharedModules/FlatTerrainFactory.asset +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ArtsPoiLabelModifier.asset @@ -8,10 +8,10 @@ MonoBehaviour: m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0a6523094c07d4ee683da5d826fce510, type: 3} - m_Name: FlatTerrainFactory + m_Script: {fileID: 11500000, guid: dd8aacc1880ff504d9531b4d61c86458, type: 3} + m_Name: ArtsPoiLabelModifier m_EditorClassIdentifier: - _baseMaterial: {fileID: 2100000, guid: b9f23e9bce724fa4daac57ecded470b8, type: 2} - _addCollider: 0 - _addToLayer: 0 - _layerId: 0 + Active: 1 + _options: + prefab: {fileID: 1707885508695930, guid: 29d1abf5ba6514d81a7974353f130ca8, type: 2} + scaleDownWithWorld: 1 diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ArtsPoiLabelModifier.asset.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ArtsPoiLabelModifier.asset.meta new file mode 100644 index 000000000..ad1f05ebe --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ArtsPoiLabelModifier.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 4aeb61055bc3e481795eabb6cbf767f0 +timeCreated: 1523481480 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/DefaultPoiLabelModifier.asset b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/DefaultPoiLabelModifier.asset new file mode 100644 index 000000000..56eab5dbd --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/DefaultPoiLabelModifier.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dd8aacc1880ff504d9531b4d61c86458, type: 3} + m_Name: DefaultPoiLabelModifier + m_EditorClassIdentifier: + Active: 1 + _options: + prefab: {fileID: 1707885508695930, guid: d748e6a0b26334f4d933c1438339484d, type: 2} + scaleDownWithWorld: 1 diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/DefaultPoiLabelModifier.asset.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/DefaultPoiLabelModifier.asset.meta new file mode 100644 index 000000000..e56b7b325 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/DefaultPoiLabelModifier.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 7b125502e39484477998874eb8af79b6 +timeCreated: 1523481480 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/FoodPoiLabelModifier.asset b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/FoodPoiLabelModifier.asset new file mode 100644 index 000000000..2221f6661 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/FoodPoiLabelModifier.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dd8aacc1880ff504d9531b4d61c86458, type: 3} + m_Name: FoodPoiLabelModifier + m_EditorClassIdentifier: + Active: 1 + _options: + prefab: {fileID: 1707885508695930, guid: fafbd32423ea04e379d8321b4d370fea, type: 2} + scaleDownWithWorld: 1 diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/FoodPoiLabelModifier.asset.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/FoodPoiLabelModifier.asset.meta new file mode 100644 index 000000000..1ccddd271 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/FoodPoiLabelModifier.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 8ee9ac4689ba548d585a1f37049fc88e +timeCreated: 1523481480 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/NightlifePoiLabelModifier.asset b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/NightlifePoiLabelModifier.asset new file mode 100644 index 000000000..7ef1b9db9 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/NightlifePoiLabelModifier.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dd8aacc1880ff504d9531b4d61c86458, type: 3} + m_Name: NightlifePoiLabelModifier + m_EditorClassIdentifier: + Active: 1 + _options: + prefab: {fileID: 1707885508695930, guid: 61bcd2d324dd34bb9b722d856749c28c, type: 2} + scaleDownWithWorld: 1 diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/NightlifePoiLabelModifier.asset.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/NightlifePoiLabelModifier.asset.meta new file mode 100644 index 000000000..5c81024ca --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/NightlifePoiLabelModifier.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 0a171c045131a40e9bffc2832091a08d +timeCreated: 1523481480 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/OutdoorPoiLabelModifier.asset b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/OutdoorPoiLabelModifier.asset new file mode 100644 index 000000000..d08ae9971 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/OutdoorPoiLabelModifier.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dd8aacc1880ff504d9531b4d61c86458, type: 3} + m_Name: OutdoorPoiLabelModifier + m_EditorClassIdentifier: + Active: 1 + _options: + prefab: {fileID: 1707885508695930, guid: b0e54a880e97f4c5ead7dcc1c0918e05, type: 2} + scaleDownWithWorld: 1 diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/OutdoorPoiLabelModifier.asset.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/OutdoorPoiLabelModifier.asset.meta new file mode 100644 index 000000000..2af2d8de6 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/OutdoorPoiLabelModifier.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 01f07cb46320549b5bcda51ff47f52ce +timeCreated: 1523481480 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ServicePoiLabelModifier.asset b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ServicePoiLabelModifier.asset new file mode 100644 index 000000000..48825442d --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ServicePoiLabelModifier.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dd8aacc1880ff504d9531b4d61c86458, type: 3} + m_Name: ServicePoiLabelModifier + m_EditorClassIdentifier: + Active: 1 + _options: + prefab: {fileID: 1707885508695930, guid: 60a41cfc23d514878814f0d425912eff, type: 2} + scaleDownWithWorld: 1 diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ServicePoiLabelModifier.asset.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ServicePoiLabelModifier.asset.meta new file mode 100644 index 000000000..567df2b02 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ServicePoiLabelModifier.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: bdbde0a2dd0ce4ec89c8cfe967a1f456 +timeCreated: 1523481480 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ShopPoiLabelModifier.asset b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ShopPoiLabelModifier.asset new file mode 100644 index 000000000..4ff312e32 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ShopPoiLabelModifier.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dd8aacc1880ff504d9531b4d61c86458, type: 3} + m_Name: ShopPoiLabelModifier + m_EditorClassIdentifier: + Active: 1 + _options: + prefab: {fileID: 1707885508695930, guid: 49bc5d782d9184533a37abea20ed30e4, type: 2} + scaleDownWithWorld: 1 diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ShopPoiLabelModifier.asset.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ShopPoiLabelModifier.asset.meta new file mode 100644 index 000000000..baa5370f7 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/ShopPoiLabelModifier.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 535e01727644e411f852954088a59281 +timeCreated: 1523481480 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/TransportationPoiLabelModifier.asset b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/TransportationPoiLabelModifier.asset new file mode 100644 index 000000000..66295d38e --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/TransportationPoiLabelModifier.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dd8aacc1880ff504d9531b4d61c86458, type: 3} + m_Name: TransportationPoiLabelModifier + m_EditorClassIdentifier: + Active: 1 + _options: + prefab: {fileID: 1707885508695930, guid: 22150daba6e8b47b69fd30f00b9c56cd, type: 2} + scaleDownWithWorld: 1 diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/TransportationPoiLabelModifier.asset.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/TransportationPoiLabelModifier.asset.meta new file mode 100644 index 000000000..87939389b --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Modifiers/TransportationPoiLabelModifier.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b6825aebfa29f44be9c0d3c374a66d90 +timeCreated: 1523481480 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacement.unity b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacement.unity new file mode 100644 index 000000000..6e3837f85 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacement.unity @@ -0,0 +1,2421 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 8 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.4465785, g: 0.49641252, b: 0.574817, a: 1} +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 9 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &139836602 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224557595208707984, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114103084892184410, guid: b95c449128f3b44bca8b83258c669aa5, + type: 2} + propertyPath: MapVisualizer + value: + objectReference: {fileID: 11400000, guid: 02a98fd6de7af4e4985b970acb849e8b, + type: 2} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: b95c449128f3b44bca8b83258c669aa5, type: 2} + m_IsPrefabParent: 0 +--- !u!1 &150549877 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 150549879} + - component: {fileID: 150549878} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &150549878 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 150549877} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &150549879 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 150549877} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &292492997 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1291234444091486, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 292492998} + - component: {fileID: 292493000} + - component: {fileID: 292492999} + m_Layer: 5 + m_Name: Fill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &292492998 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224771389989224222, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 292492997} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 650732809} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0.8, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 10, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &292492999 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114848192389514190, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 292492997} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &292493000 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 222371227108701474, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 292492997} +--- !u!1 &331047608 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1130209808532952, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 331047609} + m_Layer: 5 + m_Name: Handle Slide Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &331047609 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224885144614080300, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 331047608} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2086915429} + m_Father: {fileID: 1025723466} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &621795784 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 621795785} + - component: {fileID: 621795786} + m_Layer: 0 + m_Name: LabelCamera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &621795785 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 621795784} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1681481106} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 37.510002, y: 0, z: 0} +--- !u!20 &621795786 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 621795784} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 3 + m_BackGroundColor: {r: 0.13235295, g: 0.13235295, b: 0.13235295, a: 1} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 10 + far clip plane: 2000 + field of view: 10 + orthographic: 0 + orthographic size: 143.6 + m_Depth: 1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 1024 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 1 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!1 &650732808 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1599729465296294, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 650732809} + m_Layer: 5 + m_Name: Fill Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &650732809 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224748083790024428, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650732808} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 292492998} + m_Father: {fileID: 1025723466} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: -5, y: 0} + m_SizeDelta: {x: -20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1001 &702758391 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224000013044306136, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, + type: 2} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 3adcee2515f8c49f4a7afb3bacf2c56e, type: 2} + m_IsPrefabParent: 0 +--- !u!1 &790657048 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1768860123691022, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 790657049} + - component: {fileID: 790657051} + - component: {fileID: 790657050} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &790657049 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224917229095272750, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 790657048} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1025723466} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &790657050 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114517333868574894, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 790657048} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &790657051 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 222359169490577362, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 790657048} +--- !u!1001 &876292442 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 224907993215804030, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224907993215804030, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224907993215804030, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_RootOrder + value: 6 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224315790701160254, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224835413515161394, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224857786874416376, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224907856650798614, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224907856650798614, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224907856650798614, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114603753021256032, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_Text + value: "POI Placement\n\nThis example showcases how to procedurally add + prefabs to a variety of locations. For example, you can choose to add prefabs + at all the cafes and restaurants in a city, at specific addresses, or at locations + with \"Starbucks\" in the name.\n\nTo get started, look at Map's Inspector + panel and open POINTS OF INTEREST in the MAP LAYERS section of the Abstract + Map component. We've already created a few prefab layers for you. Toggle them + on and off to see how they change the map. \n\nTo create your own, click \"Add + Layer\" and add the desired prefab and rules. " + objectReference: {fileID: 0} + - target: {fileID: 224857786874416376, guid: 98be219873e6d4dffb5949746f515a33, + type: 2} + propertyPath: m_AnchoredPosition.y + value: 0.000030517578 + objectReference: {fileID: 0} + - target: {fileID: 1611603657303738, guid: 98be219873e6d4dffb5949746f515a33, type: 2} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 98be219873e6d4dffb5949746f515a33, type: 2} + m_IsPrefabParent: 0 +--- !u!1 &967308905 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 967308907} + - component: {fileID: 967308906} + m_Layer: 0 + m_Name: Map + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &967308906 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 967308905} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cd961b1c9541a4cee99686069ecce852, type: 3} + m_Name: + m_EditorClassIdentifier: + _initializeOnStart: 1 + _options: + locationOptions: + latitudeLongitude: 37.784179, -122.401583 + zoom: 16 + extentOptions: + extentType: 1 + cameraBoundsOptions: + camera: {fileID: 0} + visibleBuffer: 0 + disposeBuffer: 0 + updateInterval: 0 + rangeAroundCenterOptions: + west: 1 + north: 1 + east: 1 + south: 1 + rangeAroundTransformOptions: + targetTransform: {fileID: 0} + visibleBuffer: 0 + disposeBuffer: 0 + placementOptions: + placementType: 1 + snapMapToZero: 0 + scalingOptions: + scalingType: 1 + unityTileSize: 100 + loadingTexture: {fileID: 2800000, guid: e2896a92727704803a9c422b043eae89, type: 3} + _imagery: + _layerProperty: + sourceType: 1 + sourceOptions: + isActive: 1 + layerSource: + Name: Streets + Id: mapbox://styles/mapbox/outdoors-v10 + Modified: + UserName: + rasterOptions: + useRetina: 0 + useCompression: 0 + useMipMap: 0 + _terrain: + _layerProperty: + sourceType: 0 + sourceOptions: + isActive: 1 + layerSource: + Name: + Id: mapbox.terrain-rgb + Modified: + UserName: + elevationLayerType: 1 + requiredOptions: + baseMaterial: {fileID: 2100000, guid: b9f23e9bce724fa4daac57ecded470b8, type: 2} + addCollider: 0 + exaggerationFactor: 1 + modificationOptions: + sampleCount: 10 + useRelativeHeight: 1 + earthRadius: 1000 + unityLayerOptions: + addToLayer: 0 + layerId: 0 + sideWallOptions: + isActive: 0 + wallHeight: 10 + wallMaterial: {fileID: 0} + _vectorData: + _layerProperty: + tileJsonData: + tileJSONLoaded: 0 + LayerDisplayNames: + - admin + - aeroway + - airport_label + - barrier_line + - building + - country_label + - housenum_label + - landuse + - landuse_overlay + - marine_label + - motorway_junction + - mountain_peak_label + - place_label + - poi_label + - rail_station_label + - road + - road_label + - state_label + - water + - water_label + - waterway + - waterway_label + _sourceType: 0 + sourceOptions: + isActive: 1 + layerSource: + Name: Mapbox Terrain + Id: mapbox.3d-buildings,mapbox.mapbox-streets-v7 + Modified: + UserName: + useOptimizedStyle: 0 + optimizedStyle: + Name: + Id: + Modified: + UserName: + performanceOptions: + isEnabled: 1 + entityPerCoroutine: 20 + vectorSubLayers: + - coreOptions: + isActive: 1 + sublayerName: Building + geometryType: 2 + layerName: building + snapToTerrain: 1 + groupFeatures: 0 + lineWidth: 1 + filterOptions: + _selectedLayerName: building + filters: [] + combinerType: 0 + extrusionOptions: + _selectedLayerName: building + extrusionType: 1 + extrusionGeometryType: 0 + propertyName: height + propertyDescription: + minimumHeight: 0 + maximumHeight: 0 + extrusionScaleFactor: 1 + colliderOptions: + colliderType: 0 + materialOptions: + texturingType: 3 + materials: + - Materials: + - {fileID: 2100000, guid: d4d7464e3429a44e090f55a4ac17f110, type: 2} + - Materials: + - {fileID: 2100000, guid: 55cc6edead802446b9106b2998406844, type: 2} + atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} + colorPalette: {fileID: 11400000, guid: b01b6d453d33e40119c0f9472d50c45f, + type: 2} + honorBuildingIdSetting: 1 + buildingsWithUniqueIds: 1 + moveFeaturePositionTo: 0 + MeshModifiers: [] + GoModifiers: [] + locationPrefabList: + - coreOptions: + isActive: 1 + sublayerName: Arts and Entertainment + geometryType: 0 + layerName: + snapToTerrain: 1 + groupFeatures: 0 + lineWidth: 0 + filterOptions: + _selectedLayerName: + filters: [] + combinerType: 0 + extrusionOptions: + _selectedLayerName: + extrusionType: 0 + extrusionGeometryType: 0 + propertyName: + propertyDescription: + minimumHeight: 0 + maximumHeight: 0 + extrusionScaleFactor: 0 + colliderOptions: + colliderType: 0 + materialOptions: + texturingType: 0 + materials: [] + atlasInfo: {fileID: 0} + colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 + buildingsWithUniqueIds: 0 + moveFeaturePositionTo: 0 + MeshModifiers: [] + GoModifiers: [] + spawnPrefabOptions: + prefab: {fileID: 1707885508695930, guid: 29d1abf5ba6514d81a7974353f130ca8, + type: 2} + scaleDownWithWorld: 1 + findByType: 0 + categories: 1 + nameString: + coordinates: [] + density: 15 + - coreOptions: + isActive: 1 + sublayerName: Food + geometryType: 0 + layerName: + snapToTerrain: 1 + groupFeatures: 0 + lineWidth: 0 + filterOptions: + _selectedLayerName: + filters: [] + combinerType: 0 + extrusionOptions: + _selectedLayerName: + extrusionType: 0 + extrusionGeometryType: 0 + propertyName: + propertyDescription: + minimumHeight: 0 + maximumHeight: 0 + extrusionScaleFactor: 0 + colliderOptions: + colliderType: 0 + materialOptions: + texturingType: 0 + materials: [] + atlasInfo: {fileID: 0} + colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 + buildingsWithUniqueIds: 0 + moveFeaturePositionTo: 0 + MeshModifiers: [] + GoModifiers: [] + spawnPrefabOptions: + prefab: {fileID: 1707885508695930, guid: fafbd32423ea04e379d8321b4d370fea, + type: 2} + scaleDownWithWorld: 1 + findByType: 0 + categories: 2 + nameString: + coordinates: [] + density: 15 + - coreOptions: + isActive: 1 + sublayerName: Nightlife + geometryType: 0 + layerName: + snapToTerrain: 1 + groupFeatures: 0 + lineWidth: 0 + filterOptions: + _selectedLayerName: + filters: [] + combinerType: 0 + extrusionOptions: + _selectedLayerName: + extrusionType: 0 + extrusionGeometryType: 0 + propertyName: + propertyDescription: + minimumHeight: 0 + maximumHeight: 0 + extrusionScaleFactor: 0 + colliderOptions: + colliderType: 0 + materialOptions: + texturingType: 0 + materials: [] + atlasInfo: {fileID: 0} + colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 + buildingsWithUniqueIds: 0 + moveFeaturePositionTo: 0 + MeshModifiers: [] + GoModifiers: [] + spawnPrefabOptions: + prefab: {fileID: 1707885508695930, guid: 61bcd2d324dd34bb9b722d856749c28c, + type: 2} + scaleDownWithWorld: 1 + findByType: 0 + categories: 4 + nameString: + coordinates: [] + density: 15 + - coreOptions: + isActive: 1 + sublayerName: Outdoors and Recreation + geometryType: 0 + layerName: + snapToTerrain: 1 + groupFeatures: 0 + lineWidth: 0 + filterOptions: + _selectedLayerName: + filters: [] + combinerType: 0 + extrusionOptions: + _selectedLayerName: + extrusionType: 0 + extrusionGeometryType: 0 + propertyName: + propertyDescription: + minimumHeight: 0 + maximumHeight: 0 + extrusionScaleFactor: 0 + colliderOptions: + colliderType: 0 + materialOptions: + texturingType: 0 + materials: [] + atlasInfo: {fileID: 0} + colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 + buildingsWithUniqueIds: 0 + moveFeaturePositionTo: 0 + MeshModifiers: [] + GoModifiers: [] + spawnPrefabOptions: + prefab: {fileID: 1707885508695930, guid: b0e54a880e97f4c5ead7dcc1c0918e05, + type: 2} + scaleDownWithWorld: 1 + findByType: 0 + categories: 8 + nameString: + coordinates: [] + density: 15 + - coreOptions: + isActive: 1 + sublayerName: Services + geometryType: 0 + layerName: + snapToTerrain: 1 + groupFeatures: 0 + lineWidth: 0 + filterOptions: + _selectedLayerName: + filters: [] + combinerType: 0 + extrusionOptions: + _selectedLayerName: + extrusionType: 0 + extrusionGeometryType: 0 + propertyName: + propertyDescription: + minimumHeight: 0 + maximumHeight: 0 + extrusionScaleFactor: 0 + colliderOptions: + colliderType: 0 + materialOptions: + texturingType: 0 + materials: [] + atlasInfo: {fileID: 0} + colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 + buildingsWithUniqueIds: 0 + moveFeaturePositionTo: 0 + MeshModifiers: [] + GoModifiers: [] + spawnPrefabOptions: + prefab: {fileID: 1707885508695930, guid: 60a41cfc23d514878814f0d425912eff, + type: 2} + scaleDownWithWorld: 1 + findByType: 0 + categories: 16 + nameString: + coordinates: [] + density: 10 + - coreOptions: + isActive: 1 + sublayerName: Shops + geometryType: 0 + layerName: + snapToTerrain: 1 + groupFeatures: 0 + lineWidth: 0 + filterOptions: + _selectedLayerName: + filters: [] + combinerType: 0 + extrusionOptions: + _selectedLayerName: + extrusionType: 0 + extrusionGeometryType: 0 + propertyName: + propertyDescription: + minimumHeight: 0 + maximumHeight: 0 + extrusionScaleFactor: 0 + colliderOptions: + colliderType: 0 + materialOptions: + texturingType: 0 + materials: [] + atlasInfo: {fileID: 0} + colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 + buildingsWithUniqueIds: 0 + moveFeaturePositionTo: 0 + MeshModifiers: [] + GoModifiers: [] + spawnPrefabOptions: + prefab: {fileID: 1707885508695930, guid: 49bc5d782d9184533a37abea20ed30e4, + type: 2} + scaleDownWithWorld: 1 + findByType: 0 + categories: 32 + nameString: + coordinates: [] + density: 15 + - coreOptions: + isActive: 1 + sublayerName: Transportation + geometryType: 0 + layerName: + snapToTerrain: 1 + groupFeatures: 0 + lineWidth: 0 + filterOptions: + _selectedLayerName: + filters: [] + combinerType: 0 + extrusionOptions: + _selectedLayerName: + extrusionType: 0 + extrusionGeometryType: 0 + propertyName: + propertyDescription: + minimumHeight: 0 + maximumHeight: 0 + extrusionScaleFactor: 0 + colliderOptions: + colliderType: 0 + materialOptions: + texturingType: 0 + materials: [] + atlasInfo: {fileID: 0} + colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 + buildingsWithUniqueIds: 0 + moveFeaturePositionTo: 0 + MeshModifiers: [] + GoModifiers: [] + spawnPrefabOptions: + prefab: {fileID: 1707885508695930, guid: 22150daba6e8b47b69fd30f00b9c56cd, + type: 2} + scaleDownWithWorld: 1 + findByType: 0 + categories: 64 + nameString: + coordinates: [] + density: 15 + - coreOptions: + isActive: 0 + sublayerName: All POIs + geometryType: 0 + layerName: + snapToTerrain: 1 + groupFeatures: 0 + lineWidth: 0 + filterOptions: + _selectedLayerName: + filters: [] + combinerType: 0 + extrusionOptions: + _selectedLayerName: + extrusionType: 0 + extrusionGeometryType: 0 + propertyName: + propertyDescription: + minimumHeight: 0 + maximumHeight: 0 + extrusionScaleFactor: 0 + colliderOptions: + colliderType: 0 + materialOptions: + texturingType: 0 + materials: [] + atlasInfo: {fileID: 0} + colorPalette: {fileID: 0} + honorBuildingIdSetting: 0 + buildingsWithUniqueIds: 0 + moveFeaturePositionTo: 0 + MeshModifiers: [] + GoModifiers: [] + spawnPrefabOptions: + prefab: {fileID: 1707885508695930, guid: d748e6a0b26334f4d933c1438339484d, + type: 2} + scaleDownWithWorld: 1 + findByType: 0 + categories: -1 + nameString: + coordinates: [] + density: 30 + _tileProvider: {fileID: 0} +--- !u!4 &967308907 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 967308905} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &987810028 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1478380032039622, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 987810029} + - component: {fileID: 987810031} + - component: {fileID: 987810030} + m_Layer: 5 + m_Name: ZoomLabel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &987810029 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224022329360643548, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 987810028} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2141323938} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0.25, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &987810030 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114615401511486178, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 987810028} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 12800000, guid: bd1ea67ca2b5742d1a24fcbdc17c55e1, type: 3} + m_FontSize: 12 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Zoom +--- !u!222 &987810031 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 222471317231544810, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 987810028} +--- !u!1 &1025723464 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1466557346746850, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1025723466} + - component: {fileID: 1025723465} + m_Layer: 5 + m_Name: Slider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1025723465 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114023684558016336, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1025723464} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -113659843, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2086915431} + m_FillRect: {fileID: 292492998} + m_HandleRect: {fileID: 2086915429} + m_Direction: 0 + m_MinValue: 0 + m_MaxValue: 20 + m_WholeNumbers: 1 + m_Value: 16 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Slider+SliderEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!224 &1025723466 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224155718882878594, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1025723464} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 790657049} + - {fileID: 650732809} + - {fileID: 331047609} + m_Father: {fileID: 2141323938} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.25, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: -12} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1077699859 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1452734211165118, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1077699860} + - component: {fileID: 1077699862} + - component: {fileID: 1077699861} + m_Layer: 5 + m_Name: SearchText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1077699860 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224120818998345342, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1077699859} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1435841542} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -10, y: -4} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1077699861 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114608658907116364, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1077699859} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 12800000, guid: 218956a5c2a6e42d6a60afccf80b002b, type: 3} + m_FontSize: 10 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 8 + m_MaxSize: 10 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!222 &1077699862 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 222195337741236042, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1077699859} +--- !u!1 &1185540384 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1465653171882796, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1185540385} + - component: {fileID: 1185540388} + - component: {fileID: 1185540387} + - component: {fileID: 1185540386} + m_Layer: 5 + m_Name: Panel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1185540385 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224031879083185220, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1185540384} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1856430728} + - {fileID: 2141323938} + m_Father: {fileID: 1780367441} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 250, y: 30} + m_Pivot: {x: 1, y: 1} +--- !u!114 &1185540386 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114225640444197696, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1185540384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.678} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1185540387 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 222276008827229016, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1185540384} +--- !u!114 &1185540388 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114539028991012686, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1185540384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1297475563, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 12 + m_Right: 7 + m_Top: 7 + m_Bottom: 3 + m_ChildAlignment: 0 + m_Spacing: 4 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 +--- !u!1 &1301353179 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1884765832795660, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1301353180} + - component: {fileID: 1301353182} + - component: {fileID: 1301353181} + m_Layer: 5 + m_Name: GeocoderLabel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1301353180 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224460312872028030, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1301353179} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1856430728} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0.25, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 1, y: 0} +--- !u!114 &1301353181 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114470729243328852, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1301353179} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 12800000, guid: bd1ea67ca2b5742d1a24fcbdc17c55e1, type: 3} + m_FontSize: 12 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Search +--- !u!222 &1301353182 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 222758917679313182, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1301353179} +--- !u!1 &1435841541 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1414859872329428, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1435841542} + - component: {fileID: 1435841545} + - component: {fileID: 1435841544} + - component: {fileID: 1435841543} + - component: {fileID: 1435841546} + m_Layer: 5 + m_Name: UserInput + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1435841542 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224048572454037920, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1435841541} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1705615811} + - {fileID: 1077699860} + m_Father: {fileID: 1856430728} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.25, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: -4} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1435841543 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114711793206807384, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1435841541} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1435841544} + m_TextComponent: {fileID: 1077699861} + m_Placeholder: {fileID: 1705615812} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 0} + m_MethodName: ForwardGeocoder + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.InputField+SubmitEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 0.85 + m_CaretWidth: 1 + m_ReadOnly: 0 +--- !u!114 &1435841544 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114431620286575106, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1435841541} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1435841545 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 222386617050530544, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1435841541} +--- !u!114 &1435841546 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114850405259029928, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1435841541} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9bce9ff37f5964623a657f4003af54f2, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1681481099 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1681481106} + - component: {fileID: 1681481105} + - component: {fileID: 1681481104} + - component: {fileID: 1681481103} + - component: {fileID: 1681481102} + - component: {fileID: 1681481100} + - component: {fileID: 1681481101} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1681481100 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1681481099} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ce97be288e861a243b6c6df4cc790edc, type: 3} + m_Name: + m_EditorClassIdentifier: + ShadowDistance: 1000 +--- !u!114 &1681481101 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1681481099} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9527fd56bc6a0c549a1e550219f9b16e, type: 3} + m_Name: + m_EditorClassIdentifier: + _panSpeed: 10 + _zoomSpeed: 50 + _referenceCamera: {fileID: 1681481105} +--- !u!81 &1681481102 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1681481099} + m_Enabled: 1 +--- !u!124 &1681481103 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1681481099} + m_Enabled: 1 +--- !u!92 &1681481104 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1681481099} + m_Enabled: 1 +--- !u!20 &1681481105 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1681481099} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.13235295, g: 0.13235295, b: 0.13235295, a: 1} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 10 + far clip plane: 3000 + field of view: 10 + orthographic: 0 + orthographic size: 143.6 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294966271 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 1 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1681481106 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1681481099} + m_LocalRotation: {x: 0.2588191, y: 0, z: 0, w: 0.9659258} + m_LocalPosition: {x: 0, y: 225, z: -400} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 621795785} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 30, y: 0, z: 0} +--- !u!1 &1705615810 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1309470221448190, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1705615811} + - component: {fileID: 1705615813} + - component: {fileID: 1705615812} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1705615811 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224333804213914554, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1705615810} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1435841542} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -10, y: -4} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1705615812 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114620971063286122, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1705615810} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 12800000, guid: 218956a5c2a6e42d6a60afccf80b002b, type: 3} + m_FontSize: 10 + m_FontStyle: 2 + m_BestFit: 1 + m_MinSize: 8 + m_MaxSize: 10 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enter your location +--- !u!222 &1705615813 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 222294672724154868, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1705615810} +--- !u!1 &1780367436 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1246307186655398, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1780367441} + - component: {fileID: 1780367440} + - component: {fileID: 1780367439} + - component: {fileID: 1780367438} + - component: {fileID: 1780367437} + m_Layer: 5 + m_Name: ReloadMapCanvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1780367437 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114632240689637620, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1780367436} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c00b1c78fb49f4ebd834aac587275216, type: 3} + m_Name: + m_EditorClassIdentifier: + _forwardGeocoder: {fileID: 1435841546} + _zoomSlider: {fileID: 1025723465} +--- !u!114 &1780367438 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114398042337336202, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1780367436} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1780367439 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114329158974351212, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1780367436} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 400, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0.5 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &1780367440 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 223082131773786238, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1780367436} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 1 + m_TargetDisplay: 0 +--- !u!224 &1780367441 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224709793726594912, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1780367436} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 1185540385} + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1856430727 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1041193504261098, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1856430728} + m_Layer: 5 + m_Name: Input + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1856430728 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224178813210018432, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1856430727} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1301353180} + - {fileID: 1435841542} + m_Father: {fileID: 1185540385} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &2086915428 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1748656016281148, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 2086915429} + - component: {fileID: 2086915430} + - component: {fileID: 2086915431} + m_Layer: 5 + m_Name: Handle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2086915429 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224722295744740158, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2086915428} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 331047609} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.8, y: 0} + m_AnchorMax: {x: 0.8, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2086915430 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 222410947139892146, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2086915428} +--- !u!114 &2086915431 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 114372218451069632, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2086915428} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!1 &2141323937 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 1401021118005222, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 2141323938} + m_Layer: 5 + m_Name: Zoom + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &2141323938 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 224538534500426518, guid: 00f5bf1ff996842fc82384f8f686fda6, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2141323937} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 987810029} + - {fileID: 1025723466} + m_Father: {fileID: 1185540385} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 127.5, y: -45.5} + m_SizeDelta: {x: 231, y: 23} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacement.unity.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacement.unity.meta new file mode 100644 index 000000000..5334a9f7c --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacement.unity.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c600a8b272a5846a1b71bdc2d0796637 +timeCreated: 1525984360 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacementScriptExample.cs b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacementScriptExample.cs new file mode 100644 index 000000000..4a869aff9 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacementScriptExample.cs @@ -0,0 +1,37 @@ +namespace Mapbox.Examples +{ + using System.Collections; + using System.Collections.Generic; + using UnityEngine; + + using Mapbox.Unity.Map; + using Mapbox.Utils; + + public class POIPlacementScriptExample : MonoBehaviour + { + public AbstractMap map; + + //prefab to spawn + public GameObject prefab; + //cache of spawned gameobjects + private List _prefabInstances; + + // Use this for initialization + void Start() + { + //add layers before initializing the map + map.SpawnPrefabByCategory(prefab, LocationPrefabCategories.ArtsAndEntertainment, 10, HandlePrefabSpawned, true, "SpawnFromScriptLayer"); + map.Initialize(new Vector2d(37.784179, -122.401583), 16); + } + + //handle callbacks + void HandlePrefabSpawned(List instances) + { + if (instances.Count > 0) + { + Debug.Log(instances[0].name); + } + } + + } +} diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacementScriptExample.cs.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacementScriptExample.cs.meta new file mode 100644 index 000000000..c7e203d56 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/POIPlacementScriptExample.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 97eb57b11eab14c76b0e0281afe0ce53 +timeCreated: 1525984539 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ArtsPoiLabelPrefab.prefab b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ArtsPoiLabelPrefab.prefab new file mode 100644 index 000000000..36ac1d2d7 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ArtsPoiLabelPrefab.prefab @@ -0,0 +1,335 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1707885508695930} + m_IsPrefabParent: 1 +--- !u!1 &1265934954306918 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224460406485636372} + - component: {fileID: 23953474672158714} + - component: {fileID: 102524361988852780} + - component: {fileID: 222132644478461976} + m_Layer: 10 + m_Name: TextMesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1672087740313684 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224296160621579024} + - component: {fileID: 222675931880023072} + - component: {fileID: 114051004161669530} + m_Layer: 10 + m_Name: TextBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1707885508695930 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224247300890674866} + - component: {fileID: 114862004446283512} + - component: {fileID: 223163049547055646} + - component: {fileID: 114848487314916712} + m_Layer: 10 + m_Name: ArtsPoiLabelPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1733686239018384 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4162236002511050} + - component: {fileID: 212008642798578640} + m_Layer: 10 + m_Name: LabelIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4162236002511050 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &23953474672158714 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &102524361988852780 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Text: + m_OffsetZ: -1 + m_CharacterSize: 1 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 1 + m_TabSize: 4 + m_FontSize: 200 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!114 &114051004161669530 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.7294118, g: 0.23137255, b: 0.24705882, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114848487314916712 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ba99666da3af044c0ae878f372ea4115, type: 3} + m_Name: + m_EditorClassIdentifier: + _textMesh: {fileID: 102524361988852780} + _background: {fileID: 114051004161669530} +--- !u!114 &114862004446283512 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 22805dac1b8933d49b89c409a8903cde, type: 3} + m_Name: + m_EditorClassIdentifier: + _camera: {fileID: 0} +--- !u!212 &212008642798578640 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 808e85b573ffd4216a301aa2c9e1293f, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.18, y: 2.46} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 +--- !u!222 &222132644478461976 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} +--- !u!222 &222675931880023072 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} +--- !u!223 &223163049547055646 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 2 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224247300890674866 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224296160621579024} + - {fileID: 224460406485636372} + - {fileID: 4162236002511050} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 3} + m_SizeDelta: {x: 5, y: 5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224296160621579024 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224460406485636372 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/sdkproject/Assets/Mapbox/Examples/Prefabs/LocationProvider.prefab.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ArtsPoiLabelPrefab.prefab.meta similarity index 63% rename from sdkproject/Assets/Mapbox/Examples/Prefabs/LocationProvider.prefab.meta rename to sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ArtsPoiLabelPrefab.prefab.meta index 989e54e78..ec9c9e4cf 100644 --- a/sdkproject/Assets/Mapbox/Examples/Prefabs/LocationProvider.prefab.meta +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ArtsPoiLabelPrefab.prefab.meta @@ -1,8 +1,9 @@ fileFormatVersion: 2 -guid: f836f513cfb284ad0b199b251a8d93a9 -timeCreated: 1511288925 +guid: 29d1abf5ba6514d81a7974353f130ca8 +timeCreated: 1523314292 licenseType: Pro NativeFormatImporter: + externalObjects: {} mainObjectFileID: 100100000 userData: assetBundleName: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/DefaultPoiLabelPrefab.prefab b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/DefaultPoiLabelPrefab.prefab new file mode 100644 index 000000000..a99d609e3 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/DefaultPoiLabelPrefab.prefab @@ -0,0 +1,335 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1707885508695930} + m_IsPrefabParent: 1 +--- !u!1 &1265934954306918 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224460406485636372} + - component: {fileID: 23953474672158714} + - component: {fileID: 102524361988852780} + - component: {fileID: 222132644478461976} + m_Layer: 10 + m_Name: TextMesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1672087740313684 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224296160621579024} + - component: {fileID: 222675931880023072} + - component: {fileID: 114051004161669530} + m_Layer: 10 + m_Name: TextBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1707885508695930 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224247300890674866} + - component: {fileID: 114862004446283512} + - component: {fileID: 223163049547055646} + - component: {fileID: 114354941156370630} + m_Layer: 10 + m_Name: DefaultPoiLabelPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1733686239018384 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4162236002511050} + - component: {fileID: 212008642798578640} + m_Layer: 10 + m_Name: LabelIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4162236002511050 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &23953474672158714 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &102524361988852780 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Text: + m_OffsetZ: -1 + m_CharacterSize: 1 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 1 + m_TabSize: 4 + m_FontSize: 200 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!114 &114051004161669530 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.15294118, g: 0.23921569, b: 0.3372549, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114354941156370630 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ba99666da3af044c0ae878f372ea4115, type: 3} + m_Name: + m_EditorClassIdentifier: + _textMesh: {fileID: 102524361988852780} + _background: {fileID: 114051004161669530} +--- !u!114 &114862004446283512 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 22805dac1b8933d49b89c409a8903cde, type: 3} + m_Name: + m_EditorClassIdentifier: + _camera: {fileID: 0} +--- !u!212 &212008642798578640 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 240e67c92465d4af09e98ac0ff6cb4e5, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.18, y: 2.46} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 +--- !u!222 &222132644478461976 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} +--- !u!222 &222675931880023072 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} +--- !u!223 &223163049547055646 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 2 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224247300890674866 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224296160621579024} + - {fileID: 224460406485636372} + - {fileID: 4162236002511050} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 3} + m_SizeDelta: {x: 5, y: 5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224296160621579024 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224460406485636372 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/DefaultPoiLabelPrefab.prefab.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/DefaultPoiLabelPrefab.prefab.meta new file mode 100644 index 000000000..f8e98e276 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/DefaultPoiLabelPrefab.prefab.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: d748e6a0b26334f4d933c1438339484d +timeCreated: 1523314292 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/FoodPoiLabelPrefab.prefab b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/FoodPoiLabelPrefab.prefab new file mode 100644 index 000000000..57fe5047b --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/FoodPoiLabelPrefab.prefab @@ -0,0 +1,335 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1707885508695930} + m_IsPrefabParent: 1 +--- !u!1 &1265934954306918 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224460406485636372} + - component: {fileID: 23953474672158714} + - component: {fileID: 102524361988852780} + - component: {fileID: 222132644478461976} + m_Layer: 10 + m_Name: TextMesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1672087740313684 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224296160621579024} + - component: {fileID: 222675931880023072} + - component: {fileID: 114051004161669530} + m_Layer: 10 + m_Name: TextBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1707885508695930 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224247300890674866} + - component: {fileID: 114862004446283512} + - component: {fileID: 223163049547055646} + - component: {fileID: 114778088783653994} + m_Layer: 10 + m_Name: FoodPoiLabelPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1733686239018384 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4162236002511050} + - component: {fileID: 212008642798578640} + m_Layer: 10 + m_Name: LabelIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4162236002511050 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &23953474672158714 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &102524361988852780 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Text: + m_OffsetZ: -1 + m_CharacterSize: 1 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 1 + m_TabSize: 4 + m_FontSize: 200 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!114 &114051004161669530 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.7294118, g: 0.4509804, b: 0.20392157, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114778088783653994 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ba99666da3af044c0ae878f372ea4115, type: 3} + m_Name: + m_EditorClassIdentifier: + _textMesh: {fileID: 102524361988852780} + _background: {fileID: 114051004161669530} +--- !u!114 &114862004446283512 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 22805dac1b8933d49b89c409a8903cde, type: 3} + m_Name: + m_EditorClassIdentifier: + _camera: {fileID: 0} +--- !u!212 &212008642798578640 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: b9cd915d8be92437c936b03eedf3631c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.18, y: 2.46} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 +--- !u!222 &222132644478461976 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} +--- !u!222 &222675931880023072 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} +--- !u!223 &223163049547055646 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 2 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224247300890674866 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224296160621579024} + - {fileID: 224460406485636372} + - {fileID: 4162236002511050} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 3} + m_SizeDelta: {x: 5, y: 5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224296160621579024 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224460406485636372 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/FoodPoiLabelPrefab.prefab.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/FoodPoiLabelPrefab.prefab.meta new file mode 100644 index 000000000..de94dfeed --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/FoodPoiLabelPrefab.prefab.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: fafbd32423ea04e379d8321b4d370fea +timeCreated: 1523314292 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/NightlifePoiLabelPrefab.prefab b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/NightlifePoiLabelPrefab.prefab new file mode 100644 index 000000000..3ad2dfa51 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/NightlifePoiLabelPrefab.prefab @@ -0,0 +1,335 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1707885508695930} + m_IsPrefabParent: 1 +--- !u!1 &1265934954306918 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224460406485636372} + - component: {fileID: 23953474672158714} + - component: {fileID: 102524361988852780} + - component: {fileID: 222132644478461976} + m_Layer: 10 + m_Name: TextMesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1672087740313684 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224296160621579024} + - component: {fileID: 222675931880023072} + - component: {fileID: 114051004161669530} + m_Layer: 10 + m_Name: TextBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1707885508695930 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224247300890674866} + - component: {fileID: 114862004446283512} + - component: {fileID: 223163049547055646} + - component: {fileID: 114202860846738256} + m_Layer: 10 + m_Name: NightlifePoiLabelPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1733686239018384 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4162236002511050} + - component: {fileID: 212008642798578640} + m_Layer: 10 + m_Name: LabelIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4162236002511050 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &23953474672158714 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &102524361988852780 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Text: + m_OffsetZ: -1 + m_CharacterSize: 1 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 1 + m_TabSize: 4 + m_FontSize: 200 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!114 &114051004161669530 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.3529412, g: 0.24705882, b: 0.7529412, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114202860846738256 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ba99666da3af044c0ae878f372ea4115, type: 3} + m_Name: + m_EditorClassIdentifier: + _textMesh: {fileID: 102524361988852780} + _background: {fileID: 114051004161669530} +--- !u!114 &114862004446283512 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 22805dac1b8933d49b89c409a8903cde, type: 3} + m_Name: + m_EditorClassIdentifier: + _camera: {fileID: 0} +--- !u!212 &212008642798578640 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 88cacb42af7fe47338fa175ad6114e09, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.18, y: 2.46} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 +--- !u!222 &222132644478461976 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} +--- !u!222 &222675931880023072 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} +--- !u!223 &223163049547055646 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 2 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224247300890674866 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224296160621579024} + - {fileID: 224460406485636372} + - {fileID: 4162236002511050} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 3} + m_SizeDelta: {x: 5, y: 5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224296160621579024 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224460406485636372 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/NightlifePoiLabelPrefab.prefab.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/NightlifePoiLabelPrefab.prefab.meta new file mode 100644 index 000000000..d51b58798 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/NightlifePoiLabelPrefab.prefab.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 61bcd2d324dd34bb9b722d856749c28c +timeCreated: 1523314292 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/OutdoorPoiLabelPrefab.prefab b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/OutdoorPoiLabelPrefab.prefab new file mode 100644 index 000000000..7c4eb8f85 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/OutdoorPoiLabelPrefab.prefab @@ -0,0 +1,335 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1707885508695930} + m_IsPrefabParent: 1 +--- !u!1 &1265934954306918 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224460406485636372} + - component: {fileID: 23953474672158714} + - component: {fileID: 102524361988852780} + - component: {fileID: 222132644478461976} + m_Layer: 10 + m_Name: TextMesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1672087740313684 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224296160621579024} + - component: {fileID: 222675931880023072} + - component: {fileID: 114051004161669530} + m_Layer: 10 + m_Name: TextBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1707885508695930 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224247300890674866} + - component: {fileID: 114862004446283512} + - component: {fileID: 223163049547055646} + - component: {fileID: 114911108916016812} + m_Layer: 10 + m_Name: OutdoorPoiLabelPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1733686239018384 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4162236002511050} + - component: {fileID: 212008642798578640} + m_Layer: 10 + m_Name: LabelIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4162236002511050 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &23953474672158714 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &102524361988852780 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Text: + m_OffsetZ: -1 + m_CharacterSize: 1 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 1 + m_TabSize: 4 + m_FontSize: 200 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!114 &114051004161669530 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.14901961, g: 0.58431375, b: 0.38039216, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114862004446283512 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 22805dac1b8933d49b89c409a8903cde, type: 3} + m_Name: + m_EditorClassIdentifier: + _camera: {fileID: 0} +--- !u!114 &114911108916016812 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ba99666da3af044c0ae878f372ea4115, type: 3} + m_Name: + m_EditorClassIdentifier: + _textMesh: {fileID: 102524361988852780} + _background: {fileID: 114051004161669530} +--- !u!212 &212008642798578640 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 08d14ec5687ea47fcb3de9ac267391b5, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.18, y: 2.46} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 +--- !u!222 &222132644478461976 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} +--- !u!222 &222675931880023072 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} +--- !u!223 &223163049547055646 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 2 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224247300890674866 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224296160621579024} + - {fileID: 224460406485636372} + - {fileID: 4162236002511050} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 3} + m_SizeDelta: {x: 5, y: 5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224296160621579024 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224460406485636372 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/OutdoorPoiLabelPrefab.prefab.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/OutdoorPoiLabelPrefab.prefab.meta new file mode 100644 index 000000000..adba59456 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/OutdoorPoiLabelPrefab.prefab.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b0e54a880e97f4c5ead7dcc1c0918e05 +timeCreated: 1523314292 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ServicePoiLabelPrefab.prefab b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ServicePoiLabelPrefab.prefab new file mode 100644 index 000000000..66578f3c4 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ServicePoiLabelPrefab.prefab @@ -0,0 +1,335 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1707885508695930} + m_IsPrefabParent: 1 +--- !u!1 &1265934954306918 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224460406485636372} + - component: {fileID: 23953474672158714} + - component: {fileID: 102524361988852780} + - component: {fileID: 222132644478461976} + m_Layer: 10 + m_Name: TextMesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1672087740313684 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224296160621579024} + - component: {fileID: 222675931880023072} + - component: {fileID: 114051004161669530} + m_Layer: 10 + m_Name: TextBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1707885508695930 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224247300890674866} + - component: {fileID: 114862004446283512} + - component: {fileID: 223163049547055646} + - component: {fileID: 114280324952901670} + m_Layer: 10 + m_Name: ServicePoiLabelPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1733686239018384 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4162236002511050} + - component: {fileID: 212008642798578640} + m_Layer: 10 + m_Name: LabelIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4162236002511050 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &23953474672158714 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &102524361988852780 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Text: + m_OffsetZ: -1 + m_CharacterSize: 1 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 1 + m_TabSize: 4 + m_FontSize: 200 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!114 &114051004161669530 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.6431373, g: 0.6509804, b: 0.1764706, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114280324952901670 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ba99666da3af044c0ae878f372ea4115, type: 3} + m_Name: + m_EditorClassIdentifier: + _textMesh: {fileID: 102524361988852780} + _background: {fileID: 114051004161669530} +--- !u!114 &114862004446283512 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 22805dac1b8933d49b89c409a8903cde, type: 3} + m_Name: + m_EditorClassIdentifier: + _camera: {fileID: 0} +--- !u!212 &212008642798578640 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: b8b01d4fa12054e23ac744c58f0ce422, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.18, y: 2.46} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 +--- !u!222 &222132644478461976 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} +--- !u!222 &222675931880023072 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} +--- !u!223 &223163049547055646 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 2 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224247300890674866 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224296160621579024} + - {fileID: 224460406485636372} + - {fileID: 4162236002511050} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 3} + m_SizeDelta: {x: 5, y: 5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224296160621579024 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224460406485636372 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ServicePoiLabelPrefab.prefab.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ServicePoiLabelPrefab.prefab.meta new file mode 100644 index 000000000..674f06b9b --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ServicePoiLabelPrefab.prefab.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 60a41cfc23d514878814f0d425912eff +timeCreated: 1523314292 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ShopPoiLabelPrefab.prefab b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ShopPoiLabelPrefab.prefab new file mode 100644 index 000000000..ef14367b3 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ShopPoiLabelPrefab.prefab @@ -0,0 +1,335 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1707885508695930} + m_IsPrefabParent: 1 +--- !u!1 &1265934954306918 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224460406485636372} + - component: {fileID: 23953474672158714} + - component: {fileID: 102524361988852780} + - component: {fileID: 222132644478461976} + m_Layer: 10 + m_Name: TextMesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1672087740313684 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224296160621579024} + - component: {fileID: 222675931880023072} + - component: {fileID: 114051004161669530} + m_Layer: 10 + m_Name: TextBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1707885508695930 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224247300890674866} + - component: {fileID: 114862004446283512} + - component: {fileID: 223163049547055646} + - component: {fileID: 114567880144019398} + m_Layer: 10 + m_Name: ShopPoiLabelPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1733686239018384 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4162236002511050} + - component: {fileID: 212008642798578640} + m_Layer: 10 + m_Name: LabelIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4162236002511050 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &23953474672158714 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &102524361988852780 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Text: + m_OffsetZ: -1 + m_CharacterSize: 1 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 1 + m_TabSize: 4 + m_FontSize: 200 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!114 &114051004161669530 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.7058824, g: 0.23137255, b: 0.44313726, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114567880144019398 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ba99666da3af044c0ae878f372ea4115, type: 3} + m_Name: + m_EditorClassIdentifier: + _textMesh: {fileID: 102524361988852780} + _background: {fileID: 114051004161669530} +--- !u!114 &114862004446283512 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 22805dac1b8933d49b89c409a8903cde, type: 3} + m_Name: + m_EditorClassIdentifier: + _camera: {fileID: 0} +--- !u!212 &212008642798578640 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: e6aebe3a73e184e0d8196a1362a5c72e, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.18, y: 2.46} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 +--- !u!222 &222132644478461976 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} +--- !u!222 &222675931880023072 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} +--- !u!223 &223163049547055646 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 2 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224247300890674866 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224296160621579024} + - {fileID: 224460406485636372} + - {fileID: 4162236002511050} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 3} + m_SizeDelta: {x: 5, y: 5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224296160621579024 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224460406485636372 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ShopPoiLabelPrefab.prefab.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ShopPoiLabelPrefab.prefab.meta new file mode 100644 index 000000000..a9f00020f --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/ShopPoiLabelPrefab.prefab.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 49bc5d782d9184533a37abea20ed30e4 +timeCreated: 1523314292 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/TransportationPoiLabelPrefab.prefab b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/TransportationPoiLabelPrefab.prefab new file mode 100644 index 000000000..3275829a6 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/TransportationPoiLabelPrefab.prefab @@ -0,0 +1,335 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1707885508695930} + m_IsPrefabParent: 1 +--- !u!1 &1265934954306918 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224460406485636372} + - component: {fileID: 23953474672158714} + - component: {fileID: 102524361988852780} + - component: {fileID: 222132644478461976} + m_Layer: 10 + m_Name: TextMesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1672087740313684 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224296160621579024} + - component: {fileID: 222675931880023072} + - component: {fileID: 114051004161669530} + m_Layer: 10 + m_Name: TextBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1707885508695930 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224247300890674866} + - component: {fileID: 114862004446283512} + - component: {fileID: 223163049547055646} + - component: {fileID: 114145366152452004} + m_Layer: 10 + m_Name: TransportationPoiLabelPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1733686239018384 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4162236002511050} + - component: {fileID: 212008642798578640} + m_Layer: 10 + m_Name: LabelIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4162236002511050 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &23953474672158714 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &102524361988852780 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_Text: + m_OffsetZ: -1 + m_CharacterSize: 1 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 1 + m_TabSize: 4 + m_FontSize: 200 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: 7dfc2e1472ac84e1bb749a8a9f934483, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!114 &114051004161669530 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19215687, g: 0.29803923, b: 0.8039216, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114145366152452004 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ba99666da3af044c0ae878f372ea4115, type: 3} + m_Name: + m_EditorClassIdentifier: + _textMesh: {fileID: 102524361988852780} + _background: {fileID: 114051004161669530} +--- !u!114 &114862004446283512 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 22805dac1b8933d49b89c409a8903cde, type: 3} + m_Name: + m_EditorClassIdentifier: + _camera: {fileID: 0} +--- !u!212 &212008642798578640 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1733686239018384} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: fec5572521f52453397f564f556c168e, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.18, y: 2.46} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 +--- !u!222 &222132644478461976 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} +--- !u!222 &222675931880023072 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} +--- !u!223 &223163049547055646 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 2 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224247300890674866 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1707885508695930} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224296160621579024} + - {fileID: 224460406485636372} + - {fileID: 4162236002511050} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 3} + m_SizeDelta: {x: 5, y: 5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224296160621579024 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1672087740313684} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224460406485636372 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1265934954306918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_Children: [] + m_Father: {fileID: 224247300890674866} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/TransportationPoiLabelPrefab.prefab.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/TransportationPoiLabelPrefab.prefab.meta new file mode 100644 index 000000000..e81daaa9c --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/TransportationPoiLabelPrefab.prefab.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 22150daba6e8b47b69fd30f00b9c56cd +timeCreated: 1523314292 +licenseType: Pro +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-arts.png b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-arts.png new file mode 100755 index 000000000..543fe1266 Binary files /dev/null and b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-arts.png differ diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-arts.png.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-arts.png.meta new file mode 100644 index 000000000..666baf0b1 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-arts.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 808e85b573ffd4216a301aa2c9e1293f +timeCreated: 1523568407 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-default.png b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-default.png new file mode 100755 index 000000000..6fd79ba29 Binary files /dev/null and b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-default.png differ diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-default.png.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-default.png.meta new file mode 100644 index 000000000..b1aab2782 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-default.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 240e67c92465d4af09e98ac0ff6cb4e5 +timeCreated: 1523568407 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-food.png b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-food.png new file mode 100755 index 000000000..ac02e3361 Binary files /dev/null and b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-food.png differ diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-food.png.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-food.png.meta new file mode 100644 index 000000000..ea1770426 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-food.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: b9cd915d8be92437c936b03eedf3631c +timeCreated: 1523568407 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-nightlife.png b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-nightlife.png new file mode 100755 index 000000000..dd9f6798c Binary files /dev/null and b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-nightlife.png differ diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-nightlife.png.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-nightlife.png.meta new file mode 100644 index 000000000..9b4e68577 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-nightlife.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 88cacb42af7fe47338fa175ad6114e09 +timeCreated: 1523568407 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-outdoors.png b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-outdoors.png new file mode 100755 index 000000000..551365bfb Binary files /dev/null and b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-outdoors.png differ diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-outdoors.png.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-outdoors.png.meta new file mode 100644 index 000000000..ff3b60812 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-outdoors.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 08d14ec5687ea47fcb3de9ac267391b5 +timeCreated: 1523568407 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-services.png b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-services.png new file mode 100755 index 000000000..7275f8515 Binary files /dev/null and b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-services.png differ diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-services.png.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-services.png.meta new file mode 100644 index 000000000..3eb525fea --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-services.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: b8b01d4fa12054e23ac744c58f0ce422 +timeCreated: 1523568407 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-shops.png b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-shops.png new file mode 100755 index 000000000..18deb7b82 Binary files /dev/null and b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-shops.png differ diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-shops.png.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-shops.png.meta new file mode 100644 index 000000000..be1214a87 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-shops.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: e6aebe3a73e184e0d8196a1362a5c72e +timeCreated: 1523568407 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-transportation.png b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-transportation.png new file mode 100755 index 000000000..6cbee34a8 Binary files /dev/null and b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-transportation.png differ diff --git a/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-transportation.png.meta b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-transportation.png.meta new file mode 100644 index 000000000..83c20c21e --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/6_POIPlacement/Resources/poi-icon-transportation.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: fec5572521f52453397f564f556c168e +timeCreated: 1523568407 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/Prefabs/LocationProvider.prefab b/sdkproject/Assets/Mapbox/Examples/Prefabs/LocationProvider.prefab deleted file mode 100644 index a81afda41..000000000 --- a/sdkproject/Assets/Mapbox/Examples/Prefabs/LocationProvider.prefab +++ /dev/null @@ -1,245 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1001 &100100000 -Prefab: - m_ObjectHideFlags: 1 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: [] - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 0} - m_RootGameObject: {fileID: 1852556985252580} - m_IsPrefabParent: 1 ---- !u!1 &1316421109005586 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 5 - m_Component: - - component: {fileID: 4809313308096502} - - component: {fileID: 114304334187956690} - m_Layer: 0 - m_Name: Device - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!1 &1323388544354338 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 5 - m_Component: - - component: {fileID: 4673226662361986} - - component: {fileID: 114131115543525190} - m_Layer: 0 - m_Name: EditorLocationArray - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!1 &1517919618537706 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 5 - m_Component: - - component: {fileID: 4164410729340786} - - component: {fileID: 114023304781792650} - m_Layer: 0 - m_Name: Editor - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!1 &1852556985252580 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 5 - m_Component: - - component: {fileID: 4848158690232418} - - component: {fileID: 114987675768091326} - m_Layer: 0 - m_Name: LocationProvider - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!1 &1984159601422726 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 5 - m_Component: - - component: {fileID: 4910449769080130} - - component: {fileID: 114958662040910602} - m_Layer: 0 - m_Name: Transform - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &4164410729340786 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1517919618537706} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 4848158690232418} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4673226662361986 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1323388544354338} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 4848158690232418} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4809313308096502 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1316421109005586} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 4848158690232418} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4848158690232418 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1852556985252580} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 4809313308096502} - - {fileID: 4164410729340786} - - {fileID: 4673226662361986} - - {fileID: 4910449769080130} - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4910449769080130 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1984159601422726} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 4848158690232418} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &114023304781792650 -MonoBehaviour: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1517919618537706} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 60712efc3153a4819b0c79437175846d, type: 3} - m_Name: - m_EditorClassIdentifier: - _accuracy: 5 - _autoFireEvent: 1 - _updateInterval: 0.1 - _sendEvent: 0 - _latitudeLongitude: 37.784179, -122.401583 - _targetTransform: {fileID: 0} - _map: {fileID: 0} ---- !u!114 &114131115543525190 -MonoBehaviour: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1323388544354338} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 6b5c815d91f9d4c3690891f3ed4c3162, type: 3} - m_Name: - m_EditorClassIdentifier: - _accuracy: 5 - _autoFireEvent: 1 - _updateInterval: 2 - _sendEvent: 0 - _latitudeLongitude: - - 37.784179, -122.401583 - - 37.8045, -122.2714 - - 37.2751, -121.8261 - _heading: 0 ---- !u!114 &114304334187956690 -MonoBehaviour: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1316421109005586} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0a38712e93231418a84665190b8473d0, type: 3} - m_Name: - m_EditorClassIdentifier: - _desiredAccuracyInMeters: 5 - _updateDistanceInMeters: 5 ---- !u!114 &114958662040910602 -MonoBehaviour: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1984159601422726} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a034c4eeb3293418aab101c1895844a4, type: 3} - m_Name: - m_EditorClassIdentifier: - _accuracy: 5 - _autoFireEvent: 1 - _updateInterval: 1 - _sendEvent: 0 - _map: {fileID: 0} - _targetTransform: {fileID: 4910449769080130} ---- !u!114 &114987675768091326 -MonoBehaviour: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1852556985252580} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b55f37f9a6f7e44f7bb35e6bc3863847, type: 3} - m_Name: - m_EditorClassIdentifier: - _deviceLocationProvider: {fileID: 114304334187956690} - _editorLocationProvider: {fileID: 114023304781792650} - _transformLocationProvider: {fileID: 114958662040910602} - _dontDestroyOnLoad: 0 diff --git a/sdkproject/Assets/Mapbox/Examples/Scripts/PoiLabelTextSetter.cs b/sdkproject/Assets/Mapbox/Examples/Scripts/PoiLabelTextSetter.cs new file mode 100644 index 000000000..c5d566ab9 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/Scripts/PoiLabelTextSetter.cs @@ -0,0 +1,38 @@ +namespace Mapbox.Examples +{ + using Mapbox.Unity.MeshGeneration.Interfaces; + using System.Collections.Generic; + using UnityEngine; + using UnityEngine.UI; + + public class PoiLabelTextSetter : MonoBehaviour, IFeaturePropertySettable + { + [SerializeField] + TextMesh _textMesh; + + [SerializeField] + Image _background; + + public void Set(Dictionary props) + { + _textMesh.text = ""; + + if (props.ContainsKey("name")) + { + _textMesh.text = props["name"].ToString(); + } + else if (props.ContainsKey("house_num")) + { + _textMesh.text = props["house_num"].ToString(); + } + else if (props.ContainsKey("type")) + { + _textMesh.text = props["type"].ToString(); + } + + float textWidth = _textMesh.GetComponent().bounds.size.x; + RectTransform backgroundRect = _background.GetComponent(); + backgroundRect.sizeDelta = new Vector2 (textWidth + 4f, 3f); + } + } +} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Examples/Scripts/PoiLabelTextSetter.cs.meta b/sdkproject/Assets/Mapbox/Examples/Scripts/PoiLabelTextSetter.cs.meta new file mode 100644 index 000000000..329be59c6 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/Scripts/PoiLabelTextSetter.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: ba99666da3af044c0ae878f372ea4115 +timeCreated: 1523999824 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/Scripts/PositionWithLocationProvider.cs b/sdkproject/Assets/Mapbox/Examples/Scripts/PositionWithLocationProvider.cs index 7b3fb40f4..b0042f5e3 100644 --- a/sdkproject/Assets/Mapbox/Examples/Scripts/PositionWithLocationProvider.cs +++ b/sdkproject/Assets/Mapbox/Examples/Scripts/PositionWithLocationProvider.cs @@ -83,4 +83,4 @@ void Update() transform.localPosition = Vector3.Lerp(transform.localPosition, _targetPosition, Time.deltaTime * _positionFollowFactor); } } -} \ No newline at end of file +} diff --git a/sdkproject/Assets/Mapbox/Examples/Scripts/RotateWithLocationProvider.cs b/sdkproject/Assets/Mapbox/Examples/Scripts/RotateWithLocationProvider.cs index ffafc468a..9191422ae 100644 --- a/sdkproject/Assets/Mapbox/Examples/Scripts/RotateWithLocationProvider.cs +++ b/sdkproject/Assets/Mapbox/Examples/Scripts/RotateWithLocationProvider.cs @@ -5,11 +5,26 @@ namespace Mapbox.Examples public class RotateWithLocationProvider : MonoBehaviour { + /// + /// Location property used for rotation: false=Heading (default), true=Orientation + /// + [SerializeField] + [Tooltip("Per default 'UserHeading' (direction the device is moving) is used for rotation. Check to use 'DeviceOrientation' (where the device is facing)")] + bool _useDeviceOrientation; + + /// + /// + /// + [SerializeField] + [Tooltip("Only evaluated when 'Use Device Orientation' is checked. Subtracts UserHeading from DeviceOrientation. Useful if map is rotated by UserHeading and DeviceOrientation should be displayed relative to the heading.")] + bool _subtractUserHeading; + /// /// The rate at which the transform's rotation tries catch up to the provided heading. /// [SerializeField] - float _rotationFollowFactor; + [Tooltip("The rate at which the transform's rotation tries catch up to the provided heading. ")] + float _rotationFollowFactor = 1; /// /// Set this to true if you'd like to adjust the rotation of a RectTransform (in a UI canvas) with the heading. @@ -17,6 +32,15 @@ public class RotateWithLocationProvider : MonoBehaviour [SerializeField] bool _rotateZ; + /// + /// Set this to true if you'd like to adjust the sign of the rotation angle. + /// eg angle passed in 63.5, angle that should be used for rotation: -63.5. + /// This might be needed when rotating the map and not objects on the map. + /// + [SerializeField] + [Tooltip("Set this to true if you'd like to adjust the sign of the rotation angle. eg angle passed in 63.5, angle that should be used for rotation: -63.5.")] + bool _useNegativeAngle; + /// /// Use a mock , /// rather than a . @@ -72,22 +96,53 @@ void OnDestroy() void LocationProvider_OnLocationUpdated(Location location) { - if (location.IsHeadingUpdated) + + float rotationAngle = _useDeviceOrientation ? location.DeviceOrientation : location.UserHeading; + + if (_useNegativeAngle) { rotationAngle *= -1f; } + + // 'Orientation' changes all the time, pass through immediately + if (_useDeviceOrientation) { - var euler = Mapbox.Unity.Constants.Math.Vector3Zero; - if (_rotateZ) - { - euler.z = -location.Heading; - } - else + if (_subtractUserHeading) { rotationAngle -= location.UserHeading; } + _targetRotation = Quaternion.Euler(getNewEulerAngles(rotationAngle)); + } + else + { + // if rotating by 'Heading' only do it if heading has a new value + if (location.IsUserHeadingUpdated) { - euler.y = location.Heading; + _targetRotation = Quaternion.Euler(getNewEulerAngles(rotationAngle)); } + } + } + + + private Vector3 getNewEulerAngles(float newAngle) + { + var localRotation = transform.localRotation; + var currentEuler = localRotation.eulerAngles; + var euler = Mapbox.Unity.Constants.Math.Vector3Zero; - _targetRotation = Quaternion.Euler(euler); + if (_rotateZ) + { + euler.z = -newAngle; + + euler.x = currentEuler.x; + euler.y = currentEuler.y; } + else + { + euler.y = newAngle; + + euler.x = currentEuler.x; + euler.z = currentEuler.z; + } + + return euler; } + void Update() { transform.localRotation = Quaternion.Lerp(transform.localRotation, _targetRotation, Time.deltaTime * _rotationFollowFactor); diff --git a/sdkproject/Assets/Mapbox/Examples/Scripts/UpdateMapWithLocationProvider.cs b/sdkproject/Assets/Mapbox/Examples/Scripts/UpdateMapWithLocationProvider.cs new file mode 100644 index 000000000..6b534dec1 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/Scripts/UpdateMapWithLocationProvider.cs @@ -0,0 +1,114 @@ +namespace Mapbox.Unity.Map +{ + using System.Collections; + using Mapbox.Unity.Location; + using UnityEngine; + + public class UpdateMapWithLocationProvider : MonoBehaviour + { + [SerializeField] + AbstractMap _map; + + ILocationProvider _locationProvider; + Vector3 _targetPosition; + bool _isMapInitialized = false; + + /// + /// The time taken to move from the start to finish positions + /// + public float timeTakenDuringLerp = 1f; + + //Whether we are currently interpolating or not + private bool _isLerping; + + //The start and finish positions for the interpolation + private Vector3 _startPosition; + private Vector3 _endPosition; + + private Utils.Vector2d _startLatLong; + private Utils.Vector2d _endLatlong; + + //The Time.time value when we started the interpolation + private float _timeStartedLerping; + + private void Awake() + { + // Prevent double initialization of the map. + _map.InitializeOnStart = false; + } + + IEnumerator Start() + { + yield return null; + _locationProvider = LocationProviderFactory.Instance.DefaultLocationProvider; + _locationProvider.OnLocationUpdated += LocationProvider_OnFirstLocationUpdate; + } + + void LocationProvider_OnFirstLocationUpdate(Unity.Location.Location location) + { + _locationProvider.OnLocationUpdated -= LocationProvider_OnFirstLocationUpdate; + _map.OnInitialized += () => + { + _isMapInitialized = true; + _locationProvider.OnLocationUpdated += LocationProvider_OnLocationUpdated; + }; + _map.Initialize(location.LatitudeLongitude, _map.AbsoluteZoom); + } + + void LocationProvider_OnLocationUpdated(Unity.Location.Location location) + { + if (_isMapInitialized && location.IsLocationUpdated) + { + StartLerping(location); + } + } + + /// + /// Called to begin the linear interpolation + /// + void StartLerping(Unity.Location.Location location) + { + _isLerping = true; + _timeStartedLerping = Time.time; + //Debug.Log(Time.deltaTime); + timeTakenDuringLerp = Time.deltaTime; + + //We set the start position to the current position + _startLatLong = _map.CenterLatitudeLongitude; + _endLatlong = location.LatitudeLongitude; + _startPosition = _map.GeoToWorldPosition(_startLatLong, false); + _endPosition = _map.GeoToWorldPosition(_endLatlong, false); + } + + //We do the actual interpolation in FixedUpdate(), since we're dealing with a rigidbody + void LateUpdate() + { + if (_isMapInitialized && _isLerping) + { + //We want percentage = 0.0 when Time.time = _timeStartedLerping + //and percentage = 1.0 when Time.time = _timeStartedLerping + timeTakenDuringLerp + //In other words, we want to know what percentage of "timeTakenDuringLerp" the value + //"Time.time - _timeStartedLerping" is. + float timeSinceStarted = Time.time - _timeStartedLerping; + float percentageComplete = timeSinceStarted / timeTakenDuringLerp; + + //Perform the actual lerping. Notice that the first two parameters will always be the same + //throughout a single lerp-processs (ie. they won't change until we hit the space-bar again + //to start another lerp) + //_startPosition = _map.GeoToWorldPosition(_map.CenterLatitudeLongitude, false); + _startPosition = _map.GeoToWorldPosition(_startLatLong, false); + _endPosition = _map.GeoToWorldPosition(_endLatlong, false); + var position = Vector3.Lerp(_startPosition, _endPosition, percentageComplete); + var latLong = _map.WorldToGeoPosition(position); + _map.UpdateMap(latLong, _map.Zoom); + + //When we've completed the lerp, we set _isLerping to false + if (percentageComplete >= 1.0f) + { + _isLerping = false; + + } + } + } + } +} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Examples/Scripts/UpdateMapWithLocationProvider.cs.meta b/sdkproject/Assets/Mapbox/Examples/Scripts/UpdateMapWithLocationProvider.cs.meta new file mode 100644 index 000000000..cf29158db --- /dev/null +++ b/sdkproject/Assets/Mapbox/Examples/Scripts/UpdateMapWithLocationProvider.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: b45b6cb0c94914eb6a1fac86abfc6aba +timeCreated: 1524787995 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/_sharedModules/GlobeTerrainFactory.asset b/sdkproject/Assets/Mapbox/Examples/_sharedModules/GlobeTerrainFactory.asset deleted file mode 100644 index 1ca9f3760..000000000 --- a/sdkproject/Assets/Mapbox/Examples/_sharedModules/GlobeTerrainFactory.asset +++ /dev/null @@ -1,38 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 859bc316b9b734bffaf7288cb86ffc0c, type: 3} - m_Name: GlobeTerrainFactory - m_EditorClassIdentifier: - _elevationOptions: - sourceType: 0 - sourceOptions: - isActive: 1 - layerSource: - Name: - Id: mapbox.terrain-rgb - Modified: - UserName: - elevationLayerType: 3 - requiredOptions: - baseMaterial: {fileID: 2100000, guid: b9f23e9bce724fa4daac57ecded470b8, type: 2} - addCollider: 0 - exaggerationFactor: 1 - modificationOptions: - sampleCount: 10 - useRelativeHeight: 0 - earthRadius: 1000 - unityLayerOptions: - addToLayer: 0 - layerId: 0 - sideWallOptions: - isActive: 0 - wallHeight: 10 - wallMaterial: {fileID: 0} diff --git a/sdkproject/Assets/Mapbox/Examples/_sharedModules/LowPolyTerrainFactory.asset b/sdkproject/Assets/Mapbox/Examples/_sharedModules/LowPolyTerrainFactory.asset deleted file mode 100644 index 156f18885..000000000 --- a/sdkproject/Assets/Mapbox/Examples/_sharedModules/LowPolyTerrainFactory.asset +++ /dev/null @@ -1,38 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9ffef98732ebca048a22c90f6809321c, type: 3} - m_Name: LowPolyTerrainFactory - m_EditorClassIdentifier: - _elevationOptions: - sourceType: 0 - sourceOptions: - isActive: 1 - layerSource: - Name: - Id: mapbox.terrain-rgb - Modified: - UserName: - elevationLayerType: 2 - requiredOptions: - baseMaterial: {fileID: 2100000, guid: b9f23e9bce724fa4daac57ecded470b8, type: 2} - addCollider: 0 - exaggerationFactor: 1 - modificationOptions: - sampleCount: 10 - useRelativeHeight: 0 - earthRadius: 1000 - unityLayerOptions: - addToLayer: 0 - layerId: 0 - sideWallOptions: - isActive: 0 - wallHeight: 10 - wallMaterial: {fileID: 0} diff --git a/sdkproject/Assets/Mapbox/Examples/_sharedModules/LowPolyTerrainFactory.asset.meta b/sdkproject/Assets/Mapbox/Examples/_sharedModules/LowPolyTerrainFactory.asset.meta deleted file mode 100644 index 397de918a..000000000 --- a/sdkproject/Assets/Mapbox/Examples/_sharedModules/LowPolyTerrainFactory.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 516d89dfeaaf9c743935a4f89e93220c -timeCreated: 1501697876 -licenseType: Pro -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Examples/_sharedModules/PoiDemo3dPoiModifier.asset b/sdkproject/Assets/Mapbox/Examples/_sharedModules/PoiDemo3dPoiModifier.asset index b5f90ceeb..7da31a5e5 100644 --- a/sdkproject/Assets/Mapbox/Examples/_sharedModules/PoiDemo3dPoiModifier.asset +++ b/sdkproject/Assets/Mapbox/Examples/_sharedModules/PoiDemo3dPoiModifier.asset @@ -12,5 +12,6 @@ MonoBehaviour: m_Name: PoiDemo3dPoiModifier m_EditorClassIdentifier: Active: 1 - _prefab: {fileID: 1000010288152912, guid: 44828d4325e8b544ca6ffec352cfe165, type: 2} - _scaleDownWithWorld: 1 + _options: + prefab: {fileID: 1000010288152912, guid: 44828d4325e8b544ca6ffec352cfe165, type: 2} + scaleDownWithWorld: 1 diff --git a/sdkproject/Assets/Mapbox/Prefabs/CitySimulatorMap.prefab b/sdkproject/Assets/Mapbox/Prefabs/CitySimulatorMap.prefab index 7a9530d81..2c05d4453 100644 --- a/sdkproject/Assets/Mapbox/Prefabs/CitySimulatorMap.prefab +++ b/sdkproject/Assets/Mapbox/Prefabs/CitySimulatorMap.prefab @@ -121,7 +121,32 @@ MonoBehaviour: wallMaterial: {fileID: 0} _vectorData: _layerProperty: - sourceType: 0 + tileJsonData: + tileJSONLoaded: 0 + LayerDisplayNames: + - admin + - aeroway + - airport_label + - barrier_line + - building + - country_label + - housenum_label + - landuse + - landuse_overlay + - marine_label + - motorway_junction + - mountain_peak_label + - place_label + - poi_label + - rail_station_label + - road + - road_label + - state_label + - water + - water_label + - waterway + - waterway_label + _sourceType: 0 sourceOptions: isActive: 1 layerSource: @@ -140,6 +165,7 @@ MonoBehaviour: entityPerCoroutine: 20 vectorSubLayers: - coreOptions: + sourceId: mapbox.3d-buildings,mapbox.mapbox-streets-v7 isActive: 1 sublayerName: ExtrudedBuildings geometryType: 2 @@ -148,16 +174,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 1 filterOptions: + _selectedLayerName: filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: building extrusionType: 1 extrusionGeometryType: 0 propertyName: height + propertyDescription: Number. Height of building or part of building. minimumHeight: 0 maximumHeight: 0 + extrusionScaleFactor: 1 + colliderOptions: + colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 3 materials: - Materials: @@ -165,13 +196,15 @@ MonoBehaviour: - Materials: - {fileID: 2100000, guid: 55cc6edead802446b9106b2998406844, type: 2} atlasInfo: {fileID: 11400000, guid: 414754d7155df47beb52ca117a774f21, type: 2} - colorPallete: {fileID: 11400000, guid: ef118b5e263da4b1fa4327ca1d3e0c7b, + colorPalette: {fileID: 11400000, guid: ef118b5e263da4b1fa4327ca1d3e0c7b, type: 2} + honorBuildingIdSetting: 1 buildingsWithUniqueIds: 1 moveFeaturePositionTo: 0 MeshModifiers: [] GoModifiers: [] - coreOptions: + sourceId: isActive: 1 sublayerName: Roads geometryType: 1 @@ -180,16 +213,21 @@ MonoBehaviour: groupFeatures: 0 lineWidth: 3 filterOptions: + _selectedLayerName: filters: [] combinerType: 0 extrusionOptions: + _selectedLayerName: extrusionType: 5 extrusionGeometryType: 0 propertyName: height + propertyDescription: minimumHeight: 0 maximumHeight: 2 + extrusionScaleFactor: 1 + colliderOptions: + colliderType: 0 materialOptions: - projectMapImagery: 0 texturingType: 0 materials: - Materials: @@ -197,9 +235,11 @@ MonoBehaviour: - Materials: - {fileID: 2100000, guid: 8e8afdee0a225a84282f04f2fb89b8b6, type: 2} atlasInfo: {fileID: 0} - colorPallete: {fileID: 0} + colorPalette: {fileID: 0} + honorBuildingIdSetting: 1 buildingsWithUniqueIds: 0 moveFeaturePositionTo: 0 MeshModifiers: [] GoModifiers: [] + locationPrefabList: [] _tileProvider: {fileID: 0} diff --git a/sdkproject/Assets/Mapbox/Prefabs/LocationBasedGame.prefab b/sdkproject/Assets/Mapbox/Prefabs/LocationBasedGame.prefab index 7c622650f..e85efa631 100644 --- a/sdkproject/Assets/Mapbox/Prefabs/LocationBasedGame.prefab +++ b/sdkproject/Assets/Mapbox/Prefabs/LocationBasedGame.prefab @@ -9,318 +9,348 @@ Prefab: m_Modifications: [] m_RemovedComponents: [] m_ParentPrefab: {fileID: 0} - m_RootGameObject: {fileID: 1617592976793816} + m_RootGameObject: {fileID: 1317352403415316} m_IsPrefabParent: 1 ---- !u!1 &1144877731728236 +--- !u!1 &1065618987163410 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4771038816137298} - - component: {fileID: 114276132085450664} - - component: {fileID: 114946137324152330} + - component: {fileID: 4961856903295740} + - component: {fileID: 114140835023345716} + - component: {fileID: 114668955501623132} m_Layer: 0 - m_Name: Map + m_Name: Player m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1244301553915122 +--- !u!1 &1094528686802348 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4811606232602884} - - component: {fileID: 114375948512099040} + - component: {fileID: 4310658642812482} + - component: {fileID: 114105500206378512} + - component: {fileID: 114086566548189782} m_Layer: 0 - m_Name: LocationProvider + m_Name: Map m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1470469369648722 +--- !u!1 &1155921098649226 GameObject: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4713072632087556} - - component: {fileID: 114549904832999176} + - component: {fileID: 4249158653028356} + - component: {fileID: 114357689223919402} m_Layer: 0 - m_Name: Transform + m_Name: Editor m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1612766928958954 +--- !u!1 &1317352403415316 GameObject: - m_ObjectHideFlags: 1 + m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4593755287268458} - - component: {fileID: 33309745773607608} - - component: {fileID: 135585466744663760} - - component: {fileID: 23053227593105678} + - component: {fileID: 4886150424162858} m_Layer: 0 - m_Name: Sphere + m_Name: LocationBasedGame m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1617592976793816 +--- !u!1 &1343136282922088 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4601654966360252} + - component: {fileID: 4499799956889190} + - component: {fileID: 114785114324483884} m_Layer: 0 - m_Name: LocationBasedGame + m_Name: LocationProvider m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1720180231397290 +--- !u!1 &1495889947503892 GameObject: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4829887955011164} - - component: {fileID: 114416722399334092} - - component: {fileID: 114190124198080348} + - component: {fileID: 4542949352487020} + - component: {fileID: 33635898767261260} + - component: {fileID: 65999262174974900} + - component: {fileID: 23386010693667174} m_Layer: 0 - m_Name: Player + m_Name: Cube m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1726675653975398 +--- !u!1 &1625832438174652 GameObject: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4884577364627856} - - component: {fileID: 114664232128227002} + - component: {fileID: 4168681940542294} + - component: {fileID: 33348043099498896} + - component: {fileID: 135296336305408694} + - component: {fileID: 23748609930179622} m_Layer: 0 - m_Name: Device + m_Name: Sphere m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1785722129054662 +--- !u!1 &1635791393252332 GameObject: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4335768556937342} - - component: {fileID: 33300521925899324} - - component: {fileID: 65727449930670870} - - component: {fileID: 23902153417493896} + - component: {fileID: 4779604382777758} + - component: {fileID: 114363624137296630} m_Layer: 0 - m_Name: Cube + m_Name: EditorLocationArray m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1845170286153142 +--- !u!1 &1671354315346450 GameObject: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4952890012315182} - - component: {fileID: 114586318175614768} + - component: {fileID: 4508123490764572} + - component: {fileID: 114159034711449820} m_Layer: 0 - m_Name: Editor + m_Name: Transform m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1941721888622076 +--- !u!1 &1784694379802654 GameObject: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4474331249895410} - - component: {fileID: 114497154541160862} + - component: {fileID: 4572037255418010} + - component: {fileID: 114472907270853152} m_Layer: 0 - m_Name: EditorLocationArray + m_Name: Device + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1844081552716966 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4385260180251512} + - component: {fileID: 114410157683913826} + m_Layer: 0 + m_Name: AndroidDevice m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &4335768556937342 +--- !u!4 &4168681940542294 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1785722129054662} + m_GameObject: {fileID: 1625832438174652} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 1.5, z: 0} - m_LocalScale: {x: 1, y: 3, z: 1} + m_LocalPosition: {x: 0, y: 4.14, z: 0} + m_LocalScale: {x: 2, y: 2, z: 2} m_Children: [] - m_Father: {fileID: 4829887955011164} - m_RootOrder: 0 + m_Father: {fileID: 4961856903295740} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4474331249895410 +--- !u!4 &4249158653028356 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1941721888622076} + m_GameObject: {fileID: 1155921098649226} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 4811606232602884} - m_RootOrder: 2 + m_Father: {fileID: 4499799956889190} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4593755287268458 +--- !u!4 &4310658642812482 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1612766928958954} + m_GameObject: {fileID: 1094528686802348} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 4.14, z: 0} - m_LocalScale: {x: 2, y: 2, z: 2} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 4829887955011164} - m_RootOrder: 1 + m_Father: {fileID: 4886150424162858} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!4 &4385260180251512 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1844081552716966} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -18.677399, y: 12.257265, z: 21.646572} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4499799956889190} + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4601654966360252 +--- !u!4 &4499799956889190 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1617592976793816} + m_GameObject: {fileID: 1343136282922088} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 4771038816137298} - - {fileID: 4829887955011164} - - {fileID: 4811606232602884} - m_Father: {fileID: 0} - m_RootOrder: 0 + - {fileID: 4572037255418010} + - {fileID: 4249158653028356} + - {fileID: 4779604382777758} + - {fileID: 4508123490764572} + - {fileID: 4385260180251512} + m_Father: {fileID: 4886150424162858} + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4713072632087556 +--- !u!4 &4508123490764572 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1470469369648722} + m_GameObject: {fileID: 1671354315346450} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 4811606232602884} + m_Father: {fileID: 4499799956889190} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4771038816137298 +--- !u!4 &4542949352487020 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1144877731728236} + m_GameObject: {fileID: 1495889947503892} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalPosition: {x: 0, y: 1.5, z: 0} + m_LocalScale: {x: 1, y: 3, z: 1} m_Children: [] - m_Father: {fileID: 4601654966360252} + m_Father: {fileID: 4961856903295740} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4811606232602884 +--- !u!4 &4572037255418010 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1244301553915122} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_GameObject: {fileID: 1784694379802654} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 4884577364627856} - - {fileID: 4952890012315182} - - {fileID: 4474331249895410} - - {fileID: 4713072632087556} - m_Father: {fileID: 4601654966360252} - m_RootOrder: 2 + m_Children: [] + m_Father: {fileID: 4499799956889190} + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4829887955011164 +--- !u!4 &4779604382777758 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1720180231397290} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_GameObject: {fileID: 1635791393252332} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 4335768556937342} - - {fileID: 4593755287268458} - m_Father: {fileID: 4601654966360252} - m_RootOrder: 1 + m_Children: [] + m_Father: {fileID: 4499799956889190} + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4884577364627856 +--- !u!4 &4886150424162858 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1726675653975398} + m_GameObject: {fileID: 1317352403415316} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 4811606232602884} + m_Children: + - {fileID: 4310658642812482} + - {fileID: 4961856903295740} + - {fileID: 4499799956889190} + m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4952890012315182 +--- !u!4 &4961856903295740 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1845170286153142} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_GameObject: {fileID: 1065618987163410} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 4811606232602884} + m_Children: + - {fileID: 4542949352487020} + - {fileID: 4168681940542294} + m_Father: {fileID: 4886150424162858} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!23 &23053227593105678 +--- !u!23 &23386010693667174 MeshRenderer: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1612766928958954} + m_GameObject: {fileID: 1495889947503892} m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 @@ -349,12 +379,12 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 ---- !u!23 &23902153417493896 +--- !u!23 &23748609930179622 MeshRenderer: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1785722129054662} + m_GameObject: {fileID: 1625832438174652} m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 @@ -383,52 +413,50 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 ---- !u!33 &33300521925899324 +--- !u!33 &33348043099498896 MeshFilter: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1785722129054662} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!33 &33309745773607608 + m_GameObject: {fileID: 1625832438174652} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &33635898767261260 MeshFilter: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1612766928958954} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!65 &65727449930670870 + m_GameObject: {fileID: 1495889947503892} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!65 &65999262174974900 BoxCollider: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1785722129054662} + m_GameObject: {fileID: 1495889947503892} m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &114190124198080348 +--- !u!114 &114086566548189782 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1720180231397290} + m_GameObject: {fileID: 1094528686802348} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 061d2afb48ace4fd19611279b6cf732f, type: 3} + m_Script: {fileID: 11500000, guid: 96f0fa82f89d64bb9a6524c72d538179, type: 3} m_Name: m_EditorClassIdentifier: - _rotationFollowFactor: 2 - _rotateZ: 0 - _useTransformLocationProvider: 0 ---- !u!114 &114276132085450664 + _map: {fileID: 114105500206378512} +--- !u!114 &114105500206378512 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1144877731728236} + m_GameObject: {fileID: 1094528686802348} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: cd961b1c9541a4cee99686069ecce852, type: 3} @@ -504,12 +532,37 @@ MonoBehaviour: wallMaterial: {fileID: 0} _vectorData: _layerProperty: - sourceType: 0 + tileJsonData: + tileJSONLoaded: 0 + LayerDisplayNames: + - admin + - aeroway + - airport_label + - barrier_line + - building + - country_label + - housenum_label + - landuse + - landuse_overlay + - marine_label + - motorway_junction + - mountain_peak_label + - place_label + - poi_label + - rail_station_label + - road + - road_label + - state_label + - water + - water_label + - waterway + - waterway_label + _sourceType: 1 sourceOptions: isActive: 1 layerSource: Name: Mapbox Terrain - Id: mapbox.3d-buildings,mapbox.mapbox-streets-v7 + Id: mapbox.mapbox-streets-v7 Modified: UserName: useOptimizedStyle: 0 @@ -522,40 +575,58 @@ MonoBehaviour: isEnabled: 1 entityPerCoroutine: 20 vectorSubLayers: [] + locationPrefabList: [] _tileProvider: {fileID: 0} ---- !u!114 &114375948512099040 +--- !u!114 &114140835023345716 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1244301553915122} + m_GameObject: {fileID: 1065618987163410} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b55f37f9a6f7e44f7bb35e6bc3863847, type: 3} + m_Script: {fileID: 11500000, guid: 7760043eea2cd452ba7117f2c97e0038, type: 3} m_Name: m_EditorClassIdentifier: - mapManager: {fileID: 114276132085450664} - _deviceLocationProvider: {fileID: 114664232128227002} - _editorLocationProvider: {fileID: 114586318175614768} - _transformLocationProvider: {fileID: 114549904832999176} - _dontDestroyOnLoad: 0 ---- !u!114 &114416722399334092 +--- !u!114 &114159034711449820 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1720180231397290} + m_GameObject: {fileID: 1671354315346450} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7760043eea2cd452ba7117f2c97e0038, type: 3} + m_Script: {fileID: 11500000, guid: a034c4eeb3293418aab101c1895844a4, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &114497154541160862 + _accuracy: 5 + _autoFireEvent: 1 + _updateInterval: 1 + _sendEvent: 0 + _targetTransform: {fileID: 4508123490764572} +--- !u!114 &114357689223919402 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1941721888622076} + m_GameObject: {fileID: 1155921098649226} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 60712efc3153a4819b0c79437175846d, type: 3} + m_Name: + m_EditorClassIdentifier: + _accuracy: 5 + _autoFireEvent: 1 + _updateInterval: 0.1 + _sendEvent: 0 + _latitudeLongitude: 37.784179, -122.401583 + _targetTransform: {fileID: 0} +--- !u!114 &114363624137296630 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1635791393252332} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 6b5c815d91f9d4c3690891f3ed4c3162, type: 3} @@ -570,70 +641,73 @@ MonoBehaviour: - 37.8045, -122.2714 - 37.2751, -121.8261 _heading: 0 ---- !u!114 &114549904832999176 +--- !u!114 &114410157683913826 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1470469369648722} + m_GameObject: {fileID: 1844081552716966} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a034c4eeb3293418aab101c1895844a4, type: 3} + m_Script: {fileID: 11500000, guid: d3d557417079b1446999d2d86ff71dfb, type: 3} m_Name: m_EditorClassIdentifier: - _accuracy: 5 - _autoFireEvent: 1 - _updateInterval: 1 - _sendEvent: 0 - _targetTransform: {fileID: 4713072632087556} ---- !u!114 &114586318175614768 + _updateDistanceInMeters: 0 + _updateTimeInMilliSeconds: 500 +--- !u!114 &114472907270853152 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1845170286153142} + m_GameObject: {fileID: 1784694379802654} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 60712efc3153a4819b0c79437175846d, type: 3} + m_Script: {fileID: 11500000, guid: 0a38712e93231418a84665190b8473d0, type: 3} m_Name: m_EditorClassIdentifier: - _accuracy: 5 - _autoFireEvent: 1 - _updateInterval: 0.1 - _sendEvent: 0 - _latitudeLongitude: 37.784179, -122.401583 - _targetTransform: {fileID: 0} ---- !u!114 &114664232128227002 + _desiredAccuracyInMeters: 5 + _updateDistanceInMeters: 5 + _updateTimeInMilliSeconds: 1000 +--- !u!114 &114668955501623132 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1726675653975398} + m_GameObject: {fileID: 1065618987163410} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0a38712e93231418a84665190b8473d0, type: 3} + m_Script: {fileID: 11500000, guid: 061d2afb48ace4fd19611279b6cf732f, type: 3} m_Name: m_EditorClassIdentifier: - _desiredAccuracyInMeters: 5 - _updateDistanceInMeters: 5 ---- !u!114 &114946137324152330 + _useDeviceOrientation: 0 + _subtractUserHeading: 0 + _rotationFollowFactor: 2 + _rotateZ: 0 + _useNegativeAngle: 0 + _useTransformLocationProvider: 0 +--- !u!114 &114785114324483884 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1144877731728236} + m_GameObject: {fileID: 1343136282922088} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 96f0fa82f89d64bb9a6524c72d538179, type: 3} + m_Script: {fileID: 11500000, guid: b55f37f9a6f7e44f7bb35e6bc3863847, type: 3} m_Name: m_EditorClassIdentifier: - _map: {fileID: 114276132085450664} ---- !u!135 &135585466744663760 + mapManager: {fileID: 114105500206378512} + _deviceLocationProviderUnity: {fileID: 114472907270853152} + _deviceLocationProviderAndroid: {fileID: 114410157683913826} + _editorLocationProvider: {fileID: 114357689223919402} + _transformLocationProvider: {fileID: 114159034711449820} + _dontDestroyOnLoad: 0 +--- !u!135 &135296336305408694 SphereCollider: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1612766928958954} + m_GameObject: {fileID: 1625832438174652} m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 diff --git a/sdkproject/Assets/Mapbox/Prefabs/LocationBasedGame.prefab.meta b/sdkproject/Assets/Mapbox/Prefabs/LocationBasedGame.prefab.meta index d74e47d65..45abf22a3 100644 --- a/sdkproject/Assets/Mapbox/Prefabs/LocationBasedGame.prefab.meta +++ b/sdkproject/Assets/Mapbox/Prefabs/LocationBasedGame.prefab.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: 35ce2bb4caba9434db5e656796b632b1 -timeCreated: 1520299781 +timeCreated: 1525982109 licenseType: Pro NativeFormatImporter: externalObjects: {} diff --git a/sdkproject/Assets/Mapbox/Prefabs/LocationProvider.prefab b/sdkproject/Assets/Mapbox/Prefabs/LocationProvider.prefab index 8eab03314..51534dc79 100644 --- a/sdkproject/Assets/Mapbox/Prefabs/LocationProvider.prefab +++ b/sdkproject/Assets/Mapbox/Prefabs/LocationProvider.prefab @@ -9,17 +9,17 @@ Prefab: m_Modifications: [] m_RemovedComponents: [] m_ParentPrefab: {fileID: 0} - m_RootGameObject: {fileID: 1272361454759174} + m_RootGameObject: {fileID: 1416727961367608} m_IsPrefabParent: 1 ---- !u!1 &1120511799638798 +--- !u!1 &1046170448184788 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4045234799362508} - - component: {fileID: 114809871893854336} + - component: {fileID: 4019558854643082} + - component: {fileID: 114130678780961324} m_Layer: 0 m_Name: Transform m_TagString: Untagged @@ -27,31 +27,31 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1224122296030366 +--- !u!1 &1207334365481040 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4409220587654606} - - component: {fileID: 114423560488577436} + - component: {fileID: 4294935352662412} + - component: {fileID: 114187476834979624} m_Layer: 0 - m_Name: EditorLocationArray + m_Name: Editor m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1272361454759174 +--- !u!1 &1416727961367608 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4427621322831674} - - component: {fileID: 114498049828617708} + - component: {fileID: 4159123312747552} + - component: {fileID: 114583243988831402} m_Layer: 0 m_Name: LocationProvider m_TagString: Untagged @@ -59,133 +59,159 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1705060952956876 +--- !u!1 &1847852291930120 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4763658247813634} - - component: {fileID: 114505449915863244} + - component: {fileID: 4177427197810144} + - component: {fileID: 114545615781169808} m_Layer: 0 - m_Name: Device + m_Name: AndroidDevice m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1850269189149406 +--- !u!1 &1900488794649394 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4977138286644978} - - component: {fileID: 114473036179376598} + - component: {fileID: 4411908722340444} + - component: {fileID: 114402126359314676} m_Layer: 0 - m_Name: Editor + m_Name: EditorLocationArray m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &4045234799362508 +--- !u!1 &1902945198530588 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4899644808510564} + - component: {fileID: 114360344600407074} + m_Layer: 0 + m_Name: Device + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4019558854643082 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1120511799638798} + m_GameObject: {fileID: 1046170448184788} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 4427621322831674} + m_Father: {fileID: 4159123312747552} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4409220587654606 +--- !u!4 &4159123312747552 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1224122296030366} + m_GameObject: {fileID: 1416727961367608} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 4427621322831674} - m_RootOrder: 2 + m_Children: + - {fileID: 4899644808510564} + - {fileID: 4294935352662412} + - {fileID: 4411908722340444} + - {fileID: 4019558854643082} + - {fileID: 4177427197810144} + m_Father: {fileID: 0} + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4427621322831674 +--- !u!4 &4177427197810144 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1272361454759174} + m_GameObject: {fileID: 1847852291930120} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -18.677399, y: 12.257265, z: 21.646572} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4159123312747552} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!4 &4294935352662412 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1207334365481040} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 4763658247813634} - - {fileID: 4977138286644978} - - {fileID: 4409220587654606} - - {fileID: 4045234799362508} - m_Father: {fileID: 0} - m_RootOrder: 0 + m_Children: [] + m_Father: {fileID: 4159123312747552} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4763658247813634 +--- !u!4 &4411908722340444 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1705060952956876} + m_GameObject: {fileID: 1900488794649394} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 4427621322831674} - m_RootOrder: 0 + m_Father: {fileID: 4159123312747552} + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4977138286644978 +--- !u!4 &4899644808510564 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1850269189149406} + m_GameObject: {fileID: 1902945198530588} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 4427621322831674} - m_RootOrder: 1 + m_Father: {fileID: 4159123312747552} + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &114423560488577436 +--- !u!114 &114130678780961324 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1224122296030366} + m_GameObject: {fileID: 1046170448184788} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 6b5c815d91f9d4c3690891f3ed4c3162, type: 3} + m_Script: {fileID: 11500000, guid: a034c4eeb3293418aab101c1895844a4, type: 3} m_Name: m_EditorClassIdentifier: _accuracy: 5 _autoFireEvent: 1 - _updateInterval: 2 + _updateInterval: 1 _sendEvent: 0 - _latitudeLongitude: - - 37.784179, -122.401583 - - 37.8045, -122.2714 - - 37.2751, -121.8261 - _heading: 0 ---- !u!114 &114473036179376598 + _targetTransform: {fileID: 4019558854643082} +--- !u!114 &114187476834979624 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1850269189149406} + m_GameObject: {fileID: 1207334365481040} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 60712efc3153a4819b0c79437175846d, type: 3} @@ -197,48 +223,67 @@ MonoBehaviour: _sendEvent: 0 _latitudeLongitude: 37.784179, -122.401583 _targetTransform: {fileID: 0} ---- !u!114 &114498049828617708 +--- !u!114 &114360344600407074 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1272361454759174} + m_GameObject: {fileID: 1902945198530588} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b55f37f9a6f7e44f7bb35e6bc3863847, type: 3} + m_Script: {fileID: 11500000, guid: 0a38712e93231418a84665190b8473d0, type: 3} m_Name: m_EditorClassIdentifier: - mapManager: {fileID: 0} - _deviceLocationProvider: {fileID: 114505449915863244} - _editorLocationProvider: {fileID: 114473036179376598} - _transformLocationProvider: {fileID: 114809871893854336} - _dontDestroyOnLoad: 0 ---- !u!114 &114505449915863244 + _desiredAccuracyInMeters: 5 + _updateDistanceInMeters: 5 + _updateTimeInMilliSeconds: 1000 +--- !u!114 &114402126359314676 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1705060952956876} + m_GameObject: {fileID: 1900488794649394} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0a38712e93231418a84665190b8473d0, type: 3} + m_Script: {fileID: 11500000, guid: 6b5c815d91f9d4c3690891f3ed4c3162, type: 3} m_Name: m_EditorClassIdentifier: - _desiredAccuracyInMeters: 5 - _updateDistanceInMeters: 5 ---- !u!114 &114809871893854336 + _accuracy: 5 + _autoFireEvent: 1 + _updateInterval: 2 + _sendEvent: 0 + _latitudeLongitude: + - 37.784179, -122.401583 + - 37.8045, -122.2714 + - 37.2751, -121.8261 + _heading: 0 +--- !u!114 &114545615781169808 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1120511799638798} + m_GameObject: {fileID: 1847852291930120} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a034c4eeb3293418aab101c1895844a4, type: 3} + m_Script: {fileID: 11500000, guid: d3d557417079b1446999d2d86ff71dfb, type: 3} m_Name: m_EditorClassIdentifier: - _accuracy: 5 - _autoFireEvent: 1 - _updateInterval: 1 - _sendEvent: 0 - _targetTransform: {fileID: 4045234799362508} + _updateDistanceInMeters: 0 + _updateTimeInMilliSeconds: 500 +--- !u!114 &114583243988831402 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1416727961367608} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b55f37f9a6f7e44f7bb35e6bc3863847, type: 3} + m_Name: + m_EditorClassIdentifier: + mapManager: {fileID: 0} + _deviceLocationProviderUnity: {fileID: 114360344600407074} + _deviceLocationProviderAndroid: {fileID: 114545615781169808} + _editorLocationProvider: {fileID: 114187476834979624} + _transformLocationProvider: {fileID: 114130678780961324} + _dontDestroyOnLoad: 0 diff --git a/sdkproject/Assets/Mapbox/Prefabs/LocationProvider.prefab.meta b/sdkproject/Assets/Mapbox/Prefabs/LocationProvider.prefab.meta index 49f7b58a7..e6aed19be 100644 --- a/sdkproject/Assets/Mapbox/Prefabs/LocationProvider.prefab.meta +++ b/sdkproject/Assets/Mapbox/Prefabs/LocationProvider.prefab.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 3397264ab835c4b6ebfa0ada67fd04cc -timeCreated: 1518112559 +guid: 2324d57a4bcc94288bc738d70731d7d3 +timeCreated: 1525981971 licenseType: Pro NativeFormatImporter: externalObjects: {} diff --git a/sdkproject/Assets/Mapbox/Prefabs/Map.prefab b/sdkproject/Assets/Mapbox/Prefabs/Map.prefab index d3e7310c2..db5d360d3 100644 --- a/sdkproject/Assets/Mapbox/Prefabs/Map.prefab +++ b/sdkproject/Assets/Mapbox/Prefabs/Map.prefab @@ -51,6 +51,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: cd961b1c9541a4cee99686069ecce852, type: 3} m_Name: m_EditorClassIdentifier: + _initializeOnStart: 1 _options: locationOptions: latitudeLongitude: 37.784179, -122.401583 @@ -80,7 +81,7 @@ MonoBehaviour: loadingTexture: {fileID: 2800000, guid: e2896a92727704803a9c422b043eae89, type: 3} _imagery: _layerProperty: - sourceType: 0 + sourceType: 7 sourceOptions: isActive: 1 layerSource: @@ -120,7 +121,10 @@ MonoBehaviour: wallMaterial: {fileID: 0} _vectorData: _layerProperty: - sourceType: 3 + tileJsonData: + tileJSONLoaded: 0 + LayerDisplayNames: [] + _sourceType: 3 sourceOptions: isActive: 0 layerSource: @@ -138,4 +142,5 @@ MonoBehaviour: isEnabled: 1 entityPerCoroutine: 20 vectorSubLayers: [] + locationPrefabList: [] _tileProvider: {fileID: 0} diff --git a/sdkproject/Assets/Mapbox/README.txt b/sdkproject/Assets/Mapbox/README.txt index 006b591be..afd6da019 100644 --- a/sdkproject/Assets/Mapbox/README.txt +++ b/sdkproject/Assets/Mapbox/README.txt @@ -1,7 +1,7 @@ -Thank you for downloading the Mapbox Unity SDK (for Unity 2017.1+)! +Thank you for downloading the Mapbox Unity SDK (for Unity 2017.1+)! -Getting started: https://www.mapbox.com/mapbox-unity-sdk/docs/00-getting-started.html +Getting started: https://www.mapbox.com/unity-sdk/overview/#getting-started Tutorials: https://www.mapbox.com/unity-sdk/tutorials/ @@ -11,13 +11,13 @@ API: https://www.mapbox.com/mapbox-unity-sdk/api/ -Current version: 1.3.0, as of 12/08/2017 +Current version: 1.4.2, as of May 14th, 2018 Changelog: https://www.mapbox.com/mapbox-unity-sdk/docs/05-changelog.html -IMPORTANT: +IMPORTANT: If you intend to deploy for Android, please set your minimum version to 15 in PlayerSettings. For iOS, please set your minimum version to 8. -If you have any other issues or feedback, please contact us at https://www.mapbox.com/contact/ -or check our public repository: https://github.com/mapbox/mapbox-unity-sdk/issues. \ No newline at end of file +If you have any other issues or feedback, please contact us at https://www.mapbox.com/contact/ +or check our public repository: https://github.com/mapbox/mapbox-unity-sdk/issues. diff --git a/sdkproject/Assets/Mapbox/Unity/Constants.cs b/sdkproject/Assets/Mapbox/Unity/Constants.cs index 3b36759d2..0bac94b2b 100644 --- a/sdkproject/Assets/Mapbox/Unity/Constants.cs +++ b/sdkproject/Assets/Mapbox/Unity/Constants.cs @@ -4,7 +4,7 @@ namespace Mapbox.Unity public static class Constants { - public const string SDK_VERSION = "1.4.1"; + public const string SDK_VERSION = "1.4.2"; public static class Path { diff --git a/sdkproject/Assets/Mapbox/Unity/DataContainers/GeometryExtrusionOptions.cs b/sdkproject/Assets/Mapbox/Unity/DataContainers/GeometryExtrusionOptions.cs index 71189adae..d434330c2 100644 --- a/sdkproject/Assets/Mapbox/Unity/DataContainers/GeometryExtrusionOptions.cs +++ b/sdkproject/Assets/Mapbox/Unity/DataContainers/GeometryExtrusionOptions.cs @@ -15,10 +15,14 @@ public override Type ModifierType return typeof(HeightModifier); } } + + [SerializeField] + private string _selectedLayerName; public ExtrusionType extrusionType = ExtrusionType.None; public ExtrusionGeometryType extrusionGeometryType = ExtrusionGeometryType.RoofAndSide; [Tooltip("Property name in feature layer to use for extrusion.")] public string propertyName = "height"; + public string propertyDescription = ""; public float minimumHeight = 0f; public float maximumHeight = 0f; [Tooltip("Scale factor to multiply the extrusion value of the feature.")] @@ -40,6 +44,7 @@ public override Type ModifierType public ExtrusionType extrusionType = ExtrusionType.None; public ExtrusionGeometryType extrusionGeometryType = ExtrusionGeometryType.RoofAndSide; public string propertyName = "height"; + public string propertyDescription = ""; public float minimumHeight = 0f; public float maximumHeight = 0f; public float extrusionScaleFactor = 1f; diff --git a/sdkproject/Assets/Mapbox/Unity/DataContainers/LocationPrefabCategoryOptions.cs b/sdkproject/Assets/Mapbox/Unity/DataContainers/LocationPrefabCategoryOptions.cs new file mode 100644 index 000000000..1b2c121fd --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/DataContainers/LocationPrefabCategoryOptions.cs @@ -0,0 +1,72 @@ +namespace Mapbox.Unity.Map +{ + using UnityEngine; + using System.Collections.Generic; + + public static class LocationPrefabCategoryOptions + { + + static LocationPrefabCategoryOptions() + { + PopulateCategoriesToMakiDictionary(); + } + + private static Dictionary> CategoriesToMakiDictionary = new Dictionary> + { + {LocationPrefabCategories.ArtsAndEntertainment,new List{"art-gallery", "cinema", "stadium", "museum", "library", "zoo", "music", "theatre", "amusement-park"}}, + {LocationPrefabCategories.Food,new List{"cafe", "bakery", "fast-food", "grocery", "ice-cream", "restaurant"}}, + {LocationPrefabCategories.Nightlife,new List{"bar", "beer"}}, + {LocationPrefabCategories.OutdoorsAndRecreation,new List{"aquarium", "campsite", "attraction", "castle", "cemetery", "dog-park", "drinking-water", "garden", "golf", "monument", "park", "picnic-site", "playground", "swimming"}}, + {LocationPrefabCategories.Services,new List{"bank", "dentist", "toilet", "veterinary", "pharmacy", "college", "school", "hospital", "place-of-worship", "religious-christian", "religious-jewish", "religious-muslim", "police", "post", "doctor", "fire-station", "information", "town-hall", "prison", "embassy", "fuel", "laundry", "lodging"}}, + {LocationPrefabCategories.Shops,new List{"alcohol-shop", "clothing-store", "shop"}}, + {LocationPrefabCategories.Transportation,new List{"bus", "car", "bicycle-share", "bicycle", "airfield", "ferry", "harbor", "heliport"}}, + }; + + private static Dictionary MakiToCategoriesDictionary = new Dictionary(); + + + //Creates a reverse reference from the CategoriesToMakiDictionary + private static void PopulateCategoriesToMakiDictionary () + { + foreach(var item in CategoriesToMakiDictionary) + { + foreach(string makiTag in item.Value) + { + if (!MakiToCategoriesDictionary.ContainsKey(makiTag)) + { + MakiToCategoriesDictionary.Add(makiTag, item.Key); + } + } + } + } + + /// + /// Gets the maki tags list from a category + /// + /// The list of maki tags from supplied category. + /// + public static List GetMakiListFromCategory(LocationPrefabCategories category) + { + List returnList = new List(); + + CategoriesToMakiDictionary.TryGetValue(category, out returnList); + + return returnList; + } + + /// + /// Gets the category that the maki tag belongs to. + /// + /// The category from maki tag. + /// Maki tag + public static LocationPrefabCategories GetCategoryFromMakiTag(string makiTag) + { + LocationPrefabCategories returnCategory; + + if (MakiToCategoriesDictionary.TryGetValue(makiTag, out returnCategory)) + return returnCategory; + + return LocationPrefabCategories.AnyCategory; + } + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/DataContainers/LocationPrefabCategoryOptions.cs.meta b/sdkproject/Assets/Mapbox/Unity/DataContainers/LocationPrefabCategoryOptions.cs.meta new file mode 100644 index 000000000..6b846f0bc --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/DataContainers/LocationPrefabCategoryOptions.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: fcad5e29c050446fb8a3d19a42549875 +timeCreated: 1523660773 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/DataContainers/MapboxEnums.cs b/sdkproject/Assets/Mapbox/Unity/DataContainers/MapboxEnums.cs index e35685c45..2aa0260c4 100644 --- a/sdkproject/Assets/Mapbox/Unity/DataContainers/MapboxEnums.cs +++ b/sdkproject/Assets/Mapbox/Unity/DataContainers/MapboxEnums.cs @@ -176,4 +176,27 @@ public enum ColliderType [Description("Sphere collider added to the GameObject.")] SphereCollider, } + + public enum LocationPrefabFindBy + { + [Description("Display points of interest based on a choice of categories")] + MapboxCategory, + [Description("Display points of interest based on name")] + POIName, + [Description("Display points of interest at specific address or geographical co-ordinates on the map")] + AddressOrLatLon, + } + + public enum LocationPrefabCategories + { + None = 0, + AnyCategory = ~0, + ArtsAndEntertainment = 1 << 0, + Food = 1 << 1, + Nightlife = 1 << 2, + OutdoorsAndRecreation = 1 << 3, + Services = 1 << 4, + Shops = 1 << 5, + Transportation = 1 << 6 + } } diff --git a/sdkproject/Assets/Mapbox/Unity/DataContainers/SpawnPrefabOptions.cs b/sdkproject/Assets/Mapbox/Unity/DataContainers/SpawnPrefabOptions.cs new file mode 100644 index 000000000..2808b5a68 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/DataContainers/SpawnPrefabOptions.cs @@ -0,0 +1,26 @@ +namespace Mapbox.Unity.Map +{ + using System.Collections; + using System.Collections.Generic; + using UnityEngine; + using Mapbox.Unity.MeshGeneration.Modifiers; + using System; + using Mapbox.Unity.Map; + + [Serializable] + public class SpawnPrefabOptions : ModifierProperties + { + public override Type ModifierType + { + get + { + return typeof(PrefabModifier); + } + } + + public GameObject prefab; + public bool scaleDownWithWorld = true; + [NonSerialized] + public Action> AllPrefabsInstatiated = delegate { }; + } +} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/DataContainers/SpawnPrefabOptions.cs.meta b/sdkproject/Assets/Mapbox/Unity/DataContainers/SpawnPrefabOptions.cs.meta new file mode 100644 index 000000000..86c84de8c --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/DataContainers/SpawnPrefabOptions.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: ae0dbe1711e344fd9908394c6270d93a +timeCreated: 1523916609 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/DataContainers/TileJsonData.cs b/sdkproject/Assets/Mapbox/Unity/DataContainers/TileJsonData.cs new file mode 100644 index 000000000..dcec5fb7f --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/DataContainers/TileJsonData.cs @@ -0,0 +1,190 @@ +namespace Mapbox.Unity.Map +{ + using System; + using System.Collections.Generic; + using Mapbox.Platform.TilesetTileJSON; + using UnityEngine; + + [Serializable] + public class TileJsonData + { + public readonly string commonLayersKey = "(layer found in more than one data source)"; + public readonly string optionalPropertiesString = "(may not appear across all locations)"; + /// + /// This boolean is to check if tile JSON data has loaded after the data source has changed + /// + public bool tileJSONLoaded = false; + + /// + /// Layer Display Names seen in the editor + /// + public List LayerDisplayNames = new List(); + + /// + /// Property Display Names seen in the editor + /// + public Dictionary> PropertyDisplayNames = new Dictionary>(); + + /// + /// The description of the property in a layer + /// + public Dictionary> LayerPropertyDescriptionDictionary = new Dictionary>(); + + /// + /// List of data sources (tileset ids) linked to a layer name + /// + public Dictionary> LayerSourcesDictionary = new Dictionary>(); + + /// + /// Dictionary containting the list of layers in a source + /// + public Dictionary> SourceLayersDictionary = new Dictionary>(); + + public void ClearData() + { + tileJSONLoaded = false; + LayerPropertyDescriptionDictionary.Clear(); + LayerSourcesDictionary.Clear(); + SourceLayersDictionary.Clear(); + LayerDisplayNames.Clear(); + PropertyDisplayNames.Clear(); + } + + public void ProcessTileJSONData(TileJSONResponse tjr) + { + tileJSONLoaded = true; + List layerPropertiesList = new List(); + // Un-comment if required. Throws a warning right now. + //List sourceLayersList = new List(); + + if (tjr == null || tjr.VectorLayers == null || tjr.VectorLayers.Length == 0) + { + return; + } + + ClearData(); + + var propertyName = ""; + var propertyDescription = ""; + var layerSource = ""; + + foreach (var layer in tjr.VectorLayers) + { + //load layer names + var layerName = layer.Id; + layerPropertiesList = new List(); + layerSource = layer.Source; + //if (layer.Fields.Count == 0) + //continue; + + //loading layer sources + if (LayerSourcesDictionary.ContainsKey(layerName)) + { + LayerSourcesDictionary[layerName].Add(layerSource); + } + else + { + LayerSourcesDictionary.Add(layerName, new List() { layerSource }); + } + + //loading layers to a data source + if (SourceLayersDictionary.ContainsKey(layerSource)) + { + List sourceList = new List(); + LayerSourcesDictionary.TryGetValue(layerName, out sourceList); + + if (sourceList.Count > 1 && sourceList.Contains(layerSource)) // the current layerName has more than one source + { + if (SourceLayersDictionary.ContainsKey(commonLayersKey)) + { + SourceLayersDictionary[commonLayersKey].Add(layerName); + } + else + { + SourceLayersDictionary.Add(commonLayersKey, new List() { layerName }); + } + + if (LayerDisplayNames.Contains(layerName)) + { + LayerDisplayNames.Remove(layerName); + } + LayerDisplayNames.Add(layerName); + // LayerDisplayNames.Add(layerName + " " + commonLayersKey); + } + else + { + SourceLayersDictionary[layerSource].Add(layerName); + LayerDisplayNames.Add(layerName); + } + } + else + { + SourceLayersDictionary.Add(layerSource, new List() { layerName }); + LayerDisplayNames.Add(layerName); + } + + + //Load properties + foreach (var property in layer.Fields) + { + propertyName = property.Key; + propertyDescription = property.Value; + layerPropertiesList.Add(propertyName); + + //adding property descriptions + if (LayerPropertyDescriptionDictionary.ContainsKey(layerName)) + { + if (!LayerPropertyDescriptionDictionary[layerName].ContainsKey(propertyName)) + { + LayerPropertyDescriptionDictionary[layerName].Add(propertyName, propertyDescription); + } + } + else + { + LayerPropertyDescriptionDictionary.Add(layerName, new Dictionary() { { propertyName, propertyDescription } }); + } + + //Loading display names for properties + if (PropertyDisplayNames.ContainsKey(layerName)) + { + if (!PropertyDisplayNames[layerName].Contains(propertyName)) + { + PropertyDisplayNames[layerName].Add(propertyName); + + //logic to add the list of masked properties from all sources that are not #1 + if (LayerSourcesDictionary[layerName].Count > 1 && !string.IsNullOrEmpty(tjr.Source)) + { + var firstSource = tjr.Source.Split(new string[] { "," }, System.StringSplitOptions.None)[0].Trim(); + if (layerSource != firstSource) + { + if (PropertyDisplayNames[layerName].Contains(propertyName)) + { + PropertyDisplayNames[layerName].Remove(propertyName); + } + + PropertyDisplayNames[layerName].Add(propertyName); + //PropertyDisplayNames[layerName].Add(propertyName + " " + optionalPropertiesString); + } + } + } + } + else + { + PropertyDisplayNames.Add(layerName, new List { propertyName }); + } + } + + if (PropertyDisplayNames.ContainsKey(layerName) && PropertyDisplayNames[layerName].Count > 1) + { + PropertyDisplayNames[layerName].Sort(); + } + } + + + if (LayerDisplayNames.Count > 1) + { + LayerDisplayNames.Sort(); + } + } + } +} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/DataContainers/TileJsonData.cs.meta b/sdkproject/Assets/Mapbox/Unity/DataContainers/TileJsonData.cs.meta new file mode 100644 index 000000000..2d8b785ff --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/DataContainers/TileJsonData.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 52cf051b4afa24ba6895b9a42b179eed +timeCreated: 1524801966 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/FeatureSubLayerTreeView.cs b/sdkproject/Assets/Mapbox/Unity/Editor/FeatureSubLayerTreeView.cs new file mode 100644 index 000000000..fdd9777b2 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/FeatureSubLayerTreeView.cs @@ -0,0 +1,151 @@ +namespace Mapbox.Editor +{ + using System.Collections; + using System.Collections.Generic; + using UnityEngine; + using UnityEditor.IMGUI.Controls; + using UnityEditor; + using Mapbox.Unity.Map; + + public class FeatureSubLayerTreeView : TreeView + { + public SerializedProperty Layers; + private float kToggleWidth = 18f; + public int uniqueId = 3000; + public FeatureSubLayerTreeView(TreeViewState state) + : base(state) + { + //uniqueId = treeViewControlID; + showAlternatingRowBackgrounds = true; + showBorder = true; + Reload(); + + } + + protected override TreeViewItem BuildRoot() + { + // The root item is required to have a depth of -1, and the rest of the items increment from that. + var root = new TreeViewItem { id = -1, depth = -1, displayName = "Root" }; + + var items = new List(); + var index = 0; + + if (Layers != null) + { + for (int i = 0; i < Layers.arraySize; i++) + { + var name = Layers.GetArrayElementAtIndex(i).FindPropertyRelative("coreOptions.sublayerName").stringValue; + items.Add(new TreeViewItem { id = index + uniqueId, depth = 1, displayName = name }); + index++; + } + } + + // Utility method that initializes the TreeViewItem.children and .parent for all items. + SetupParentsAndChildrenFromDepths(root, items); + + // Return root of the tree + return root; + } + + protected override bool CanRename(TreeViewItem item) + { + return true; + } + + protected override void RenameEnded(RenameEndedArgs args) + { + if (Layers == null) + { + return; + } + + var layer = Layers.GetArrayElementAtIndex(args.itemID - uniqueId); + layer.FindPropertyRelative("coreOptions.sublayerName").stringValue = string.IsNullOrEmpty(args.newName.Trim()) ? args.originalName : args.newName; + } + + protected override void RowGUI(RowGUIArgs args) + { + Rect toggleRect = args.rowRect; + toggleRect.width = kToggleWidth; + var item = Layers.GetArrayElementAtIndex(args.item.id - uniqueId); + item.FindPropertyRelative("coreOptions.isActive").boolValue = EditorGUI.Toggle(toggleRect, item.FindPropertyRelative("coreOptions.isActive").boolValue); + args.item.displayName = item.FindPropertyRelative("coreOptions.sublayerName").stringValue; + base.RowGUI(args); + } + } +} +namespace Mapbox.Editor +{ + using System.Collections; + using System.Collections.Generic; + using UnityEngine; + using UnityEditor.IMGUI.Controls; + using UnityEditor; + using Mapbox.Unity.Map; + + public class PointsOfInterestSubLayerTreeView : TreeView + { + public SerializedProperty Layers; + private float kToggleWidth = 18f; + private const int uniqueId = 0;//100000; + + public PointsOfInterestSubLayerTreeView(TreeViewState state) + : base(state) + { + showAlternatingRowBackgrounds = true; + showBorder = true; + Reload(); + } + + protected override TreeViewItem BuildRoot() + { + // The root item is required to have a depth of -1, and the rest of the items increment from that. + var root = new TreeViewItem { id = -1, depth = -1, displayName = "Root" }; + + var items = new List(); + var index = 0; + + if (Layers != null) + { + for (int i = 0; i < Layers.arraySize; i++) + { + var name = Layers.GetArrayElementAtIndex(i).FindPropertyRelative("coreOptions.sublayerName").stringValue; + items.Add(new TreeViewItem { id = index + uniqueId, depth = 1, displayName = name }); + index++; + } + } + + // Utility method that initializes the TreeViewItem.children and .parent for all items. + SetupParentsAndChildrenFromDepths(root, items); + + // Return root of the tree + return root; + } + + protected override bool CanRename(TreeViewItem item) + { + return true; + } + + protected override void RenameEnded(RenameEndedArgs args) + { + if (Layers == null) + { + return; + } + + var layer = Layers.GetArrayElementAtIndex(args.itemID - uniqueId); + layer.FindPropertyRelative("coreOptions.sublayerName").stringValue = string.IsNullOrEmpty(args.newName.Trim()) ? args.originalName : args.newName; + } + + protected override void RowGUI(RowGUIArgs args) + { + Rect toggleRect = args.rowRect; + toggleRect.width = kToggleWidth; + var item = Layers.GetArrayElementAtIndex(args.item.id - uniqueId); + item.FindPropertyRelative("coreOptions.isActive").boolValue = EditorGUI.Toggle(toggleRect, item.FindPropertyRelative("coreOptions.isActive").boolValue); + args.item.displayName = item.FindPropertyRelative("coreOptions.sublayerName").stringValue; + base.RowGUI(args); + } + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/FeatureSubLayerTreeView.cs.meta b/sdkproject/Assets/Mapbox/Unity/Editor/FeatureSubLayerTreeView.cs.meta new file mode 100644 index 000000000..32b2cc3e2 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/FeatureSubLayerTreeView.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 6959c2320c56c4d89be4ff0e9d2a1b73 +timeCreated: 1525818947 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/FlatSphereTerrainFactoryEditor.cs b/sdkproject/Assets/Mapbox/Unity/Editor/FlatSphereTerrainFactoryEditor.cs deleted file mode 100644 index 8cd015ead..000000000 --- a/sdkproject/Assets/Mapbox/Unity/Editor/FlatSphereTerrainFactoryEditor.cs +++ /dev/null @@ -1,38 +0,0 @@ -namespace Mapbox.Editor -{ - using UnityEngine; - using UnityEditor; - using Mapbox.Unity.MeshGeneration.Factories; - using Mapbox.Unity.Map; - - [CustomEditor(typeof(FlatSphereTerrainFactory))] - public class FlatSphereTerrainFactoryEditor : FactoryEditor - { - public SerializedProperty layerProperties; - - private MonoScript script; - - void OnEnable() - { - layerProperties = serializedObject.FindProperty("_elevationOptions"); - var terrainType = layerProperties.FindPropertyRelative("elevationLayerType"); - terrainType.enumValueIndex = (int)ElevationLayerType.GlobeTerrain; - - script = MonoScript.FromScriptableObject((FlatSphereTerrainFactory)target); - } - - public override void OnInspectorGUI() - { - serializedObject.Update(); - - GUI.enabled = false; - script = EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false) as MonoScript; - GUI.enabled = true; - EditorGUILayout.Space(); - EditorGUILayout.PropertyField(layerProperties); - EditorGUILayout.Space(); - - serializedObject.ApplyModifiedProperties(); - } - } -} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/FlatSphereTerrainFactoryEditor.cs.meta b/sdkproject/Assets/Mapbox/Unity/Editor/FlatSphereTerrainFactoryEditor.cs.meta deleted file mode 100644 index 1757f6c5a..000000000 --- a/sdkproject/Assets/Mapbox/Unity/Editor/FlatSphereTerrainFactoryEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1ae8d3eabc0344593b4b8d02c19bf67d -timeCreated: 1501082693 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/FlatTerrainFactoryEditor.cs b/sdkproject/Assets/Mapbox/Unity/Editor/FlatTerrainFactoryEditor.cs deleted file mode 100644 index 84889b3fc..000000000 --- a/sdkproject/Assets/Mapbox/Unity/Editor/FlatTerrainFactoryEditor.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Mapbox.Editor -{ - using UnityEngine; - using UnityEditor; - using Mapbox.Unity.MeshGeneration.Factories; - using Mapbox.Unity.Map; - - [CustomEditor(typeof(FlatTerrainFactory))] - public class FlatTerrainFactoryEditor : FactoryEditor - { - public SerializedProperty layerProperties; - private MonoScript script; - - void OnEnable() - { - layerProperties = serializedObject.FindProperty("_elevationOptions"); - var terrainType = layerProperties.FindPropertyRelative("elevationLayerType"); - terrainType.enumValueIndex = (int)ElevationLayerType.FlatTerrain; - script = MonoScript.FromScriptableObject((FlatTerrainFactory)target); - } - - public override void OnInspectorGUI() - { - serializedObject.Update(); - - GUI.enabled = false; - script = EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false) as MonoScript; - GUI.enabled = true; - EditorGUILayout.Space(); - EditorGUILayout.PropertyField(layerProperties); - EditorGUILayout.Space(); - - serializedObject.ApplyModifiedProperties(); - } - } -} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/FlatTerrainFactoryEditor.cs.meta b/sdkproject/Assets/Mapbox/Unity/Editor/FlatTerrainFactoryEditor.cs.meta deleted file mode 100644 index d17d885db..000000000 --- a/sdkproject/Assets/Mapbox/Unity/Editor/FlatTerrainFactoryEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 453eec5ac1ffe4117a19cd397e6956a3 -timeCreated: 1495569574 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/GeocodeAttributeSearchWindow.cs b/sdkproject/Assets/Mapbox/Unity/Editor/GeocodeAttributeSearchWindow.cs index 260480cfa..0f1ae207d 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/GeocodeAttributeSearchWindow.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/GeocodeAttributeSearchWindow.cs @@ -2,6 +2,7 @@ { using UnityEngine; using UnityEditor; + using System; using System.Collections.Generic; using Mapbox.Geocoding; using Mapbox.Unity; @@ -9,7 +10,7 @@ public class GeocodeAttributeSearchWindow : EditorWindow { - SerializedProperty _property; + SerializedProperty _coordinateProperty; string _searchInput = ""; @@ -42,7 +43,7 @@ public static void Open(SerializedProperty property) { GeocodeAttributeSearchWindow window = EditorWindow.GetWindow(true, "Search for location"); - window._property = property; + window._coordinateProperty = property; Event e = Event.current; Vector2 mousePos = GUIUtility.GUIToScreenPoint(e.mousePosition); @@ -83,15 +84,42 @@ void OnGUI() { Feature feature = _features[i]; string coordinates = feature.Center.x.ToString(CultureInfo.InvariantCulture) + ", " + - feature.Center.y.ToString(CultureInfo.InvariantCulture); - string buttonContent = feature.Address + " (" + coordinates + ")"; + feature.Center.y.ToString(CultureInfo.InvariantCulture); - if (GUILayout.Button(buttonContent)) + //abreviated coords for display in the UI + string truncatedCoordinates = feature.Center.x.ToString("F2", CultureInfo.InvariantCulture) + ", " + + feature.Center.y.ToString("F2", CultureInfo.InvariantCulture); + + //split feature name and add elements until the maxButtonContentLenght is exceeded + string[] featureNameSplit = feature.PlaceName.Split(','); + string buttonContent = ""; + int maxButtonContentLength = 30; + for (int j = 0; j < featureNameSplit.Length; j++) + { + if(buttonContent.Length + featureNameSplit[j].Length < maxButtonContentLength) + { + if(String.IsNullOrEmpty(buttonContent)) + { + buttonContent = featureNameSplit[j]; + } + else + { + buttonContent = buttonContent + "," + featureNameSplit[j]; + } + } + } + + if (buttonContent.Length < maxButtonContentLength + 15) { - _property.stringValue = coordinates; + buttonContent = buttonContent + "," + " (" + truncatedCoordinates + ")"; + } - _property.serializedObject.ApplyModifiedProperties(); - EditorUtility.SetDirty(_property.serializedObject.targetObject); + + if (GUILayout.Button(buttonContent)) + { + _coordinateProperty.stringValue = coordinates; + _coordinateProperty.serializedObject.ApplyModifiedProperties(); + EditorUtility.SetDirty(_coordinateProperty.serializedObject.targetObject); Close(); } @@ -127,9 +155,14 @@ void HandleUserInput(string searchString) void HandleGeocoderResponse(ForwardGeocodeResponse res) { + //null if no internet connection if (res != null) { - _features = res.Features; + //null if invalid token + if (res.Features != null) + { + _features = res.Features; + } } _isSearching = false; this.Repaint(); diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/LowPolyTerrainFactoryEditor.cs b/sdkproject/Assets/Mapbox/Unity/Editor/LowPolyTerrainFactoryEditor.cs deleted file mode 100644 index 5bf21e326..000000000 --- a/sdkproject/Assets/Mapbox/Unity/Editor/LowPolyTerrainFactoryEditor.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Mapbox.Editor -{ - using UnityEngine; - using UnityEditor; - using Mapbox.Unity.MeshGeneration.Factories; - using Mapbox.Unity.Map; - - [CustomEditor(typeof(LowPolyTerrainFactory))] - public class LowPolyTerrainFactoryEditor : FactoryEditor - { - public SerializedProperty layerProperties; - private MonoScript script; - - void OnEnable() - { - layerProperties = serializedObject.FindProperty("_elevationOptions"); - var terrainType = layerProperties.FindPropertyRelative("elevationLayerType"); - terrainType.enumValueIndex = (int)ElevationLayerType.LowPolygonTerrain; - - script = MonoScript.FromScriptableObject((LowPolyTerrainFactory)target); - } - - public override void OnInspectorGUI() - { - serializedObject.Update(); - - GUI.enabled = false; - script = EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false) as MonoScript; - GUI.enabled = true; - EditorGUILayout.Space(); - EditorGUILayout.PropertyField(layerProperties); - EditorGUILayout.Space(); - - serializedObject.ApplyModifiedProperties(); - } - } -} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/LowPolyTerrainFactoryEditor.cs.meta b/sdkproject/Assets/Mapbox/Unity/Editor/LowPolyTerrainFactoryEditor.cs.meta deleted file mode 100644 index 2b42daeb0..000000000 --- a/sdkproject/Assets/Mapbox/Unity/Editor/LowPolyTerrainFactoryEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 94b2783afb8700b4a857a77b0b87f846 -timeCreated: 1495569574 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/MapManagerEditor.cs b/sdkproject/Assets/Mapbox/Unity/Editor/MapManagerEditor.cs index 8edf352e2..aa8030f7b 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/MapManagerEditor.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/MapManagerEditor.cs @@ -3,11 +3,16 @@ using UnityEngine; using UnityEditor; using Mapbox.Unity.Map; + using Mapbox.Platform.TilesetTileJSON; + using System.Collections.Generic; + using Mapbox.VectorTile.ExtensionMethods; [CustomEditor(typeof(AbstractMap))] [CanEditMultipleObjects] public class MapManagerEditor : Editor { + + private string objectId = ""; /// /// Gets or sets a value indicating whether to show general section . /// @@ -16,11 +21,11 @@ bool ShowGeneral { get { - return EditorPrefs.GetBool("MapManagerEditor_showGeneral"); + return EditorPrefs.GetBool(objectId + "MapManagerEditor_showGeneral"); } set { - EditorPrefs.SetBool("MapManagerEditor_showGeneral", value); + EditorPrefs.SetBool(objectId + "MapManagerEditor_showGeneral", value); } } /// @@ -31,11 +36,11 @@ bool ShowImage { get { - return EditorPrefs.GetBool("MapManagerEditor_showImage"); + return EditorPrefs.GetBool(objectId + "MapManagerEditor_showImage"); } set { - EditorPrefs.SetBool("MapManagerEditor_showImage", value); + EditorPrefs.SetBool(objectId + "MapManagerEditor_showImage", value); } } /// @@ -46,26 +51,27 @@ bool ShowTerrain { get { - return EditorPrefs.GetBool("MapManagerEditor_showTerrain"); + return EditorPrefs.GetBool(objectId + "MapManagerEditor_showTerrain"); } set { - EditorPrefs.SetBool("MapManagerEditor_showTerrain", value); + EditorPrefs.SetBool(objectId + "MapManagerEditor_showTerrain", value); } } + /// - /// Gets or sets a value to show or hide Vector section . + /// Gets or sets a value to show or hide Map Layers section show features. /// - /// true if show vector; otherwise, false. - bool ShowVector + /// true if show features; otherwise, false. + bool ShowMapLayers { get { - return EditorPrefs.GetBool("MapManagerEditor_showVector"); + return EditorPrefs.GetBool(objectId + "MapManagerEditor_showMapLayers"); } set { - EditorPrefs.SetBool("MapManagerEditor_showVector", value); + EditorPrefs.SetBool(objectId + "MapManagerEditor_showMapLayers", value); } } @@ -73,78 +79,43 @@ bool ShowPosition { get { - return EditorPrefs.GetBool("MapManagerEditor_showPosition"); + return EditorPrefs.GetBool(objectId + "MapManagerEditor_showPosition"); } set { - EditorPrefs.SetBool("MapManagerEditor_showPosition", value); + EditorPrefs.SetBool(objectId + "MapManagerEditor_showPosition", value); } } + private GUIContent mapIdGui = new GUIContent + { + text = "Map Id", + tooltip = "Map Id corresponding to the tileset." + }; + + bool _isGUIContentSet = false; + GUIContent[] _sourceTypeContent; + static float _lineHeight = EditorGUIUtility.singleLineHeight; + public override void OnInspectorGUI() { + objectId = serializedObject.targetObject.GetInstanceID().ToString(); serializedObject.Update(); - GUILayout.BeginVertical(); + EditorGUILayout.BeginVertical(); EditorGUILayout.Space(); ShowGeneral = EditorGUILayout.Foldout(ShowGeneral, new GUIContent { text = "GENERAL", tooltip = "Options related to map data" }); + if (ShowGeneral) { - //EditorGUILayout.Space(); - //EditorGUILayout.LabelField("Presets"); - //selected = property.FindPropertyRelative("mapPreset").enumValueIndex; - //var options = property.FindPropertyRelative("mapPreset").enumDisplayNames; - - //GUIContent[] content = new GUIContent[options.Length]; - //for (int i = 0; i < options.Length; i++) - //{ - // content[i] = new GUIContent(); - // content[i].text = options[i]; - // content[i].tooltip = EnumExtensions.Description((MapPresetType)i); - //} - //selected = property.FindPropertyRelative("mapPreset").enumValueIndex; - //selected = GUILayout.SelectionGrid(selected, content, options.Length); - - - //if (selected != previousSelection) - //{ - // previousSelection = selected; - // property.FindPropertyRelative("mapPreset").enumValueIndex = selected; - - // switch ((MapPresetType)selected) - // { - // case MapPresetType.LocationBasedMap: - // PresetLocationBased(property); - - // //TODO : Get opinions on this UX. - // //var locationProvider = _map.gameObject.GetComponent(); - // //Debug.Log("target -> " + ((locationProvider == null) ? "null" : "notnull")); - // //if (locationProvider == null) - // //(_map.gameObject).AddComponent(); - // break; - // case MapPresetType.WorldSimulator: - // PresetWorldSimulator(property); - // break; - // case MapPresetType.ARTableTop: - // break; - // case MapPresetType.ARWorldScale: - // PresetARWorldScale(property); - // break; - // default: - // break; - // } - - //} - - EditorGUILayout.Space(); DrawMapOptions(serializedObject); } - ShowSepartor(); ShowImage = EditorGUILayout.Foldout(ShowImage, "IMAGE"); if (ShowImage) { + GUILayout.Space(-1.5f * _lineHeight); ShowSection(serializedObject.FindProperty("_imagery"), "_layerProperty"); } @@ -153,17 +124,18 @@ public override void OnInspectorGUI() ShowTerrain = EditorGUILayout.Foldout(ShowTerrain, "TERRAIN"); if (ShowTerrain) { + GUILayout.Space(-1.5f * _lineHeight); ShowSection(serializedObject.FindProperty("_terrain"), "_layerProperty"); } ShowSepartor(); - ShowVector = EditorGUILayout.Foldout(ShowVector, "VECTOR"); - if (ShowVector) + ShowMapLayers = EditorGUILayout.Foldout(ShowMapLayers, "MAP LAYERS"); + if (ShowMapLayers) { - ShowSection(serializedObject.FindProperty("_vectorData"), "_layerProperty"); + DrawMapLayerOptions(); } - GUILayout.EndVertical(); + EditorGUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); } @@ -172,8 +144,8 @@ void ShowSection(SerializedProperty property, string propertyName) { EditorGUILayout.Space(); EditorGUILayout.PropertyField(property.FindPropertyRelative(propertyName)); - } + void ShowSepartor() { EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); @@ -183,20 +155,28 @@ void ShowSepartor() void DrawMapOptions(SerializedObject mapObject) { var property = mapObject.FindProperty("_options"); + if (!((AbstractMap)serializedObject.targetObject).IsAccessTokenValid) + { + EditorGUILayout.HelpBox("Invalid Access Token. Please add a valid access token using the Mapbox > Setup Menu", MessageType.Error); + } + + + EditorGUILayout.LabelField("Location ", GUILayout.Height(_lineHeight)); - EditorGUILayout.LabelField("Location "); EditorGUILayout.PropertyField(property.FindPropertyRelative("locationOptions")); var extentOptions = property.FindPropertyRelative("extentOptions"); var extentOptionsType = extentOptions.FindPropertyRelative("extentType"); if ((MapExtentType)extentOptionsType.enumValueIndex == MapExtentType.Custom) { - var test = mapObject.FindProperty("_tileProvider"); EditorGUILayout.PropertyField(extentOptionsType); + EditorGUI.indentLevel++; EditorGUILayout.PropertyField(test); + EditorGUI.indentLevel--; } else { + GUILayout.Space(-_lineHeight); EditorGUILayout.PropertyField(property.FindPropertyRelative("extentOptions")); } @@ -205,105 +185,90 @@ void DrawMapOptions(SerializedObject mapObject) ShowPosition = EditorGUILayout.Foldout(ShowPosition, "Others"); if (ShowPosition) { + GUILayout.Space(-_lineHeight); EditorGUILayout.PropertyField(property.FindPropertyRelative("placementOptions")); + GUILayout.Space(-_lineHeight); EditorGUILayout.PropertyField(property.FindPropertyRelative("scalingOptions")); EditorGUILayout.PropertyField(property.FindPropertyRelative("loadingTexture")); } } - void PresetLocationBased(SerializedProperty unifiedMap) - { - //Set - //placement = atLocationCenter, - //scaling = custom - //turn off vector layers. - var mapOptionsProp = unifiedMap.FindPropertyRelative("mapOptions"); - var vectorLayerProps = unifiedMap.FindPropertyRelative("vectorLayerProperties"); - var placementType = mapOptionsProp.FindPropertyRelative("placementOptions.placementType"); - var scalingType = mapOptionsProp.FindPropertyRelative("scalingOptions.scalingType"); - var unitType = mapOptionsProp.FindPropertyRelative("scalingOptions.unitType"); - var extentType = mapOptionsProp.FindPropertyRelative("extentOptions.extentType"); - var vectorSourceType = vectorLayerProps.FindPropertyRelative("sourceType"); - - placementType.enumValueIndex = (int)MapPlacementType.AtLocationCenter; - - scalingType.enumValueIndex = (int)MapScalingType.Custom; - unitType.enumValueIndex = (int)MapUnitType.meters; - - extentType.enumValueIndex = (int)MapExtentType.CameraBounds; - - vectorSourceType.enumValueIndex = (int)VectorSourceType.None; - - } - - void PresetWorldSimulator(SerializedProperty unifiedMap) - { - //Set - //placement = atLocationCenter, - //scaling = custom - //turn on vector layers. - var mapOptionsProp = unifiedMap.FindPropertyRelative("mapOptions"); - var vectorLayerProps = unifiedMap.FindPropertyRelative("vectorLayerProperties"); - var placementType = mapOptionsProp.FindPropertyRelative("placementOptions.placementType"); - var scalingType = mapOptionsProp.FindPropertyRelative("scalingOptions.scalingType"); - var unitType = mapOptionsProp.FindPropertyRelative("scalingOptions.unitType"); - var extentType = mapOptionsProp.FindPropertyRelative("extentOptions.extentType"); - var vectorSourceType = vectorLayerProps.FindPropertyRelative("sourceType"); - - placementType.enumValueIndex = (int)MapPlacementType.AtLocationCenter; - - scalingType.enumValueIndex = (int)MapScalingType.Custom; - unitType.enumValueIndex = (int)MapUnitType.meters; - - extentType.enumValueIndex = (int)MapExtentType.CameraBounds; - - vectorSourceType.enumValueIndex = (int)VectorSourceType.MapboxStreets; - } - - void PresetARTableTop(SerializedProperty unifiedMap) + void DrawMapLayerOptions() { - //Set - //placement = atLocationCenter, - //scaling = custom - //turn on vector layers. - var mapOptionsProp = unifiedMap.FindPropertyRelative("mapOptions"); - var vectorLayerProps = unifiedMap.FindPropertyRelative("vectorLayerProperties"); - var placementType = mapOptionsProp.FindPropertyRelative("placementOptions.placementType"); - var scalingType = mapOptionsProp.FindPropertyRelative("scalingOptions.scalingType"); - var extentType = mapOptionsProp.FindPropertyRelative("extentOptions.extentType"); - var vectorSourceType = vectorLayerProps.FindPropertyRelative("sourceType"); - - placementType.enumValueIndex = (int)MapPlacementType.AtLocationCenter; - - scalingType.enumValueIndex = (int)MapScalingType.WorldScale; - - extentType.enumValueIndex = (int)MapExtentType.CameraBounds; - - vectorSourceType.enumValueIndex = (int)VectorSourceType.MapboxStreets; - - } - - void PresetARWorldScale(SerializedProperty unifiedMap) - { - //Set - //placement = atLocationCenter, - //scaling = custom - //turn on vector layers. - var mapOptionsProp = unifiedMap.FindPropertyRelative("mapOptions"); - var vectorLayerProps = unifiedMap.FindPropertyRelative("vectorLayerProperties"); - var placementType = mapOptionsProp.FindPropertyRelative("placementOptions.placementType"); - var scalingType = mapOptionsProp.FindPropertyRelative("scalingOptions.scalingType"); - var extentType = mapOptionsProp.FindPropertyRelative("extentOptions.extentType"); - var vectorSourceType = vectorLayerProps.FindPropertyRelative("sourceType"); + var vectorDataProperty = serializedObject.FindProperty("_vectorData"); + var layerProperty = vectorDataProperty.FindPropertyRelative("_layerProperty"); + var layerSourceProperty = layerProperty.FindPropertyRelative("sourceOptions"); + var sourceTypeProperty = layerProperty.FindPropertyRelative("_sourceType"); + VectorSourceType sourceTypeValue = (VectorSourceType)sourceTypeProperty.enumValueIndex; + var layerSourceId = layerProperty.FindPropertyRelative("sourceOptions.layerSource.Id"); + string layerString = layerSourceId.stringValue; + var isActiveProperty = layerSourceProperty.FindPropertyRelative("isActive"); + + var displayNames = sourceTypeProperty.enumDisplayNames; + int count = sourceTypeProperty.enumDisplayNames.Length; + if (!_isGUIContentSet) + { + _sourceTypeContent = new GUIContent[count]; + for (int extIdx = 0; extIdx < count; extIdx++) + { + _sourceTypeContent[extIdx] = new GUIContent + { + text = displayNames[extIdx], + tooltip = ((VectorSourceType)extIdx).Description(), + }; + } + + _isGUIContentSet = true; + } - placementType.enumValueIndex = (int)MapPlacementType.AtLocationCenter; + sourceTypeProperty.enumValueIndex = EditorGUILayout.Popup(new GUIContent + { + text = "Data Source", + tooltip = "Source tileset for Vector Data" + }, sourceTypeProperty.enumValueIndex, _sourceTypeContent); - scalingType.enumValueIndex = (int)MapScalingType.WorldScale; + sourceTypeValue = (VectorSourceType)sourceTypeProperty.enumValueIndex; - extentType.enumValueIndex = (int)MapExtentType.CameraBounds; + switch (sourceTypeValue) + { + case VectorSourceType.MapboxStreets: + case VectorSourceType.MapboxStreetsWithBuildingIds: + var sourcePropertyValue = MapboxDefaultVector.GetParameters(sourceTypeValue); + layerSourceId.stringValue = sourcePropertyValue.Id; + GUI.enabled = false; + EditorGUILayout.PropertyField(layerSourceProperty, mapIdGui); + GUI.enabled = true; + isActiveProperty.boolValue = true; + break; + case VectorSourceType.Custom: + EditorGUILayout.PropertyField(layerSourceProperty, mapIdGui); + isActiveProperty.boolValue = true; + break; + case VectorSourceType.None: + isActiveProperty.boolValue = false; + break; + default: + isActiveProperty.boolValue = false; + break; + } - vectorSourceType.enumValueIndex = (int)VectorSourceType.MapboxStreets; + if (sourceTypeValue != VectorSourceType.None) + { + var isStyleOptimized = layerProperty.FindPropertyRelative("useOptimizedStyle"); + EditorGUILayout.PropertyField(isStyleOptimized); + + if (isStyleOptimized.boolValue) + { + EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("optimizedStyle"), new GUIContent("Style Options")); + } + GUILayout.Space(-_lineHeight); + EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("performanceOptions"), new GUIContent("Perfomance Options")); + } + EditorGUILayout.Space(); + ShowSepartor(); + GUILayout.Space(-2.0f * _lineHeight); + ShowSection(serializedObject.FindProperty("_vectorData"), "_layerProperty"); } } } diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/ModifierStackEditor.cs b/sdkproject/Assets/Mapbox/Unity/Editor/ModifierStackEditor.cs index 09df52811..fe674e964 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/ModifierStackEditor.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/ModifierStackEditor.cs @@ -14,7 +14,7 @@ public class ModifierStackEditor : UnityEditor.Editor private void OnEnable() { script = MonoScript.FromScriptableObject((ModifierStack)target); - _positionType = serializedObject.FindProperty("_moveFeaturePositionTo"); + _positionType = serializedObject.FindProperty("moveFeaturePositionTo"); } public override void OnInspectorGUI() diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/NodeEditor/Node.cs b/sdkproject/Assets/Mapbox/Unity/Editor/NodeEditor/Node.cs index 25fc9338f..e28295bf2 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/NodeEditor/Node.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/NodeEditor/Node.cs @@ -85,6 +85,8 @@ public Node(object so = null) var inlabel = ""; if (ScriptableObject is VectorSubLayerProperties) inlabel = (ScriptableObject as VectorSubLayerProperties).coreOptions.sublayerName; + if (ScriptableObject is PrefabItemOptions) + inlabel = (ScriptableObject as PrefabItemOptions).coreOptions.sublayerName; inPoint = new ConnectionPoint(this, inlabel, "", 20, ConnectionPointType.In, NodeBasedEditor.inPointStyle); } @@ -122,6 +124,18 @@ public float Draw(Vector2 position, float width, float height) if (!_isRoot) inPoint.Draw(); } + + var prefabItemObj = ScriptableObject as PrefabItemOptions; + if (prefabItemObj != null) + { + inPoint.inLabel = prefabItemObj.coreOptions.sublayerName; + inPoint.Draw(); + } + else + { + if (!_isRoot) + inPoint.Draw(); + } spaceRect.height = Math.Max(height, Math.Max(spaceRect.height, boxHeight)); if (Children.Count > 0) { @@ -299,6 +313,21 @@ public void Dive(object obj, bool showModifiers = true, int depth = 0) //var prop = new SerializedObject(listitem); var cc = new ConnectionPoint(this, "", listitem.coreOptions.sublayerName, _headerHeight + _propertyHeight * _propCount, ConnectionPointType.Out, NodeBasedEditor.outPointStyle, listitem); + ConnectionPoints.Add(cc); + _propCount++; + var newNode = new Node(listitem); + Children.Add(newNode); + newNode.Connections.Add(new Connection(newNode.inPoint, cc)); + newNode.Dive(listitem, showModifiers, depth + 1); + } + } + else if (val is List) + { + foreach (PrefabItemOptions listitem in val as IEnumerable) + { + //var prop = new SerializedObject(listitem); + var cc = new ConnectionPoint(this, "", listitem.coreOptions.sublayerName, _headerHeight + _propertyHeight * _propCount, ConnectionPointType.Out, NodeBasedEditor.outPointStyle, listitem); + ConnectionPoints.Add(cc); _propCount++; var newNode = new Node(listitem); diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/CameraBoundsTileProviderOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/CameraBoundsTileProviderOptionsDrawer.cs index cc4858531..b69eb9548 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/CameraBoundsTileProviderOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/CameraBoundsTileProviderOptionsDrawer.cs @@ -7,16 +7,22 @@ [CustomPropertyDrawer(typeof(CameraBoundsTileProviderOptions))] public class CameraBoundsTileProviderOptionsDrawer : PropertyDrawer { - static float lineHeight = EditorGUIUtility.singleLineHeight; + static float _lineHeight = EditorGUIUtility.singleLineHeight; public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); var camera = property.FindPropertyRelative("camera"); var updateInterval = property.FindPropertyRelative("updateInterval"); - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), camera, new GUIContent { text = camera.displayName, tooltip = "Camera to control map extent." }); - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), updateInterval, new GUIContent { text = updateInterval.displayName, tooltip = "Time in ms between map extent update." }); - EditorGUI.EndProperty(); + EditorGUILayout.PropertyField(camera, new GUIContent + { + text = camera.displayName, + tooltip = "Camera to control map extent." + }, GUILayout.Height(_lineHeight)); + EditorGUILayout.PropertyField(updateInterval, new GUIContent + { + text = updateInterval.displayName, + tooltip = "Time in ms between map extent update." + }, GUILayout.Height(_lineHeight)); + } } } \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ColliderOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ColliderOptionsDrawer.cs index 4b57b213f..ede4adea5 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ColliderOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ColliderOptionsDrawer.cs @@ -11,25 +11,38 @@ public class ColliderOptionsDrawer : PropertyDrawer { static float lineHeight = EditorGUIUtility.singleLineHeight; + bool isGUIContentSet = false; + GUIContent[] colliderTypeContent; public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); - var typePosition = EditorGUI.PrefixLabel(new Rect(position.x, position.y, position.width, lineHeight), GUIUtility.GetControlID(FocusType.Passive), new GUIContent { text = "Collider Type", tooltip = "The type of collider added to game objects in this layer." }); + EditorGUI.BeginProperty(position, null, property); + var colliderTypeLabel = new GUIContent + { + text = "Collider Type", + tooltip = "The type of collider added to game objects in this layer." + }; var colliderTypeProperty = property.FindPropertyRelative("colliderType"); - List enumContent = new List(); - foreach(var enumValue in colliderTypeProperty.enumDisplayNames) + var displayNames = colliderTypeProperty.enumDisplayNames; + int count = colliderTypeProperty.enumDisplayNames.Length; + + if (!isGUIContentSet) { - var guiContent = new GUIContent { text = enumValue, tooltip = ((Unity.Map.ColliderType)colliderTypeProperty.enumValueIndex).Description()} ; - enumContent.Add(guiContent); + colliderTypeContent = new GUIContent[count]; + for (int extIdx = 0; extIdx < count; extIdx++) + { + colliderTypeContent[extIdx] = new GUIContent + { + text = displayNames[extIdx], + tooltip = EnumExtensions.Description((ColliderType)extIdx), + }; + } + isGUIContentSet = true; } - EditorGUI.indentLevel--; - colliderTypeProperty.enumValueIndex = EditorGUI.Popup(typePosition, colliderTypeProperty.enumValueIndex, enumContent.ToArray()); - EditorGUI.indentLevel++; + colliderTypeProperty.enumValueIndex = EditorGUI.Popup(position, colliderTypeLabel, colliderTypeProperty.enumValueIndex, colliderTypeContent); EditorGUI.EndProperty(); } - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return lineHeight; diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/CoreVectorLayerPropertiesDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/CoreVectorLayerPropertiesDrawer.cs index 67a69bab2..b3657e412 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/CoreVectorLayerPropertiesDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/CoreVectorLayerPropertiesDrawer.cs @@ -3,53 +3,122 @@ using UnityEditor; using UnityEngine; using Mapbox.Unity.Map; + using System.Collections.Generic; + using System.Linq; + using System; + using Mapbox.VectorTile.ExtensionMethods; [CustomPropertyDrawer(typeof(CoreVectorLayerProperties))] public class CoreVectorLayerPropertiesDrawer : PropertyDrawer { - static float lineHeight = EditorGUIUtility.singleLineHeight; + int _layerIndex = 0; + bool _isGUIContentSet = false; + GUIContent[] _primitiveTypeContent; + GUIContent[] _layerTypeContent; + static TileJsonData tileJsonData = new TileJsonData(); public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); - position.height = lineHeight; + EditorGUI.BeginProperty(position, null, property); // Draw label. - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), property.FindPropertyRelative("isActive")); - position.y += lineHeight; var primitiveType = property.FindPropertyRelative("geometryType"); - var typePosition = EditorGUI.PrefixLabel(new Rect(position.x, position.y, position.width, lineHeight), GUIUtility.GetControlID(FocusType.Passive), new GUIContent { text = "Primitive Type", tooltip = "Primitive geometry type of the visualizer, allowed primitives - point, line, polygon." }); - EditorGUI.indentLevel--; - primitiveType.enumValueIndex = EditorGUI.Popup(typePosition, primitiveType.enumValueIndex, primitiveType.enumDisplayNames); - EditorGUI.indentLevel++; + var primitiveTypeLabel = new GUIContent + { + text = "Primitive Type", + tooltip = "Primitive geometry type of the visualizer, allowed primitives - point, line, polygon." + }; + + var displayNames = primitiveType.enumDisplayNames; + int count = primitiveType.enumDisplayNames.Length; + + if (!_isGUIContentSet) + { + _primitiveTypeContent = new GUIContent[count]; + for (int extIdx = 0; extIdx < count; extIdx++) + { + _primitiveTypeContent[extIdx] = new GUIContent + { + text = displayNames[extIdx], + tooltip = EnumExtensions.Description((VectorPrimitiveType)extIdx), + }; + } + _isGUIContentSet = true; + } + + primitiveType.enumValueIndex = EditorGUILayout.Popup(primitiveTypeLabel, primitiveType.enumValueIndex, _primitiveTypeContent); - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), property.FindPropertyRelative("layerName")); + var serializedMapObject = property.serializedObject; + AbstractMap mapObject = (AbstractMap)serializedMapObject.targetObject; + tileJsonData = mapObject.VectorData.LayerProperty.tileJsonData; - position.y += lineHeight; - EditorGUI.PropertyField(position, property.FindPropertyRelative("snapToTerrain")); + var layerDisplayNames = tileJsonData.LayerDisplayNames; + DrawLayerName(property, position, layerDisplayNames); - position.y += lineHeight; - EditorGUI.PropertyField(position, property.FindPropertyRelative("groupFeatures")); + var snapToTerrainProperty = property.FindPropertyRelative("snapToTerrain"); + var groupFeaturesProperty = property.FindPropertyRelative("groupFeatures"); + + snapToTerrainProperty.boolValue = EditorGUILayout.Toggle(snapToTerrainProperty.displayName, snapToTerrainProperty.boolValue); + groupFeaturesProperty.boolValue = EditorGUILayout.Toggle(groupFeaturesProperty.displayName, groupFeaturesProperty.boolValue); if ((VectorPrimitiveType)primitiveType.enumValueIndex == VectorPrimitiveType.Line) { - position.y += lineHeight; - EditorGUI.PropertyField(position, property.FindPropertyRelative("lineWidth")); + EditorGUILayout.PropertyField(property.FindPropertyRelative("lineWidth")); } - EditorGUI.EndProperty(); } - - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + //private static int count = 0; + private void DrawLayerName(SerializedProperty property, Rect position, List layerDisplayNames) { - var sourceTypeProperty = property.FindPropertyRelative("geometryType"); - float height = 0.0f; - height += (((((VectorPrimitiveType)sourceTypeProperty.enumValueIndex == VectorPrimitiveType.Line)) ? 6.0f : 5.0f) * EditorGUIUtility.singleLineHeight); + var layerNameLabel = new GUIContent + { + text = "Layer Name", + tooltip = "The layer name from the Mapbox tileset that would be used for visualizing a feature" + }; + + //disable the selection if there is no layer + if (layerDisplayNames.Count == 0) + { + EditorGUILayout.LabelField(layerNameLabel, new GUIContent("No layers found: Invalid MapId / No Internet."), (GUIStyle)"minipopUp"); + return; + } + + //check the string value at the current _layerIndex to verify that the stored index matches the property string. + var layerString = property.FindPropertyRelative("layerName").stringValue; + if (layerDisplayNames.Contains(layerString)) + { + //if the layer contains the current layerstring, set it's index to match + _layerIndex = layerDisplayNames.FindIndex(s => s.Equals(layerString)); + + } + else + { + //if the selected layer isn't in the source, add a placeholder entry + _layerIndex = 0; + layerDisplayNames.Insert(0, layerString); + if (!tileJsonData.LayerPropertyDescriptionDictionary.ContainsKey(layerString)) + { + tileJsonData.LayerPropertyDescriptionDictionary.Add(layerString, new Dictionary()); + } + + } + + //create the display name guicontent array with an additional entry for the currently selected item + _layerTypeContent = new GUIContent[layerDisplayNames.Count]; + for (int extIdx = 0; extIdx < layerDisplayNames.Count; extIdx++) + { + _layerTypeContent[extIdx] = new GUIContent + { + text = layerDisplayNames[extIdx], + }; + } - return height; + //draw the layer selection popup + _layerIndex = EditorGUILayout.Popup(layerNameLabel, _layerIndex, _layerTypeContent); + var parsedString = layerDisplayNames.ToArray()[_layerIndex].Split(new string[] { tileJsonData.commonLayersKey }, System.StringSplitOptions.None)[0].Trim(); + property.FindPropertyRelative("layerName").stringValue = parsedString; } } -} \ No newline at end of file +} diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ElevationLayerPropertiesDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ElevationLayerPropertiesDrawer.cs index c73d7b001..2e510d4db 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ElevationLayerPropertiesDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ElevationLayerPropertiesDrawer.cs @@ -8,6 +8,7 @@ [CustomPropertyDrawer(typeof(ElevationLayerProperties))] public class ElevationLayerPropertiesDrawer : PropertyDrawer { + string objectId = ""; static float lineHeight = EditorGUIUtility.singleLineHeight; GUIContent[] sourceTypeContent; bool isGUIContentSet = false; @@ -16,11 +17,11 @@ bool ShowPosition { get { - return EditorPrefs.GetBool("ElevationLayerProperties_showPosition"); + return EditorPrefs.GetBool(objectId + "ElevationLayerProperties_showPosition"); } set { - EditorPrefs.SetBool("ElevationLayerProperties_showPosition", value); + EditorPrefs.SetBool(objectId + "ElevationLayerProperties_showPosition", value); } } @@ -34,18 +35,17 @@ string CustomSourceMapId { get { - return EditorPrefs.GetString("ElevationLayerProperties_customSourceMapId"); + return EditorPrefs.GetString(objectId + "ElevationLayerProperties_customSourceMapId"); } set { - EditorPrefs.SetString("ElevationLayerProperties_customSourceMapId", value); + EditorPrefs.SetString(objectId + "ElevationLayerProperties_customSourceMapId", value); } } public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); - position.height = lineHeight; + objectId = property.serializedObject.targetObject.GetInstanceID().ToString(); var sourceTypeProperty = property.FindPropertyRelative("sourceType"); var sourceTypeValue = (ElevationSourceType)sourceTypeProperty.enumValueIndex; @@ -65,13 +65,11 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten } isGUIContentSet = true; } - var typePosition = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), new GUIContent { text = "Data Source", tooltip = "Source tileset for Terrain." }); + var sourceTypeLabel = new GUIContent { text = "Data Source", tooltip = "Source tileset for Terrain." }; - sourceTypeProperty.enumValueIndex = EditorGUI.Popup(typePosition, sourceTypeProperty.enumValueIndex, sourceTypeContent); + sourceTypeProperty.enumValueIndex = EditorGUILayout.Popup(sourceTypeLabel, sourceTypeProperty.enumValueIndex, sourceTypeContent); sourceTypeValue = (ElevationSourceType)sourceTypeProperty.enumValueIndex; - position.y += lineHeight; - var sourceOptionsProperty = property.FindPropertyRelative("sourceOptions"); var layerSourceProperty = sourceOptionsProperty.FindPropertyRelative("layerSource"); var layerSourceId = layerSourceProperty.FindPropertyRelative("Id"); @@ -81,68 +79,40 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten var sourcePropertyValue = MapboxDefaultElevation.GetParameters(sourceTypeValue); layerSourceId.stringValue = sourcePropertyValue.Id; GUI.enabled = false; - EditorGUI.PropertyField(position, sourceOptionsProperty, _mapIdGui); + EditorGUILayout.PropertyField(sourceOptionsProperty, _mapIdGui); GUI.enabled = true; break; case ElevationSourceType.Custom: layerSourceId.stringValue = CustomSourceMapId; - EditorGUI.PropertyField(position, sourceOptionsProperty, _mapIdGui); + EditorGUILayout.PropertyField(sourceOptionsProperty, _mapIdGui); CustomSourceMapId = layerSourceId.stringValue; break; default: break; } - - //EditorGUI.PropertyField(position, property.FindPropertyRelative("sourceOptions"), true); - if (sourceTypeValue != ElevationSourceType.None) - { - position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("sourceOptions")); - } if (sourceTypeValue == ElevationSourceType.None) { GUI.enabled = false; } var elevationLayerType = property.FindPropertyRelative("elevationLayerType"); - EditorGUI.PropertyField(position, elevationLayerType, new GUIContent { text = elevationLayerType.displayName, tooltip = ((ElevationLayerType)elevationLayerType.enumValueIndex).Description() }); + EditorGUILayout.PropertyField(elevationLayerType, new GUIContent { text = elevationLayerType.displayName, tooltip = ((ElevationLayerType)elevationLayerType.enumValueIndex).Description() }); position.y += lineHeight; if (sourceTypeValue == ElevationSourceType.None) { GUI.enabled = true; } - EditorGUI.PropertyField(position, property.FindPropertyRelative("requiredOptions"), true); - position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("requiredOptions")); - ShowPosition = EditorGUI.Foldout(position, ShowPosition, "Others"); + EditorGUILayout.PropertyField(property.FindPropertyRelative("requiredOptions"), true); + //position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("requiredOptions")); + ShowPosition = EditorGUILayout.Foldout(ShowPosition, "Others"); if (ShowPosition) { - position.y += lineHeight; - EditorGUI.PropertyField(position, property.FindPropertyRelative("modificationOptions"), true); - position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modificationOptions")); - EditorGUI.PropertyField(position, property.FindPropertyRelative("sideWallOptions"), true); - position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("sideWallOptions")); - EditorGUI.PropertyField(position, property.FindPropertyRelative("unityLayerOptions"), true); + EditorGUILayout.PropertyField(property.FindPropertyRelative("modificationOptions"), true); + EditorGUILayout.PropertyField(property.FindPropertyRelative("sideWallOptions"), true); + EditorGUILayout.PropertyField(property.FindPropertyRelative("unityLayerOptions"), true); } - EditorGUI.EndProperty(); - } - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) - { - var sourceTypeProperty = property.FindPropertyRelative("sourceType"); - var sourceTypeValue = (ElevationSourceType)sourceTypeProperty.enumValueIndex; - - float height = ((sourceTypeValue == ElevationSourceType.None) ? 2.0f : 3.0f) * lineHeight; - - height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("sourceOptions")); - height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("requiredOptions")); - if (ShowPosition) - { - height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modificationOptions")); - height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("unityLayerOptions")); - height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("sideWallOptions")); - } - return height; } } - } diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/FeaturesSubLayerPropertiesDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/FeaturesSubLayerPropertiesDrawer.cs new file mode 100644 index 000000000..b3201c690 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/FeaturesSubLayerPropertiesDrawer.cs @@ -0,0 +1,519 @@ +namespace Mapbox.Editor +{ + using System.Collections.Generic; + using System.Linq; + using UnityEngine; + using UnityEditor; + using Mapbox.Unity.Map; + using UnityEditor.IMGUI.Controls; + using Mapbox.Unity.MeshGeneration.Modifiers; + using Mapbox.VectorTile.ExtensionMethods; + using Mapbox.Unity.MeshGeneration.Filters; + using Mapbox.Platform.TilesetTileJSON; + + public class FeaturesSubLayerPropertiesDrawer + { + static float _lineHeight = EditorGUIUtility.singleLineHeight; + GUIContent[] _sourceTypeContent; + bool _isGUIContentSet = false; + bool _isInitialized = false; + private TileJsonData tileJSONData; + private static TileJSONResponse tileJSONResponse; + /// + /// Gets or sets the layerID + /// + /// true then show general section; otherwise hide, false. + + string objectId = ""; + private string TilesetId + { + get + { + return EditorPrefs.GetString(objectId + "VectorSubLayerProperties_tilesetId"); + } + set + { + EditorPrefs.SetString(objectId + "VectorSubLayerProperties_tilesetId", value); + } + } + + bool ShowPosition + { + get + { + return EditorPrefs.GetBool(objectId + "VectorSubLayerProperties_showPosition"); + } + set + { + EditorPrefs.SetBool(objectId + "VectorSubLayerProperties_showPosition", value); + } + } + + bool ShowOthers + { + get + { + return EditorPrefs.GetBool(objectId + "VectorSubLayerProperties_showOthers"); + } + set + { + EditorPrefs.SetBool(objectId + "VectorSubLayerProperties_showOthers", value); + } + } + + int SelectionIndex + { + get + { + return EditorPrefs.GetInt(objectId + "VectorSubLayerProperties_selectionIndex"); + } + set + { + EditorPrefs.SetInt(objectId + "VectorSubLayerProperties_selectionIndex", value); + } + } + + FeatureSubLayerTreeView layerTreeView = new FeatureSubLayerTreeView(new TreeViewState()); + IList selectedLayers = new List(); + public void DrawUI(SerializedProperty property) + { + objectId = property.serializedObject.targetObject.GetInstanceID().ToString(); + var serializedMapObject = property.serializedObject; + AbstractMap mapObject = (AbstractMap)serializedMapObject.targetObject; + tileJSONData = mapObject.VectorData.LayerProperty.tileJsonData; + + var sourceTypeProperty = property.FindPropertyRelative("_sourceType"); + var sourceTypeValue = (VectorSourceType)sourceTypeProperty.enumValueIndex; + + var displayNames = sourceTypeProperty.enumDisplayNames; + int count = sourceTypeProperty.enumDisplayNames.Length; + if (!_isGUIContentSet) + { + _sourceTypeContent = new GUIContent[count]; + for (int extIdx = 0; extIdx < count; extIdx++) + { + _sourceTypeContent[extIdx] = new GUIContent + { + text = displayNames[extIdx], + tooltip = ((VectorSourceType)extIdx).Description(), + }; + } + _isGUIContentSet = true; + } + + sourceTypeValue = (VectorSourceType)sourceTypeProperty.enumValueIndex; + + var sourceOptionsProperty = property.FindPropertyRelative("sourceOptions"); + var layerSourceProperty = sourceOptionsProperty.FindPropertyRelative("layerSource"); + var layerSourceId = layerSourceProperty.FindPropertyRelative("Id"); + var isActiveProperty = sourceOptionsProperty.FindPropertyRelative("isActive"); + switch (sourceTypeValue) + { + case VectorSourceType.MapboxStreets: + case VectorSourceType.MapboxStreetsWithBuildingIds: + var sourcePropertyValue = MapboxDefaultVector.GetParameters(sourceTypeValue); + layerSourceId.stringValue = sourcePropertyValue.Id; + GUI.enabled = false; + if (_isInitialized) + { + LoadEditorTileJSON(property, sourceTypeValue, layerSourceId.stringValue); + } + else + { + _isInitialized = true; + } + if (tileJSONData.PropertyDisplayNames.Count == 0 && tileJSONData.tileJSONLoaded) + { + EditorGUILayout.HelpBox("Invalid Map Id / There might be a problem with the internet connection.", MessageType.Error); + } + GUI.enabled = true; + isActiveProperty.boolValue = true; + break; + case VectorSourceType.Custom: + if (_isInitialized) + { + string test = layerSourceId.stringValue; + LoadEditorTileJSON(property, sourceTypeValue, layerSourceId.stringValue); + } + else + { + _isInitialized = true; + } + if (tileJSONData.PropertyDisplayNames.Count == 0 && tileJSONData.tileJSONLoaded) + { + EditorGUILayout.HelpBox("Invalid Map Id / There might be a problem with the internet connection.", MessageType.Error); + } + isActiveProperty.boolValue = true; + break; + case VectorSourceType.None: + isActiveProperty.boolValue = false; + break; + default: + isActiveProperty.boolValue = false; + break; + } + + if (sourceTypeValue != VectorSourceType.None) + { + EditorGUILayout.LabelField(new GUIContent + { + text = "Vector Layer Visualizers", + tooltip = "Visualizers for vector features contained in a layer. " + }); + + var subLayerArray = property.FindPropertyRelative("vectorSubLayers"); + + var layersRect = EditorGUILayout.GetControlRect(GUILayout.MinHeight(Mathf.Max(subLayerArray.arraySize + 1, 1) * _lineHeight), + GUILayout.MaxHeight((subLayerArray.arraySize + 1) * _lineHeight)); + layerTreeView.Layers = subLayerArray; + layerTreeView.Reload(); + layerTreeView.OnGUI(layersRect); + + selectedLayers = layerTreeView.GetSelection(); + + //if there are selected elements, set the selection index at the first element. + //if not, use the Selection index to persist the selection at the right index. + if (selectedLayers.Count > 0) + { + //ensure that selectedLayers[0] isn't out of bounds + if (selectedLayers[0] - layerTreeView.uniqueId > subLayerArray.arraySize - 1) + { + selectedLayers[0] = subLayerArray.arraySize - 1 + layerTreeView.uniqueId; + } + + SelectionIndex = selectedLayers[0]; + } + else + { + if (SelectionIndex > 0 && (SelectionIndex - layerTreeView.uniqueId <= subLayerArray.arraySize - 1)) + { + selectedLayers = new int[1] { SelectionIndex }; + layerTreeView.SetSelection(selectedLayers); + } + } + + GUILayout.Space(EditorGUIUtility.singleLineHeight); + + EditorGUILayout.BeginHorizontal(); + + if (GUILayout.Button(new GUIContent("Add Visualizer"), (GUIStyle)"minibuttonleft")) + { + subLayerArray.arraySize++; + + var subLayer = subLayerArray.GetArrayElementAtIndex(subLayerArray.arraySize - 1); + var subLayerName = subLayer.FindPropertyRelative("coreOptions.sublayerName"); + + subLayerName.stringValue = "Untitled"; + + // Set defaults here because SerializedProperty copies the previous element. + var subLayerCoreOptions = subLayer.FindPropertyRelative("coreOptions"); + subLayerCoreOptions.FindPropertyRelative("isActive").boolValue = true; + subLayerCoreOptions.FindPropertyRelative("layerName").stringValue = "building"; + subLayerCoreOptions.FindPropertyRelative("geometryType").enumValueIndex = (int)VectorPrimitiveType.Polygon; + subLayerCoreOptions.FindPropertyRelative("snapToTerrain").boolValue = true; + subLayerCoreOptions.FindPropertyRelative("groupFeatures").boolValue = false; + subLayerCoreOptions.FindPropertyRelative("lineWidth").floatValue = 1.0f; + + var subLayerExtrusionOptions = subLayer.FindPropertyRelative("extrusionOptions"); + subLayerExtrusionOptions.FindPropertyRelative("extrusionType").enumValueIndex = (int)ExtrusionType.None; + subLayerExtrusionOptions.FindPropertyRelative("extrusionGeometryType").enumValueIndex = + (int)ExtrusionGeometryType.RoofAndSide; + subLayerExtrusionOptions.FindPropertyRelative("propertyName").stringValue = "height"; + subLayerExtrusionOptions.FindPropertyRelative("extrusionScaleFactor").floatValue = 1f; + + var subLayerFilterOptions = subLayer.FindPropertyRelative("filterOptions"); + subLayerFilterOptions.FindPropertyRelative("filters").ClearArray(); + subLayerFilterOptions.FindPropertyRelative("combinerType").enumValueIndex = + (int)LayerFilterCombinerOperationType.Any; + + var subLayerMaterialOptions = subLayer.FindPropertyRelative("materialOptions"); + subLayerMaterialOptions.FindPropertyRelative("materials").ClearArray(); + subLayerMaterialOptions.FindPropertyRelative("materials").arraySize = 2; + subLayerMaterialOptions.FindPropertyRelative("atlasInfo").objectReferenceValue = null; + subLayerMaterialOptions.FindPropertyRelative("colorPalette").objectReferenceValue = null; + subLayerMaterialOptions.FindPropertyRelative("texturingType").enumValueIndex = (int)UvMapType.Tiled; + + subLayer.FindPropertyRelative("buildingsWithUniqueIds").boolValue = false; + subLayer.FindPropertyRelative("moveFeaturePositionTo").enumValueIndex = (int)PositionTargetType.TileCenter; + subLayer.FindPropertyRelative("MeshModifiers").ClearArray(); + subLayer.FindPropertyRelative("GoModifiers").ClearArray(); + + var subLayerColliderOptions = subLayer.FindPropertyRelative("colliderOptions"); + subLayerColliderOptions.FindPropertyRelative("colliderType").enumValueIndex = (int)ColliderType.None; + + selectedLayers = new int[1] { subLayerArray.arraySize - 1 + layerTreeView.uniqueId }; + layerTreeView.SetSelection(selectedLayers); + } + + if (GUILayout.Button(new GUIContent("Remove Selected"), (GUIStyle)"minibuttonright")) + { + foreach (var index in selectedLayers.OrderByDescending(i => i)) + { + subLayerArray.DeleteArrayElementAtIndex(index - layerTreeView.uniqueId); + } + + selectedLayers = new int[0]; + layerTreeView.SetSelection(selectedLayers); + } + + EditorGUILayout.EndHorizontal(); + + GUILayout.Space(EditorGUIUtility.singleLineHeight); + + if (selectedLayers.Count == 1 && subLayerArray.arraySize != 0) + { + //ensure that selectedLayers[0] isn't out of bounds + if (selectedLayers[0] - layerTreeView.uniqueId > subLayerArray.arraySize - 1) + { + selectedLayers[0] = subLayerArray.arraySize - 1 + layerTreeView.uniqueId; + } + + SelectionIndex = selectedLayers[0]; + + var layerProperty = subLayerArray.GetArrayElementAtIndex(SelectionIndex - layerTreeView.uniqueId); + + layerProperty.isExpanded = true; + var subLayerCoreOptions = layerProperty.FindPropertyRelative("coreOptions"); + bool isLayerActive = subLayerCoreOptions.FindPropertyRelative("isActive").boolValue; + if (!isLayerActive) + { + GUI.enabled = false; + } + + DrawLayerVisualizerProperties(sourceTypeValue, layerProperty, property); + if (!isLayerActive) + { + GUI.enabled = true; + } + } + else + { + GUILayout.Label("Select a visualizer to see properties"); + } + } + } + + void DrawLayerVisualizerProperties(VectorSourceType sourceType, SerializedProperty layerProperty, SerializedProperty property) + { + var subLayerCoreOptions = layerProperty.FindPropertyRelative("coreOptions"); + GUILayout.Space(-_lineHeight); + EditorGUILayout.PrefixLabel(subLayerCoreOptions.FindPropertyRelative("sublayerName").stringValue + " Properties"); + // V1 + EditorGUILayout.BeginVertical(); + EditorGUI.indentLevel++; + VectorPrimitiveType primitiveTypeProp = + (VectorPrimitiveType)subLayerCoreOptions.FindPropertyRelative("geometryType").enumValueIndex; + + GUILayout.Space(-_lineHeight); + EditorGUILayout.PropertyField(subLayerCoreOptions); + + var extrusionOptions = layerProperty.FindPropertyRelative("extrusionOptions"); + //loading up the selectedLayerName for extrusion options to pull up the right propertyName + extrusionOptions.FindPropertyRelative("_selectedLayerName").stringValue = subLayerCoreOptions.FindPropertyRelative("layerName").stringValue; + + if (primitiveTypeProp != VectorPrimitiveType.Point && primitiveTypeProp != VectorPrimitiveType.Custom) + { + EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("colliderOptions")); + GUILayout.Space(-_lineHeight); + EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("extrusionOptions")); + EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("materialOptions")); + } + + EditorGUI.indentLevel--; + ShowOthers = EditorGUILayout.Foldout(ShowOthers, "Advanced"); + EditorGUI.indentLevel++; + if (ShowOthers) + { + if (primitiveTypeProp == VectorPrimitiveType.Polygon && sourceType != VectorSourceType.MapboxStreets) + { + EditorGUI.indentLevel--; + layerProperty.FindPropertyRelative("honorBuildingIdSetting").boolValue = true; + EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("buildingsWithUniqueIds"), new GUIContent + { + text = "Buildings With Unique Ids", + tooltip = + "Turn on this setting only when rendering 3D buildings from the Mapbox Streets with Building Ids tileset. Using this setting with any other polygon layers or source will result in visual artifacts. " + }); + EditorGUI.indentLevel++; + } + else + { + layerProperty.FindPropertyRelative("honorBuildingIdSetting").boolValue = false; + } + var filterOptions = layerProperty.FindPropertyRelative("filterOptions"); + filterOptions.FindPropertyRelative("_selectedLayerName").stringValue = subLayerCoreOptions.FindPropertyRelative("layerName").stringValue; + + GUILayout.Space(-_lineHeight); + EditorGUILayout.PropertyField(filterOptions, new GUIContent("Filters")); + DrawModifiers(layerProperty, new GUIContent { text = "Modifier Options", tooltip = "Additional Feature modifiers to apply to the visualizer. " }); + } + EditorGUILayout.EndVertical(); + EditorGUI.indentLevel--; + } + + void DrawModifiers(SerializedProperty property, GUIContent label) + { + var groupFeaturesProperty = property.FindPropertyRelative("coreOptions").FindPropertyRelative("groupFeatures"); + ShowPosition = EditorGUILayout.Foldout(ShowPosition, label.text); + EditorGUILayout.BeginVertical(); + if (ShowPosition) + { + EditorGUILayout.BeginHorizontal(); + if (groupFeaturesProperty.boolValue == false) + { + EditorGUILayout.PrefixLabel(new GUIContent + { + text = "Feature Position", + tooltip = "Position to place feature in the tile. " + }); + var featurePositionProperty = property.FindPropertyRelative("moveFeaturePositionTo"); + featurePositionProperty.enumValueIndex = EditorGUILayout.Popup(featurePositionProperty.enumValueIndex, + featurePositionProperty.enumDisplayNames); + } + + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.Space(); + + EditorGUILayout.LabelField(new GUIContent + { + text = "Mesh Modifiers", + tooltip = "Modifiers that manipulate the features mesh. " + }); + + var meshfac = property.FindPropertyRelative("MeshModifiers"); + + for (int i = 0; i < meshfac.arraySize; i++) + { + var ind = i; + EditorGUILayout.BeginHorizontal(); + + EditorGUILayout.BeginVertical(); + meshfac.GetArrayElementAtIndex(ind).objectReferenceValue = + EditorGUILayout.ObjectField(meshfac.GetArrayElementAtIndex(i).objectReferenceValue, typeof(MeshModifier), false) + as ScriptableObject; + + EditorGUILayout.EndVertical(); + + if (GUILayout.Button(new GUIContent("+"), (GUIStyle)"minibuttonleft", GUILayout.Width(30))) + { + ScriptableCreatorWindow.Open(typeof(MeshModifier), meshfac, ind); + } + + if (GUILayout.Button(new GUIContent("-"), (GUIStyle)"minibuttonright", GUILayout.Width(30))) + { + meshfac.DeleteArrayElementAtIndex(ind); + } + + EditorGUILayout.EndHorizontal(); + } + + EditorGUILayout.Space(); + EditorGUI.indentLevel++; + EditorGUILayout.BeginHorizontal(); + GUILayout.Space(EditorGUI.indentLevel * 12); + if (GUILayout.Button(new GUIContent("Add New Empty"), (GUIStyle)"minibuttonleft")) + { + meshfac.arraySize++; + meshfac.GetArrayElementAtIndex(meshfac.arraySize - 1).objectReferenceValue = null; + } + + if (GUILayout.Button(new GUIContent("Find Asset"), (GUIStyle)"minibuttonright")) + { + ScriptableCreatorWindow.Open(typeof(MeshModifier), meshfac); + } + + EditorGUILayout.EndHorizontal(); + EditorGUI.indentLevel--; + EditorGUILayout.Space(); + EditorGUILayout.LabelField(new GUIContent + { + text = "Game Object Modifiers", + tooltip = "Modifiers that manipulate the GameObject after mesh generation." + }); + var gofac = property.FindPropertyRelative("GoModifiers"); + for (int i = 0; i < gofac.arraySize; i++) + { + var ind = i; + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.BeginVertical(); + GUILayout.Space(5); + gofac.GetArrayElementAtIndex(ind).objectReferenceValue = + EditorGUILayout.ObjectField(gofac.GetArrayElementAtIndex(i).objectReferenceValue, typeof(GameObjectModifier), + false) as ScriptableObject; + EditorGUILayout.EndVertical(); + + if (GUILayout.Button(new GUIContent("+"), (GUIStyle)"minibuttonleft", GUILayout.Width(30))) + { + ScriptableCreatorWindow.Open(typeof(GameObjectModifier), gofac, ind); + } + + if (GUILayout.Button(new GUIContent("-"), (GUIStyle)"minibuttonright", GUILayout.Width(30))) + { + gofac.DeleteArrayElementAtIndex(ind); + } + + EditorGUILayout.EndHorizontal(); + } + + EditorGUILayout.Space(); + EditorGUI.indentLevel++; + EditorGUILayout.BeginHorizontal(); + GUILayout.Space(EditorGUI.indentLevel * 12); + if (GUILayout.Button(new GUIContent("Add New Empty"), (GUIStyle)"minibuttonleft")) + { + gofac.arraySize++; + gofac.GetArrayElementAtIndex(gofac.arraySize - 1).objectReferenceValue = null; + } + + if (GUILayout.Button(new GUIContent("Find Asset"), (GUIStyle)"minibuttonright")) + { + ScriptableCreatorWindow.Open(typeof(GameObjectModifier), gofac); + } + + EditorGUILayout.EndHorizontal(); + EditorGUI.indentLevel--; + } + EditorGUILayout.EndVertical(); + } + + private void LoadEditorTileJSON(SerializedProperty property, VectorSourceType sourceTypeValue, string sourceString) + { + if (sourceTypeValue != VectorSourceType.None && !string.IsNullOrEmpty(sourceString)) + { + if (tileJSONResponse == null || string.IsNullOrEmpty(sourceString) || sourceString != TilesetId) + { + //tileJSONData.ClearData(); + try + { + Unity.MapboxAccess.Instance.TileJSON.Get(sourceString, (response) => + { + //if the code has reached this point it means that there is a valid access token + tileJSONResponse = response; + if (response == null || response.VectorLayers == null) //indicates bad tileresponse + { + tileJSONData.ClearData(); + return; + } + tileJSONData.ProcessTileJSONData(response); + }); + } + catch (System.Exception) + { + //no valid access token causes MapboxAccess to throw an error and hence setting this property + tileJSONData.ClearData(); + } + } + else if (tileJSONData.LayerPropertyDescriptionDictionary.Count == 0) + { + tileJSONData.ProcessTileJSONData(tileJSONResponse); + } + } + else + { + tileJSONData.ClearData(); + } + TilesetId = sourceString; + } + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/FeaturesSubLayerPropertiesDrawer.cs.meta b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/FeaturesSubLayerPropertiesDrawer.cs.meta new file mode 100644 index 000000000..eac4b529b --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/FeaturesSubLayerPropertiesDrawer.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: a49c4311b159a483a8d3a61c78ac50bf +timeCreated: 1525818948 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/GeometryExtrusionOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/GeometryExtrusionOptionsDrawer.cs index a8097f9b2..71da40ce2 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/GeometryExtrusionOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/GeometryExtrusionOptionsDrawer.cs @@ -4,27 +4,34 @@ using UnityEngine; using Mapbox.Unity.Map; using Mapbox.VectorTile.ExtensionMethods; + using System.Linq; + using Mapbox.Platform.TilesetTileJSON; + using System.Collections.Generic; [CustomPropertyDrawer(typeof(GeometryExtrusionOptions))] public class GeometryExtrusionOptionsDrawer : PropertyDrawer { - static float lineHeight = EditorGUIUtility.singleLineHeight; - GUIContent[] sourceTypeContent; - bool isGUIContentSet = false; + //indices for tileJSON lookup + int _propertyIndex = 0; + private static List _propertyNamesList = new List(); + GUIContent[] _propertyNameContent; + GUIContent[] extrusionTypeContent; + bool isGUIContentSet = false; + static TileJsonData tileJsonData = new TileJsonData(); + static TileJSONResponse tileJsonResponse; public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); var extrusionTypeProperty = property.FindPropertyRelative("extrusionType"); - var displayNames = extrusionTypeProperty.enumDisplayNames; int count = extrusionTypeProperty.enumDisplayNames.Length; + if (!isGUIContentSet) { - sourceTypeContent = new GUIContent[count]; + extrusionTypeContent = new GUIContent[count]; for (int extIdx = 0; extIdx < count; extIdx++) { - sourceTypeContent[extIdx] = new GUIContent + extrusionTypeContent[extIdx] = new GUIContent { text = displayNames[extIdx], tooltip = EnumExtensions.Description((ExtrusionType)extIdx), @@ -33,12 +40,14 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten isGUIContentSet = true; } - var typePosition = EditorGUI.PrefixLabel(new Rect(position.x, position.y, position.width, lineHeight), GUIUtility.GetControlID(FocusType.Passive), new GUIContent { text = "Extrusion Type", tooltip = "Type of geometry extrusion" }); + var extrusionTypeLabel = new GUIContent + { + text = "Extrusion Type", + tooltip = "Type of geometry extrusion" + }; + extrusionTypeProperty.enumValueIndex = EditorGUILayout.Popup(extrusionTypeLabel, extrusionTypeProperty.enumValueIndex, extrusionTypeContent); - EditorGUI.indentLevel--; - extrusionTypeProperty.enumValueIndex = EditorGUI.Popup(typePosition, extrusionTypeProperty.enumValueIndex, sourceTypeContent); - EditorGUI.indentLevel++; var sourceTypeValue = (Unity.Map.ExtrusionType)extrusionTypeProperty.enumValueIndex; var minHeightProperty = property.FindPropertyRelative("minimumHeight"); @@ -52,83 +61,148 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten case Unity.Map.ExtrusionType.None: break; case Unity.Map.ExtrusionType.PropertyHeight: - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), extrusionGeometryType, extrusionGeometryGUI); - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), property.FindPropertyRelative("propertyName")); + EditorGUILayout.PropertyField(extrusionGeometryType, extrusionGeometryGUI); + DrawPropertyDropDown(property, position); break; case Unity.Map.ExtrusionType.MinHeight: - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), extrusionGeometryType, extrusionGeometryGUI); - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), property.FindPropertyRelative("propertyName")); + EditorGUILayout.PropertyField(extrusionGeometryType, extrusionGeometryGUI); + DrawPropertyDropDown(property, position); break; case Unity.Map.ExtrusionType.MaxHeight: - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), extrusionGeometryType, extrusionGeometryGUI); - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), property.FindPropertyRelative("propertyName")); + EditorGUILayout.PropertyField(extrusionGeometryType, extrusionGeometryGUI); + DrawPropertyDropDown(property, position); break; case Unity.Map.ExtrusionType.RangeHeight: - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), extrusionGeometryType, extrusionGeometryGUI); - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), property.FindPropertyRelative("propertyName")); - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), minHeightProperty); - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), maxHeightProperty); + EditorGUILayout.PropertyField(extrusionGeometryType, extrusionGeometryGUI); + DrawPropertyDropDown(property, position); + EditorGUILayout.PropertyField(minHeightProperty); + EditorGUILayout.PropertyField(maxHeightProperty); if (minHeightProperty.floatValue > maxHeightProperty.floatValue) { - //position.y += lineHeight; EditorGUILayout.HelpBox("Maximum Height less than Minimum Height!", MessageType.Error); } break; case Unity.Map.ExtrusionType.AbsoluteHeight: - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), extrusionGeometryType, extrusionGeometryGUI); - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), maxHeightProperty, new GUIContent { text = "Height" }); + EditorGUILayout.PropertyField(extrusionGeometryType, extrusionGeometryGUI); + EditorGUILayout.PropertyField(maxHeightProperty, new GUIContent { text = "Height" }); break; default: break; } - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), property.FindPropertyRelative("extrusionScaleFactor"), new GUIContent { text = "Scale Factor" }); + + EditorGUILayout.PropertyField(property.FindPropertyRelative("extrusionScaleFactor"), new GUIContent { text = "Scale Factor" }); EditorGUI.indentLevel--; + } + + private void DrawPropertyDropDown(SerializedProperty property, Rect position) + { + var selectedLayerName = property.FindPropertyRelative("_selectedLayerName").stringValue; - EditorGUI.EndProperty(); + var serializedMapObject = property.serializedObject; + AbstractMap mapObject = (AbstractMap)serializedMapObject.targetObject; + tileJsonData = mapObject.VectorData.LayerProperty.tileJsonData; + + DrawPropertyName(property, position, selectedLayerName); } - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + + private void DrawPropertyName(SerializedProperty property, Rect position, string selectedLayerName) { - var extrusionTypeProperty = property.FindPropertyRelative("extrusionType"); - var sourceTypeValue = (Unity.Map.ExtrusionType)extrusionTypeProperty.enumValueIndex; + var parsedString = "No property selected"; + var descriptionString = "No description available"; - int rows = 1; - //if (showPosition) + if (string.IsNullOrEmpty(selectedLayerName) || tileJsonData == null || !tileJsonData.PropertyDisplayNames.ContainsKey(selectedLayerName)) + { + DrawWarningMessage(position); + } + else { - switch (sourceTypeValue) + var propertyDisplayNames = tileJsonData.PropertyDisplayNames[selectedLayerName]; + _propertyNamesList = new List(propertyDisplayNames); + + //check if the selection is valid + var propertyString = property.FindPropertyRelative("propertyName").stringValue; + if (_propertyNamesList.Contains(propertyString)) + { + //if the layer contains the current layerstring, set it's index to match + _propertyIndex = propertyDisplayNames.FindIndex(s => s.Equals(propertyString)); + + + //create guicontent for a valid layer + _propertyNameContent = new GUIContent[_propertyNamesList.Count]; + for (int extIdx = 0; extIdx < _propertyNamesList.Count; extIdx++) + { + var parsedPropertyString = _propertyNamesList[extIdx].Split(new string[] { tileJsonData.optionalPropertiesString }, System.StringSplitOptions.None)[0].Trim(); + _propertyNameContent[extIdx] = new GUIContent + { + text = _propertyNamesList[extIdx], + tooltip = tileJsonData.LayerPropertyDescriptionDictionary[selectedLayerName][parsedPropertyString] + }; + } + + //display popup + var propertyNameLabel = new GUIContent { text = "Property Name", tooltip = "The name of the property in the selected Mapbox layer that will be used for extrusion" }; + _propertyIndex = EditorGUILayout.Popup(propertyNameLabel, _propertyIndex, _propertyNameContent); + + //set new string values based on selection + parsedString = _propertyNamesList[_propertyIndex].Split(new string[] { tileJsonData.optionalPropertiesString }, System.StringSplitOptions.None)[0].Trim(); + descriptionString = tileJsonData.LayerPropertyDescriptionDictionary[selectedLayerName][parsedString]; + + } + else { - case Unity.Map.ExtrusionType.None: - rows += 1; - break; - case Unity.Map.ExtrusionType.PropertyHeight: - case Unity.Map.ExtrusionType.MinHeight: - case Unity.Map.ExtrusionType.MaxHeight: - rows += 3; - break; - case Unity.Map.ExtrusionType.RangeHeight: - rows += 5; - break; - case Unity.Map.ExtrusionType.AbsoluteHeight: - rows += 3; - break; - default: - rows += 2; - break; + //if the selected layer isn't in the source, add a placeholder entry + _propertyIndex = 0; + _propertyNamesList.Insert(0, propertyString); + + //create guicontent for an invalid layer + _propertyNameContent = new GUIContent[_propertyNamesList.Count]; + + //first property gets a unique tooltip + _propertyNameContent[0] = new GUIContent + { + text = _propertyNamesList[0], + tooltip = "Unavialable in Selected Layer" + }; + + for (int extIdx = 1; extIdx < _propertyNamesList.Count; extIdx++) + { + var parsedPropertyString = _propertyNamesList[extIdx].Split(new string[] { tileJsonData.optionalPropertiesString }, System.StringSplitOptions.None)[0].Trim(); + _propertyNameContent[extIdx] = new GUIContent + { + text = _propertyNamesList[extIdx], + tooltip = tileJsonData.LayerPropertyDescriptionDictionary[selectedLayerName][parsedPropertyString] + }; + } + + //display popup + var propertyNameLabel = new GUIContent { text = "Property Name", tooltip = "The name of the property in the selected Mapbox layer that will be used for extrusion" }; + _propertyIndex = EditorGUILayout.Popup(propertyNameLabel, _propertyIndex, _propertyNameContent); + + //set new string values based on the offset + parsedString = _propertyNamesList[_propertyIndex].Split(new string[] { tileJsonData.optionalPropertiesString }, System.StringSplitOptions.None)[0].Trim(); + descriptionString = "Unavailable in Selected Layer."; + } + + property.FindPropertyRelative("propertyName").stringValue = parsedString; + property.FindPropertyRelative("propertyDescription").stringValue = descriptionString; + } - return (float)rows * lineHeight; + + descriptionString = string.IsNullOrEmpty(descriptionString) ? "No description available" : descriptionString; + + var propertyDescriptionPrefixLabel = new GUIContent { text = "Property Description", tooltip = "Factual information about the selected property" }; + EditorGUILayout.LabelField(propertyDescriptionPrefixLabel, new GUIContent(descriptionString), (GUIStyle)"wordWrappedLabel"); + } + + private void DrawWarningMessage(Rect position) + { + GUIStyle labelStyle = new GUIStyle(EditorStyles.popup); + //labelStyle.normal.textColor = Color.red; + labelStyle.fontStyle = FontStyle.Bold; + var layerNameLabel = new GUIContent { text = "Property Name", tooltip = "The name of the property in the selected Mapbox layer that will be used for extrusion" }; + EditorGUILayout.LabelField(layerNameLabel, new GUIContent("No properties found in layer"), labelStyle);//(GUIStyle)"minipopUp"); + return; } } -} \ No newline at end of file +} diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/GeometryMaterialOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/GeometryMaterialOptionsDrawer.cs index f2365c449..3723eb7f8 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/GeometryMaterialOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/GeometryMaterialOptionsDrawer.cs @@ -21,11 +21,11 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten position.y += lineHeight; var typePosition = EditorGUI.PrefixLabel(new Rect(position.x, position.y, position.width, lineHeight), GUIUtility.GetControlID(FocusType.Passive), new GUIContent { text = "Texturing Type", tooltip = "Use image texture from the Imagery source as texture for roofs. " }); var texturingType = property.FindPropertyRelative("texturingType"); - EditorGUI.indentLevel--; - EditorGUI.indentLevel--; + EditorGUI.indentLevel -= 2; + texturingType.enumValueIndex = EditorGUI.Popup(typePosition, texturingType.enumValueIndex, texturingType.enumDisplayNames); - EditorGUI.indentLevel++; - EditorGUI.indentLevel++; + + EditorGUI.indentLevel += 2; var matList = property.FindPropertyRelative("materials"); if (matList.arraySize == 0) diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ImageryLayerPropertiesDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ImageryLayerPropertiesDrawer.cs index 28b5678ad..7706dd664 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ImageryLayerPropertiesDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/ImageryLayerPropertiesDrawer.cs @@ -8,7 +8,7 @@ [CustomPropertyDrawer(typeof(ImageryLayerProperties))] public class ImageryLayerPropertiesDrawer : PropertyDrawer { - static float lineHeight = EditorGUIUtility.singleLineHeight; + string objectId = ""; GUIContent[] sourceTypeContent; bool isGUIContentSet = false; @@ -23,19 +23,17 @@ string CustomSourceMapId { get { - return EditorPrefs.GetString("ImageryLayerProperties_customSourceMapId"); + return EditorPrefs.GetString(objectId + "ImageryLayerProperties_customSourceMapId"); } set { - EditorPrefs.SetString("ImageryLayerProperties_customSourceMapId", value); + EditorPrefs.SetString(objectId + "ImageryLayerProperties_customSourceMapId", value); } } public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); - position.height = lineHeight; - + objectId = property.serializedObject.targetObject.GetInstanceID().ToString(); var sourceTypeProperty = property.FindPropertyRelative("sourceType"); var sourceTypeValue = (ImagerySourceType)sourceTypeProperty.enumValueIndex; @@ -49,19 +47,18 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten sourceTypeContent[extIdx] = new GUIContent { text = displayNames[extIdx], - tooltip = ((ImagerySourceType)extIdx).Description(), + tooltip = EnumExtensions.Description((ImagerySourceType)extIdx), }; } isGUIContentSet = true; } - // Draw label. - var typePosition = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), new GUIContent { text = "Data Source", tooltip = "Source tileset for Imagery." }); + // Draw label. + var sourceTypeLabel = new GUIContent { text = "Data Source", tooltip = "Source tileset for Imagery." }; - sourceTypeProperty.enumValueIndex = EditorGUI.Popup(typePosition, sourceTypeProperty.enumValueIndex, sourceTypeContent); + sourceTypeProperty.enumValueIndex = EditorGUILayout.Popup(sourceTypeLabel, sourceTypeProperty.enumValueIndex, sourceTypeContent); sourceTypeValue = (ImagerySourceType)sourceTypeProperty.enumValueIndex; - position.y += lineHeight; var sourceOptionsProperty = property.FindPropertyRelative("sourceOptions"); var layerSourceProperty = sourceOptionsProperty.FindPropertyRelative("layerSource"); var layerSourceId = layerSourceProperty.FindPropertyRelative("Id"); @@ -77,12 +74,12 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten var sourcePropertyValue = MapboxDefaultImagery.GetParameters(sourceTypeValue); layerSourceId.stringValue = sourcePropertyValue.Id; GUI.enabled = false; - EditorGUI.PropertyField(position, sourceOptionsProperty,_mapIdGui); + EditorGUILayout.PropertyField(sourceOptionsProperty, _mapIdGui); GUI.enabled = true; break; case ImagerySourceType.Custom: layerSourceId.stringValue = CustomSourceMapId; - EditorGUI.PropertyField(position, sourceOptionsProperty, new GUIContent{text = "Map Id / Style URL", tooltip = _mapIdGui.tooltip} ); + EditorGUILayout.PropertyField(sourceOptionsProperty, new GUIContent { text = "Map Id / Style URL", tooltip = _mapIdGui.tooltip }); CustomSourceMapId = layerSourceId.stringValue; break; case ImagerySourceType.None: @@ -92,29 +89,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten } if (sourceTypeValue != ImagerySourceType.None) { - position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("sourceOptions")); - EditorGUI.PropertyField(position, property.FindPropertyRelative("rasterOptions")); - } - - EditorGUI.EndProperty(); - - } - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) - { - var sourceTypeProperty = property.FindPropertyRelative("sourceType"); - var sourceTypeValue = (ImagerySourceType)sourceTypeProperty.enumValueIndex; - - if (sourceTypeValue == ImagerySourceType.None) - { - return lineHeight; - } - else - { - float height = 0.0f; - height += (1.0f * lineHeight); - height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("rasterOptions")); - height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("sourceOptions")); - return height; + EditorGUILayout.PropertyField(property.FindPropertyRelative("rasterOptions")); } } } diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/LayerPerformanceOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/LayerPerformanceOptionsDrawer.cs index d407e21e1..28e0adce4 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/LayerPerformanceOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/LayerPerformanceOptionsDrawer.cs @@ -7,68 +7,20 @@ [CustomPropertyDrawer(typeof(LayerPerformanceOptions))] public class LayerPerformanceOptionsDrawer : PropertyDrawer { - static float lineHeight = EditorGUIUtility.singleLineHeight; - SerializedProperty isActiveProperty; public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { isActiveProperty = property.FindPropertyRelative("isEnabled"); - EditorGUI.BeginProperty(position, label, property); - position.height = lineHeight; - var typePosition = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), new GUIContent("Enable Coroutines")); - isActiveProperty.boolValue = EditorGUI.Toggle(typePosition, isActiveProperty.boolValue); + isActiveProperty.boolValue = EditorGUILayout.Toggle(new GUIContent("Enable Coroutines"), isActiveProperty.boolValue); if (isActiveProperty.boolValue == true) { EditorGUI.indentLevel++; - position.y += lineHeight; - EditorGUI.PropertyField(position, property.FindPropertyRelative("entityPerCoroutine"), true); + EditorGUILayout.PropertyField(property.FindPropertyRelative("entityPerCoroutine"), true); EditorGUI.indentLevel--; } - - EditorGUI.EndProperty(); - } - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) - { - float height = 0.0f; - if (isActiveProperty != null && isActiveProperty.boolValue == true) - { - height += (2.0f * EditorGUIUtility.singleLineHeight); - //height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("layerSource"), false); - } - else - { - height = EditorGUIUtility.singleLineHeight; - } - - return height; } } - - //[CustomPropertyDrawer(typeof(TypeVisualizerTuple))] - //public class TypeVisualizerBaseDrawer : PropertyDrawer - //{ - // static float lineHeight = EditorGUIUtility.singleLineHeight; - // bool showPosition = true; - // public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) - // { - // EditorGUI.BeginProperty(position, label, property); - - // position.height = lineHeight; - - // EditorGUI.PropertyField(position, property.FindPropertyRelative("Stack")); - - // EditorGUI.EndProperty(); - // } - // public override float GetPropertyHeight(SerializedProperty property, GUIContent label) - // { - // // Reserve space for the total visible properties. - // int rows = 2; - // //Debug.Log("Height - " + rows * lineHeight); - // return (float)rows * lineHeight; - // } - //} - -} \ No newline at end of file +} diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapExtentOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapExtentOptionsDrawer.cs index bfbfbe498..af8ad507e 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapExtentOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapExtentOptionsDrawer.cs @@ -9,16 +9,11 @@ public class MapExtentOptionsDrawer : PropertyDrawer { static string extTypePropertyName = "extentType"; - static float lineHeight = EditorGUIUtility.singleLineHeight; + static float _lineHeight = EditorGUIUtility.singleLineHeight; GUIContent[] extentTypeContent; bool isGUIContentSet = false; public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); - - position.height = lineHeight; - - var kindProperty = property.FindPropertyRelative(extTypePropertyName); var displayNames = kindProperty.enumDisplayNames; int count = kindProperty.enumDisplayNames.Length; @@ -36,62 +31,36 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten isGUIContentSet = true; } // Draw label. - var kindPosition = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), new GUIContent { text = label.text, tooltip = "Options to determine the geographic extent of the world for which the map tiles will be requested.", }); - - kindProperty.enumValueIndex = EditorGUI.Popup(kindPosition, kindProperty.enumValueIndex, extentTypeContent); + var extentTypeLabel = new GUIContent + { + text = label.text, + tooltip = "Options to determine the geographic extent of the world for which the map tiles will be requested.", + }; + kindProperty.enumValueIndex = EditorGUILayout.Popup(extentTypeLabel, kindProperty.enumValueIndex, extentTypeContent, GUILayout.Height(_lineHeight)); var kind = (MapExtentType)kindProperty.enumValueIndex; EditorGUI.indentLevel++; - var rect = new Rect(position.x, position.y + lineHeight, position.width, lineHeight); - + //var rect = new Rect(position.x, position.y + lineHeight, position.width, lineHeight); + GUILayout.Space(-_lineHeight); switch (kind) { case MapExtentType.CameraBounds: - EditorGUI.PropertyField(rect, property.FindPropertyRelative("cameraBoundsOptions"), new GUIContent { text = "CameraOptions-" }); + EditorGUILayout.PropertyField(property.FindPropertyRelative("cameraBoundsOptions"), new GUIContent { text = "CameraOptions-" }); break; case MapExtentType.RangeAroundCenter: - EditorGUI.PropertyField(rect, property.FindPropertyRelative("rangeAroundCenterOptions"), new GUIContent { text = "RangeAroundCenter" }); + EditorGUILayout.PropertyField(property.FindPropertyRelative("rangeAroundCenterOptions"), new GUIContent { text = "RangeAroundCenter" }); break; case MapExtentType.RangeAroundTransform: - EditorGUI.PropertyField(rect, property.FindPropertyRelative("rangeAroundTransformOptions"), new GUIContent { text = "RangeAroundTransform" }); + EditorGUILayout.PropertyField(property.FindPropertyRelative("rangeAroundTransformOptions"), new GUIContent { text = "RangeAroundTransform" }); break; default: break; } EditorGUI.indentLevel--; - - EditorGUI.EndProperty(); - - - } - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) - { - var kindProperty = property.FindPropertyRelative(extTypePropertyName); - - var kind = (MapExtentType)kindProperty.enumValueIndex; - - int rows = 1; - - switch (kind) - { - case MapExtentType.CameraBounds: - rows += 2; - break; - case MapExtentType.RangeAroundCenter: - rows += 4; - break; - case MapExtentType.RangeAroundTransform: - rows += 3; - break; - default: - break; - } - return (float)rows * EditorGUIUtility.singleLineHeight; } - } } \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapLocationOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapLocationOptionsDrawer.cs index f22f367cf..fb8c7ab8a 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapLocationOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapLocationOptionsDrawer.cs @@ -7,26 +7,15 @@ [CustomPropertyDrawer(typeof(MapLocationOptions))] public class MapLocationOptionsDrawer : PropertyDrawer { - static float lineHeight = EditorGUIUtility.singleLineHeight; + static float _lineHeight = EditorGUIUtility.singleLineHeight; public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); - //EditorGUI.indentLevel++; - foreach (var item in property) - { - var subproperty = item as SerializedProperty; - EditorGUI.PropertyField(position, subproperty, true); - position.height = lineHeight; - position.y += lineHeight; - } - //EditorGUI.indentLevel--; - EditorGUI.EndProperty(); - } - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) - { - // Reserve space for the total visible properties. - return (2.0f * lineHeight); + EditorGUI.indentLevel++; + GUILayout.Space(-1f * _lineHeight); + EditorGUILayout.PropertyField(property.FindPropertyRelative("latitudeLongitude")); + EditorGUILayout.PropertyField(property.FindPropertyRelative("zoom"), GUILayout.Height(_lineHeight)); + EditorGUI.indentLevel--; } } } \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapPlacementOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapPlacementOptionsDrawer.cs index 94e46b57b..216d74637 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapPlacementOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapPlacementOptionsDrawer.cs @@ -8,12 +8,10 @@ [CustomPropertyDrawer(typeof(MapPlacementOptions))] public class MapPlacementOptionsDrawer : PropertyDrawer { - static float lineHeight = EditorGUIUtility.singleLineHeight; GUIContent[] placementTypeContent; bool isGUIContentSet = false; public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); var placementType = property.FindPropertyRelative("placementType"); var snapMapToTerrain = property.FindPropertyRelative("snapMapToZero"); @@ -33,20 +31,8 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten isGUIContentSet = true; } - // Draw label. - var placementTypePosition = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), new GUIContent { text = label.text, tooltip = "Placement of Map root.", }); - - placementType.enumValueIndex = EditorGUI.Popup(placementTypePosition, placementType.enumValueIndex, placementTypeContent); - - //EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), placementType, new GUIContent { text = placementType.displayName, tooltip = EnumExtensions.Description((MapPlacementType)placementType.enumValueIndex) }); - position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), snapMapToTerrain, new GUIContent { text = snapMapToTerrain.displayName, tooltip = "If checked, map's root will be snapped to zero. " }); - EditorGUI.EndProperty(); - } - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) - { - // Reserve space for the total visible properties. - return 2.0f * lineHeight; + placementType.enumValueIndex = EditorGUILayout.Popup(new GUIContent { text = label.text, tooltip = "Placement of Map root.", }, placementType.enumValueIndex, placementTypeContent); + EditorGUILayout.PropertyField(snapMapToTerrain, new GUIContent { text = snapMapToTerrain.displayName, tooltip = "If checked, map's root will be snapped to zero. " }); } } } \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapScalingOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapScalingOptionsDrawer.cs index 2a219fa9b..8639b3968 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapScalingOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/MapScalingOptionsDrawer.cs @@ -14,7 +14,6 @@ public class MapScalingOptionsDrawer : PropertyDrawer public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); var scalingType = property.FindPropertyRelative("scalingType"); var displayNames = scalingType.enumDisplayNames; int count = scalingType.enumDisplayNames.Length; @@ -33,28 +32,14 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten } // Draw label. - var scalingTypePosition = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), new GUIContent { text = label.text, tooltip = "Scale of map in game units.", }); + var scalingTypeLabel = new GUIContent { text = label.text, tooltip = "Scale of map in game units.", }; - scalingType.enumValueIndex = EditorGUI.Popup(scalingTypePosition, scalingType.enumValueIndex, scalingTypeContent); + scalingType.enumValueIndex = EditorGUILayout.Popup(scalingTypeLabel, scalingType.enumValueIndex, scalingTypeContent); if ((MapScalingType)scalingType.enumValueIndex == MapScalingType.Custom) { position.y += lineHeight; - EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), property.FindPropertyRelative("unityTileSize")); - } - EditorGUI.EndProperty(); - } - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) - { - // Reserve space for the total visible properties. - var scalingType = property.FindPropertyRelative("scalingType"); - if ((MapScalingType)scalingType.enumValueIndex == MapScalingType.Custom) - { - return 2.0f * lineHeight; - } - else - { - return 1.0f * lineHeight; + EditorGUILayout.PropertyField(property.FindPropertyRelative("unityTileSize")); } } } diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PointsOfInterestSubLayerPropertiesDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PointsOfInterestSubLayerPropertiesDrawer.cs new file mode 100644 index 000000000..d1f7a0fed --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PointsOfInterestSubLayerPropertiesDrawer.cs @@ -0,0 +1,150 @@ +namespace Mapbox.Unity.Map +{ + using UnityEngine; + using System.Collections.Generic; + using UnityEditor; + using Mapbox.Editor; + using UnityEditor.IMGUI.Controls; + using System.Linq; + + public class PointsOfInterestSubLayerPropertiesDrawer + { + string objectId = ""; + static float _lineHeight = EditorGUIUtility.singleLineHeight; + + PointsOfInterestSubLayerTreeView layerTreeView = new PointsOfInterestSubLayerTreeView(new TreeViewState()); + IList selectedLayers = new List(); + + int SelectionIndex + { + get + { + return EditorPrefs.GetInt(objectId + "LocationPrefabsLayerProperties_selectionIndex"); + } + set + { + EditorPrefs.SetInt(objectId + "LocationPrefabsLayerProperties_selectionIndex", value); + } + } + + public void DrawUI(SerializedProperty property) + { + objectId = property.serializedObject.targetObject.GetInstanceID().ToString(); + var prefabItemArray = property.FindPropertyRelative("locationPrefabList"); + var layersRect = EditorGUILayout.GetControlRect(GUILayout.MinHeight(Mathf.Max(prefabItemArray.arraySize + 1, 1) * _lineHeight), + GUILayout.MaxHeight((prefabItemArray.arraySize + 1) * _lineHeight)); + + layerTreeView.Layers = prefabItemArray; + layerTreeView.Reload(); + layerTreeView.OnGUI(layersRect); + + selectedLayers = layerTreeView.GetSelection(); + //if there are selected elements, set the selection index at the first element. + //if not, use the Selection index to persist the selection at the right index. + if (selectedLayers.Count > 0) + { + //ensure that selectedLayers[0] isn't out of bounds + if (selectedLayers[0] > prefabItemArray.arraySize - 1) + { + selectedLayers[0] = prefabItemArray.arraySize - 1; + } + + SelectionIndex = selectedLayers[0]; + + } + else + { + selectedLayers = new int[1] { SelectionIndex }; + if (SelectionIndex > 0 && (SelectionIndex <= prefabItemArray.arraySize - 1)) + { + layerTreeView.SetSelection(selectedLayers); + } + } + + + GUILayout.Space(EditorGUIUtility.singleLineHeight); + EditorGUILayout.BeginHorizontal(); + + if (GUILayout.Button(new GUIContent("Add Layer"), (GUIStyle)"minibuttonleft")) + { + + GUILayout.Space(EditorGUIUtility.singleLineHeight); + + selectedLayers = layerTreeView.GetSelection(); + + prefabItemArray.arraySize++; + + var prefabItem = prefabItemArray.GetArrayElementAtIndex(prefabItemArray.arraySize - 1); + var prefabItemName = prefabItem.FindPropertyRelative("coreOptions.sublayerName"); + + prefabItemName.stringValue = "New Location"; + + // Set defaults here because SerializedProperty copies the previous element. + prefabItem.FindPropertyRelative("coreOptions.isActive").boolValue = true; + prefabItem.FindPropertyRelative("coreOptions.snapToTerrain").boolValue = true; + var categories = prefabItem.FindPropertyRelative("categories"); + categories.intValue = (int)(LocationPrefabCategories.AnyCategory);//To select any category option + + var density = prefabItem.FindPropertyRelative("density"); + density.intValue = 15;//To select all locations option + + selectedLayers = new int[1] { prefabItemArray.arraySize - 1 }; + layerTreeView.SetSelection(selectedLayers); + + + } + if (GUILayout.Button(new GUIContent("Remove Selected"), (GUIStyle)"minibuttonright")) + { + if (prefabItemArray.arraySize == 0) + { + return; + } + + foreach (var index in selectedLayers.OrderByDescending(i => i)) + { + prefabItemArray.DeleteArrayElementAtIndex(index); + } + selectedLayers = new int[0]; + layerTreeView.SetSelection(selectedLayers); + } + + EditorGUILayout.EndHorizontal(); + + if (selectedLayers.Count == 1 && prefabItemArray.arraySize != 0) + { + //ensure that selectedLayers[0] isn't out of bounds + if (selectedLayers[0] > prefabItemArray.arraySize - 1) + { + selectedLayers[0] = prefabItemArray.arraySize - 1; + } + SelectionIndex = selectedLayers[0]; + + var layerProperty = prefabItemArray.GetArrayElementAtIndex(SelectionIndex); + + layerProperty.isExpanded = true; + var subLayerCoreOptions = layerProperty.FindPropertyRelative("coreOptions"); + bool isLayerActive = subLayerCoreOptions.FindPropertyRelative("isActive").boolValue; + if (!isLayerActive) + { + GUI.enabled = false; + } + + DrawLayerLocationPrefabProperties(layerProperty); + if (!isLayerActive) + { + GUI.enabled = true; + } + } + else + { + GUILayout.Space(15); + GUILayout.Label("Select a visualizer to see properties"); + } + } + + void DrawLayerLocationPrefabProperties(SerializedProperty layerProperty) + { + EditorGUILayout.PropertyField(layerProperty); + } + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PointsOfInterestSubLayerPropertiesDrawer.cs.meta b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PointsOfInterestSubLayerPropertiesDrawer.cs.meta new file mode 100644 index 000000000..7f2373684 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PointsOfInterestSubLayerPropertiesDrawer.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 20fb110d2102743939c89f5a3ab9c3a4 +timeCreated: 1525818946 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PrefabItemOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PrefabItemOptionsDrawer.cs new file mode 100644 index 000000000..52312bfbc --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PrefabItemOptionsDrawer.cs @@ -0,0 +1,196 @@ +namespace Mapbox.Editor +{ + using UnityEngine; + using Mapbox.Unity.Map; + using UnityEditor; + using System; + using System.Collections.Generic; + using Mapbox.VectorTile.ExtensionMethods; + + [CustomPropertyDrawer(typeof(PrefabItemOptions))] + public class PrefabItemOptionsDrawer : PropertyDrawer + { + + static float _lineHeight = EditorGUIUtility.singleLineHeight; + const string searchButtonContent = "Search"; + private GUIContent prefabLocationsTitle = new GUIContent + { + text = "Prefab Locations", + tooltip = "Where on the map to spawn the selected prefab" + }; + + + private GUIContent findByDropDown = new GUIContent + { + text = "Find by", + tooltip = "Find points-of-interest by category, name, or address" + }; + + private GUIContent categoriesDropDown = new GUIContent + { + text = "Category", + tooltip = "Spawn at locations in the categories selected" + }; + + private GUIContent densitySlider = new GUIContent + { + text = "Density", + tooltip = "The number of prefabs to spawn per-tile; try a lower number if the map is cluttered" + }; + + private GUIContent nameField = new GUIContent + { + text = "Name", + tooltip = "Spawn at locations containing this name string" + }; + + GUIContent[] findByPropContent; + bool isGUIContentSet = false; + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + GUILayout.Space(-_lineHeight); + var prefabItemCoreOptions = property.FindPropertyRelative("coreOptions"); + GUILayout.Label(prefabItemCoreOptions.FindPropertyRelative("sublayerName").stringValue + " Properties"); + + //Prefab Game Object + EditorGUI.indentLevel++; + var spawnPrefabOptions = property.FindPropertyRelative("spawnPrefabOptions"); + EditorGUILayout.PropertyField(spawnPrefabOptions); + GUILayout.Space(1); + EditorGUI.indentLevel--; + + //Prefab Locations title + GUILayout.Label(prefabLocationsTitle); + + //FindBy drop down + EditorGUILayout.BeginHorizontal(); + + var findByProp = property.FindPropertyRelative("findByType"); + + var displayNames = findByProp.enumDisplayNames; + int count = findByProp.enumDisplayNames.Length; + if (!isGUIContentSet) + { + findByPropContent = new GUIContent[count]; + for (int extIdx = 0; extIdx < count; extIdx++) + { + findByPropContent[extIdx] = new GUIContent + { + text = displayNames[extIdx], + tooltip = ((LocationPrefabFindBy)extIdx).Description(), + }; + } + isGUIContentSet = true; + } + + EditorGUI.indentLevel++; + + findByProp.enumValueIndex = EditorGUILayout.Popup(findByDropDown, findByProp.enumValueIndex, findByPropContent); + + EditorGUILayout.EndHorizontal(); + + switch ((LocationPrefabFindBy)findByProp.enumValueIndex) + { + case (LocationPrefabFindBy.MapboxCategory): + ShowCategoryOptions(property); + break; + case (LocationPrefabFindBy.AddressOrLatLon): + ShowAddressOrLatLonUI(property); + break; + case (LocationPrefabFindBy.POIName): + ShowPOINames(property); + break; + default: + break; + } + EditorGUI.indentLevel--; + } + + private void ShowCategoryOptions(SerializedProperty property) + { + //Category drop down + var categoryProp = property.FindPropertyRelative("categories"); + categoryProp.intValue = (int)(LocationPrefabCategories)(EditorGUILayout.EnumFlagsField(categoriesDropDown, (LocationPrefabCategories)categoryProp.intValue)); + ShowDensitySlider(property); + } + + private void ShowAddressOrLatLonUI(SerializedProperty property) + { + //EditorGUILayout.BeginVertical(); + var coordinateProperties = property.FindPropertyRelative("coordinates"); + + for (int i = 0; i < coordinateProperties.arraySize; i++) + { + EditorGUILayout.BeginHorizontal(); + //get the element to draw + var coordinate = coordinateProperties.GetArrayElementAtIndex(i); + + //label for each location. + var coordinateLabel = String.Format("Location {0}", i); + + // draw coordinate string. + coordinate.stringValue = EditorGUILayout.TextField(coordinateLabel, coordinate.stringValue); + + // draw search button. + if (GUILayout.Button(new GUIContent(searchButtonContent), (GUIStyle)"minibuttonleft", GUILayout.MaxWidth(100))) + { + GeocodeAttributeSearchWindow.Open(coordinate); + } + + //include a remove button in the row + if (GUILayout.Button(new GUIContent(" X "), (GUIStyle)"minibuttonright", GUILayout.MaxWidth(30))) + { + coordinateProperties.DeleteArrayElementAtIndex(i); + } + EditorGUILayout.EndHorizontal(); + } + + EditorGUILayout.BeginHorizontal(); + GUILayout.Space(EditorGUIUtility.labelWidth - 3); + + if (GUILayout.Button(new GUIContent("Add Location"), (GUIStyle)"minibutton")) + { + coordinateProperties.arraySize++; + var newElement = coordinateProperties.GetArrayElementAtIndex(coordinateProperties.arraySize - 1); + newElement.stringValue = ""; + } + EditorGUILayout.EndHorizontal(); + } + + + private void ShowPOINames(SerializedProperty property) + { + //Name field + var categoryProp = property.FindPropertyRelative("nameString"); + + categoryProp.stringValue = EditorGUILayout.TextField(nameField, categoryProp.stringValue); + + ShowDensitySlider(property); + } + + private void ShowDensitySlider(SerializedProperty property) + { + //Density slider + var densityProp = property.FindPropertyRelative("density"); + if (Application.isPlaying) + { + GUI.enabled = false; + } + + EditorGUILayout.PropertyField(densityProp, densitySlider); + GUI.enabled = true; + densityProp.serializedObject.ApplyModifiedProperties(); + } + + private Rect GetNewRect(Rect position) + { + return new Rect(position.x, position.y, position.width, _lineHeight); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + return _lineHeight; + } + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PrefabitemOptionsDrawer.cs.meta b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PrefabitemOptionsDrawer.cs.meta new file mode 100644 index 000000000..691c3c8d4 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/PrefabitemOptionsDrawer.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: e267a35441e2f4c19a4b96c23afad4ae +timeCreated: 1523396148 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/RangeAroundTransformTileProviderOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/RangeAroundTransformTileProviderOptionsDrawer.cs index e2344767b..76ce40176 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/RangeAroundTransformTileProviderOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/RangeAroundTransformTileProviderOptionsDrawer.cs @@ -11,17 +11,13 @@ public class RangeAroundTransformTileProviderOptionsDrawer : PropertyDrawer public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); - //EditorGUI.indentLevel++; foreach (var item in property) { var subproperty = item as SerializedProperty; - EditorGUI.PropertyField(position, subproperty, true); + EditorGUILayout.PropertyField(subproperty, true); position.height = lineHeight; position.y += lineHeight; } - //EditorGUI.indentLevel--; - EditorGUI.EndProperty(); } } } \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/RangeTileProviderOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/RangeTileProviderOptionsDrawer.cs index dd7d7e5c0..f29868ad4 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/RangeTileProviderOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/RangeTileProviderOptionsDrawer.cs @@ -10,17 +10,13 @@ public class RangeTileProviderOptionsDrawer : PropertyDrawer static float lineHeight = EditorGUIUtility.singleLineHeight; public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); - //EditorGUI.indentLevel++; foreach (var item in property) { var subproperty = item as SerializedProperty; - EditorGUI.PropertyField(position, subproperty, true); + EditorGUILayout.PropertyField(subproperty, true); position.height = lineHeight; position.y += lineHeight; } - //EditorGUI.indentLevel--; - EditorGUI.EndProperty(); } } } \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/SpawnPrefabOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/SpawnPrefabOptionsDrawer.cs new file mode 100644 index 000000000..ce57404b0 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/SpawnPrefabOptionsDrawer.cs @@ -0,0 +1,41 @@ +namespace Mapbox.Unity.Map +{ + using System.Collections; + using System.Collections.Generic; + using UnityEngine; + using Mapbox.Unity.MeshGeneration.Modifiers; + using UnityEditor; + + [CustomPropertyDrawer(typeof(SpawnPrefabOptions))] + public class SpawnPrefabOptionsDrawer : PropertyDrawer + { + static float lineHeight = EditorGUIUtility.singleLineHeight; + + private GUIContent prefabContent = new GUIContent + { + text = "Prefab", + tooltip = "The prefab to be spawned" + }; + + private GUIContent scalePrefabContent = new GUIContent + { + text = "Scale down with world", + tooltip = "The prefab will scale with the map object" + }; + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(position, label, property); + position.height = 2.5f * lineHeight; + property.FindPropertyRelative("prefab").objectReferenceValue = EditorGUI.ObjectField(new Rect(position.x, position.y, position.width, lineHeight), prefabContent, property.FindPropertyRelative("prefab").objectReferenceValue, typeof(UnityEngine.GameObject), false); + position.y += lineHeight; + EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), property.FindPropertyRelative("scaleDownWithWorld"), scalePrefabContent); + EditorGUI.EndProperty(); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + return 2.0f * lineHeight; + } + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/SpawnPrefabOptionsDrawer.cs.meta b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/SpawnPrefabOptionsDrawer.cs.meta new file mode 100644 index 000000000..37481c4e7 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/SpawnPrefabOptionsDrawer.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: d2da764c4c82845efbcea6530b3c8120 +timeCreated: 1523922185 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/StyleOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/StyleOptionsDrawer.cs index 0e84f68a9..04cd7e80b 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/StyleOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/StyleOptionsDrawer.cs @@ -11,13 +11,8 @@ public class StyleOptionsDrawer : PropertyDrawer public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); - - position.height = lineHeight; - - EditorGUI.PropertyField(position, property.FindPropertyRelative("Id"), label); - - EditorGUI.EndProperty(); + GUILayout.Space(-lineHeight); + EditorGUILayout.PropertyField(property.FindPropertyRelative("Id"), label); } public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/VectorFilterOptionsDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/VectorFilterOptionsDrawer.cs index 9fd17eb6e..64cbdbdfa 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/VectorFilterOptionsDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/VectorFilterOptionsDrawer.cs @@ -4,10 +4,18 @@ using UnityEngine; using Mapbox.Unity.Map; using Mapbox.Unity.MeshGeneration.Filters; + using System.Linq; + using System.Collections.Generic; [CustomPropertyDrawer(typeof(VectorFilterOptions))] public class VectorFilterOptionsDrawer : PropertyDrawer { + //indices for tileJSON lookup + int _propertyIndex = 0; + List _propertyNamesList = new List(); + GUIContent[] _propertyNameContent; + + private string[] descriptionArray; static float lineHeight = EditorGUIUtility.singleLineHeight; bool showFilters = true; @@ -19,17 +27,14 @@ public class VectorFilterOptionsDrawer : PropertyDrawer public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); - position.height = lineHeight; - - showFilters = EditorGUI.Foldout(position, showFilters, new GUIContent { text = "Filters", tooltip = "Filter features in a vector layer based on criterion specified. " }); + showFilters = EditorGUILayout.Foldout(showFilters, new GUIContent { text = "Filters", tooltip = "Filter features in a vector layer based on criterion specified. " }); if (showFilters) { var propertyFilters = property.FindPropertyRelative("filters"); for (int i = 0; i < propertyFilters.arraySize; i++) { - DrawLayerFilter(propertyFilters, i); + DrawLayerFilter(property, propertyFilters, i); } if (propertyFilters.arraySize > 0) { @@ -41,20 +46,17 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten if (GUILayout.Button(new GUIContent("Add New Empty"), (GUIStyle)"minibutton")) { propertyFilters.arraySize++; - //propertyFilters.GetArrayElementAtIndex(propertyFilters.arraySize - 1) = null; } EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel--; } - - EditorGUI.EndProperty(); } public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return lineHeight; } - void DrawLayerFilter(SerializedProperty propertyFilters, int index) + void DrawLayerFilter(SerializedProperty originalProperty, SerializedProperty propertyFilters, int index) { var property = propertyFilters.GetArrayElementAtIndex(index); var filterOperatorProp = property.FindPropertyRelative("filterOperator"); @@ -91,7 +93,9 @@ void DrawLayerFilter(SerializedProperty propertyFilters, int index) EditorGUILayout.BeginHorizontal(); - property.FindPropertyRelative("Key").stringValue = EditorGUILayout.TextField(property.FindPropertyRelative("Key").stringValue, GUILayout.MaxWidth(150)); + var selectedLayerName = originalProperty.FindPropertyRelative("_selectedLayerName").stringValue; + + DrawPropertyDropDown(originalProperty, property); filterOperatorProp.enumValueIndex = EditorGUILayout.Popup(filterOperatorProp.enumValueIndex, filterOperatorProp.enumDisplayNames, GUILayout.MaxWidth(150)); switch ((LayerFilterOperationType)filterOperatorProp.enumValueIndex) @@ -120,30 +124,96 @@ void DrawLayerFilter(SerializedProperty propertyFilters, int index) EditorGUILayout.EndVertical(); } - } - //[CustomPropertyDrawer(typeof(TypeVisualizerTuple))] - //public class TypeVisualizerBaseDrawer : PropertyDrawer - //{ - // static float lineHeight = EditorGUIUtility.singleLineHeight; - // bool showPosition = true; - // public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) - // { - // EditorGUI.BeginProperty(position, label, property); - - // position.height = lineHeight; - - // EditorGUI.PropertyField(position, property.FindPropertyRelative("Stack")); - - // EditorGUI.EndProperty(); - // } - // public override float GetPropertyHeight(SerializedProperty property, GUIContent label) - // { - // // Reserve space for the total visible properties. - // int rows = 2; - // //Debug.Log("Height - " + rows * lineHeight); - // return (float)rows * lineHeight; - // } - //} - -} \ No newline at end of file + private void DrawPropertyDropDown(SerializedProperty originalProperty, SerializedProperty filterProperty) + { + var selectedLayerName = originalProperty.FindPropertyRelative("_selectedLayerName").stringValue; + AbstractMap mapObject = (AbstractMap)originalProperty.serializedObject.targetObject; + TileJsonData tileJsonData = mapObject.VectorData.LayerProperty.tileJsonData; + + if (string.IsNullOrEmpty(selectedLayerName) || !tileJsonData.PropertyDisplayNames.ContainsKey(selectedLayerName)) + { + DrawWarningMessage(); + return; + } + + var parsedString = "no property selected"; + var descriptionString = "no description available"; + var propertyDisplayNames = tileJsonData.PropertyDisplayNames[selectedLayerName]; + _propertyNamesList = new List(propertyDisplayNames); + + var propertyString = filterProperty.FindPropertyRelative("Key").stringValue; + //check if the selection is valid + if (_propertyNamesList.Contains(propertyString)) + { + //if the layer contains the current layerstring, set it's index to match + _propertyIndex = propertyDisplayNames.FindIndex(s => s.Equals(propertyString)); + + //create guicontent for a valid layer + _propertyNameContent = new GUIContent[_propertyNamesList.Count]; + for (int extIdx = 0; extIdx < _propertyNamesList.Count; extIdx++) + { + var parsedPropertyString = _propertyNamesList[extIdx].Split(new string[] { tileJsonData.optionalPropertiesString }, System.StringSplitOptions.None)[0].Trim(); + _propertyNameContent[extIdx] = new GUIContent + { + text = _propertyNamesList[extIdx], + tooltip = tileJsonData.LayerPropertyDescriptionDictionary[selectedLayerName][parsedPropertyString] + }; + } + + //display popup + _propertyIndex = EditorGUILayout.Popup(_propertyIndex, _propertyNameContent, GUILayout.MaxWidth(150)); + + //set new string values based on selection + parsedString = _propertyNamesList[_propertyIndex].Split(new string[] { tileJsonData.optionalPropertiesString }, System.StringSplitOptions.None)[0].Trim(); + descriptionString = tileJsonData.LayerPropertyDescriptionDictionary[selectedLayerName][parsedString]; + + } + else + { + //if the selected layer isn't in the source, add a placeholder entry + _propertyIndex = 0; + _propertyNamesList.Insert(0, propertyString); + + //create guicontent for an invalid layer + _propertyNameContent = new GUIContent[_propertyNamesList.Count]; + + //first property gets a unique tooltip + _propertyNameContent[0] = new GUIContent + { + text = _propertyNamesList[0], + tooltip = "Unavialable in Selected Layer" + }; + + for (int extIdx = 1; extIdx < _propertyNamesList.Count; extIdx++) + { + var parsedPropertyString = _propertyNamesList[extIdx].Split(new string[] { tileJsonData.optionalPropertiesString }, System.StringSplitOptions.None)[0].Trim(); + _propertyNameContent[extIdx] = new GUIContent + { + text = _propertyNamesList[extIdx], + tooltip = tileJsonData.LayerPropertyDescriptionDictionary[selectedLayerName][parsedPropertyString] + }; + } + + //display popup + _propertyIndex = EditorGUILayout.Popup(_propertyIndex, _propertyNameContent, GUILayout.MaxWidth(150)); + + //set new string values based on the offset + parsedString = _propertyNamesList[_propertyIndex].Split(new string[] { tileJsonData.optionalPropertiesString }, System.StringSplitOptions.None)[0].Trim(); + descriptionString = "Unavailable in Selected Layer."; + + } + + filterProperty.FindPropertyRelative("Key").stringValue = parsedString; + filterProperty.FindPropertyRelative("KeyDescription").stringValue = descriptionString; + } + + private void DrawWarningMessage() + { + GUIStyle labelStyle = new GUIStyle(EditorStyles.popup); + labelStyle.fontStyle = FontStyle.Bold; + EditorGUILayout.LabelField(new GUIContent(), new GUIContent("No properties"), labelStyle, new GUILayoutOption[] { GUILayout.MaxWidth(155) });//(GUIStyle)"minipopUp"); + return; + } + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/VectorLayerPropertiesDrawer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/VectorLayerPropertiesDrawer.cs index d143f19fb..92d5ad5c9 100644 --- a/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/VectorLayerPropertiesDrawer.cs +++ b/sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/VectorLayerPropertiesDrawer.cs @@ -1,388 +1,104 @@ namespace Mapbox.Editor { using System; - using System.Collections.Generic; - using System.Linq; using UnityEngine; using UnityEditor; using Mapbox.Unity.Map; - using UnityEditor.IMGUI.Controls; - using Mapbox.Unity.MeshGeneration.Modifiers; - using Mapbox.VectorTile.ExtensionMethods; - using Mapbox.Unity.MeshGeneration.Filters; [CustomPropertyDrawer(typeof(VectorLayerProperties))] public class VectorLayerPropertiesDrawer : PropertyDrawer { - static float _lineHeight = EditorGUIUtility.singleLineHeight; - GUIContent[] _sourceTypeContent; - bool _isGUIContentSet = false; - - bool ShowPosition + private string objectId = ""; + /// + /// Gets or sets a value to show or hide Vector section . + /// + /// true if show vector; otherwise, false. + bool ShowLocationPrefabs { get { - return EditorPrefs.GetBool("VectorLayerProperties_showPosition"); + return EditorPrefs.GetBool(objectId + "VectorLayerProperties_showLocationPrefabs"); } set { - EditorPrefs.SetBool("VectorLayerProperties_showPosition", value); + EditorPrefs.SetBool(objectId + "VectorLayerProperties_showLocationPrefabs", value); } } - bool ShowOthers + /// + /// Gets or sets a value to show or hide Vector section . + /// + /// true if show vector; otherwise, false. + bool ShowFeatures { get { - return EditorPrefs.GetBool("VectorLayerProperties_showOthers"); + return EditorPrefs.GetBool(objectId + "VectorLayerProperties_showFeatures"); } set { - EditorPrefs.SetBool("VectorLayerProperties_showOthers", value); + EditorPrefs.SetBool(objectId + "VectorLayerProperties_showFeatures", value); } } - int SelectionIndex + private GUIContent _requiredMapIdGui = new GUIContent { - get - { - return EditorPrefs.GetInt("VectorLayerProperties_selectionIndex"); - } - set - { - EditorPrefs.SetInt("VectorLayerProperties_selectionIndex", value); - } - } + text = "Required Map Id", + tooltip = "For location prefabs to spawn the \"streets-v7\" tileset needs to be a part of the Vector data source" + }; - string CustomSourceMapId - { - get - { - return EditorPrefs.GetString("VectorLayerProperties_customSourceMapId"); - } - set - { - EditorPrefs.SetString("VectorLayerProperties_customSourceMapId", value); - } - } + FeaturesSubLayerPropertiesDrawer _vectorSublayerDrawer = new FeaturesSubLayerPropertiesDrawer(); + PointsOfInterestSubLayerPropertiesDrawer _poiSublayerDrawer = new PointsOfInterestSubLayerPropertiesDrawer(); - private GUIContent _mapIdGui = new GUIContent + void ShowSepartor() { - text = "Map Id", - tooltip = "Map Id corresponding to the tileset." - }; - - VectorSubLayerTreeView layerTreeView = new VectorSubLayerTreeView(new TreeViewState()); - IList selectedLayers = new List(); + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + EditorGUILayout.Space(); + } public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - EditorGUI.BeginProperty(position, label, property); - position.height = _lineHeight; - - var sourceTypeProperty = property.FindPropertyRelative("sourceType"); - var sourceTypeValue = (VectorSourceType)sourceTypeProperty.enumValueIndex; - - var displayNames = sourceTypeProperty.enumDisplayNames; - int count = sourceTypeProperty.enumDisplayNames.Length; - if (!_isGUIContentSet) + EditorGUI.BeginProperty(position, null, property); + objectId = property.serializedObject.targetObject.GetInstanceID().ToString(); + var layerSourceProperty = property.FindPropertyRelative("sourceOptions"); + var sourceTypeProperty = property.FindPropertyRelative("_sourceType"); + VectorSourceType sourceTypeValue = (VectorSourceType)sourceTypeProperty.enumValueIndex; + string streets_v7 = MapboxDefaultVector.GetParameters(VectorSourceType.MapboxStreets).Id; + var layerSourceId = layerSourceProperty.FindPropertyRelative("layerSource.Id"); + string layerString = layerSourceId.stringValue; + + //Draw POI Section + if(sourceTypeValue == VectorSourceType.None) { - _sourceTypeContent = new GUIContent[count]; - for (int extIdx = 0; extIdx < count; extIdx++) - { - _sourceTypeContent[extIdx] = new GUIContent - { - text = displayNames[extIdx], - tooltip = ((VectorSourceType)extIdx).Description(), - }; - } - _isGUIContentSet = true; + return; } - var typePosition = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), new GUIContent { text = "Data Source", tooltip = "Source tileset for Vector Data" }); - - sourceTypeProperty.enumValueIndex = EditorGUI.Popup(typePosition, sourceTypeProperty.enumValueIndex, _sourceTypeContent); - sourceTypeValue = (VectorSourceType)sourceTypeProperty.enumValueIndex; - position.y += _lineHeight; - var sourceOptionsProperty = property.FindPropertyRelative("sourceOptions"); - var layerSourceProperty = sourceOptionsProperty.FindPropertyRelative("layerSource"); - var layerSourceId = layerSourceProperty.FindPropertyRelative("Id"); - var isActiveProperty = sourceOptionsProperty.FindPropertyRelative("isActive"); - switch (sourceTypeValue) + ShowLocationPrefabs = EditorGUILayout.Foldout(ShowLocationPrefabs, "POINTS OF INTEREST"); + if (ShowLocationPrefabs) { - case VectorSourceType.MapboxStreets: - case VectorSourceType.MapboxStreetsWithBuildingIds: - var sourcePropertyValue = MapboxDefaultVector.GetParameters(sourceTypeValue); - layerSourceId.stringValue = sourcePropertyValue.Id; + if (sourceTypeValue != VectorSourceType.None && layerString.Contains(streets_v7)) + { GUI.enabled = false; - EditorGUILayout.PropertyField(sourceOptionsProperty, _mapIdGui); + EditorGUILayout.TextField(_requiredMapIdGui, streets_v7); GUI.enabled = true; - isActiveProperty.boolValue = true; - break; - case VectorSourceType.Custom: - layerSourceId.stringValue = CustomSourceMapId; - EditorGUILayout.PropertyField(sourceOptionsProperty, _mapIdGui); - CustomSourceMapId = layerSourceId.stringValue; - isActiveProperty.boolValue = true; - break; - case VectorSourceType.None: - isActiveProperty.boolValue = false; - break; - default: - isActiveProperty.boolValue = false; - break; - } - if (sourceTypeValue != VectorSourceType.None) - { - position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("sourceOptions")); - - var isStyleOptimized = property.FindPropertyRelative("useOptimizedStyle"); - EditorGUILayout.PropertyField(isStyleOptimized); - position.y += _lineHeight; - - if (isStyleOptimized.boolValue) - { - EditorGUILayout.PropertyField(property.FindPropertyRelative("optimizedStyle"), new GUIContent("Style Options")); - } - position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("optimizedStyle")); - EditorGUILayout.PropertyField(property.FindPropertyRelative("performanceOptions"), new GUIContent("Perfomance Options")); - position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("performanceOptions")); - - EditorGUILayout.LabelField(new GUIContent { text = "Vector Layer Visualizers", tooltip = "Visualizers for vector features contained in a layer. " }); - - var subLayerArray = property.FindPropertyRelative("vectorSubLayers"); - var layersRect = GUILayoutUtility.GetRect(0, 500, Mathf.Max(subLayerArray.arraySize + 1, 1) * _lineHeight, (subLayerArray.arraySize + 1) * _lineHeight); - - - layerTreeView.Layers = subLayerArray; - layerTreeView.Reload(); - layerTreeView.OnGUI(layersRect); - - selectedLayers = layerTreeView.GetSelection(); - - GUILayout.Space(EditorGUIUtility.singleLineHeight); - - GUILayout.BeginHorizontal(); - - if (GUILayout.Button(new GUIContent("Add Visualizer"), (GUIStyle)"minibuttonleft")) - { - subLayerArray.arraySize++; - //subLayerArray.InsertArrayElementAtIndex(subLayerArray.arraySize); - - var subLayer = subLayerArray.GetArrayElementAtIndex(subLayerArray.arraySize - 1); - var subLayerName = subLayer.FindPropertyRelative("coreOptions.sublayerName"); - - subLayerName.stringValue = "Untitled"; - - // Set defaults here because SerializedProperty copies the previous element. - var subLayerCoreOptions = subLayer.FindPropertyRelative("coreOptions"); - subLayerCoreOptions.FindPropertyRelative("isActive").boolValue = true; - subLayerCoreOptions.FindPropertyRelative("layerName").stringValue = "building"; - subLayerCoreOptions.FindPropertyRelative("geometryType").enumValueIndex = (int)VectorPrimitiveType.Polygon; - subLayerCoreOptions.FindPropertyRelative("snapToTerrain").boolValue = true; - subLayerCoreOptions.FindPropertyRelative("groupFeatures").boolValue = false; - subLayerCoreOptions.FindPropertyRelative("lineWidth").floatValue = 1.0f; - - var subLayerExtrusionOptions = subLayer.FindPropertyRelative("extrusionOptions"); - subLayerExtrusionOptions.FindPropertyRelative("extrusionType").enumValueIndex = (int)ExtrusionType.None; - subLayerExtrusionOptions.FindPropertyRelative("extrusionGeometryType").enumValueIndex = (int)ExtrusionGeometryType.RoofAndSide; - subLayerExtrusionOptions.FindPropertyRelative("propertyName").stringValue = "height"; - subLayerExtrusionOptions.FindPropertyRelative("extrusionScaleFactor").floatValue = 1f; - - var subLayerFilterOptions = subLayer.FindPropertyRelative("filterOptions"); - subLayerFilterOptions.FindPropertyRelative("filters").ClearArray(); - subLayerFilterOptions.FindPropertyRelative("combinerType").enumValueIndex = (int)LayerFilterCombinerOperationType.Any; - - var subLayerMaterialOptions = subLayer.FindPropertyRelative("materialOptions"); - subLayerMaterialOptions.FindPropertyRelative("materials").ClearArray(); - subLayerMaterialOptions.FindPropertyRelative("materials").arraySize = 2; - subLayerMaterialOptions.FindPropertyRelative("atlasInfo").objectReferenceValue = null; - subLayerMaterialOptions.FindPropertyRelative("colorPalette").objectReferenceValue = null; - subLayerMaterialOptions.FindPropertyRelative("texturingType").enumValueIndex = (int)UvMapType.Tiled; - - subLayer.FindPropertyRelative("buildingsWithUniqueIds").boolValue = false; - subLayer.FindPropertyRelative("moveFeaturePositionTo").enumValueIndex = (int)PositionTargetType.TileCenter; - subLayer.FindPropertyRelative("MeshModifiers").ClearArray(); - subLayer.FindPropertyRelative("GoModifiers").ClearArray(); - - var subLayerColliderOptions = subLayer.FindPropertyRelative("colliderOptions"); - subLayerColliderOptions.FindPropertyRelative("colliderType").enumValueIndex = (int)ColliderType.None; - - selectedLayers = new int[1] { subLayerArray.arraySize - 1 }; - layerTreeView.SetSelection(selectedLayers); - } - if (GUILayout.Button(new GUIContent("Remove Selected"), (GUIStyle)"minibuttonright")) - { - foreach (var index in selectedLayers.OrderByDescending(i => i)) - { - subLayerArray.DeleteArrayElementAtIndex(index); - } - selectedLayers = new int[0]; - layerTreeView.SetSelection(selectedLayers); - } - - GUILayout.EndHorizontal(); - - GUILayout.Space(EditorGUIUtility.singleLineHeight); - - if (selectedLayers.Count == 1) - { - SelectionIndex = selectedLayers[0]; - - var layerProperty = subLayerArray.GetArrayElementAtIndex(SelectionIndex); - - layerProperty.isExpanded = true; - DrawLayerVisualizerProperties(sourceTypeValue,layerProperty); + _poiSublayerDrawer.DrawUI(property); } else { - GUILayout.Label("Select a visualizer to see properties"); + EditorGUILayout.HelpBox("In order to place points of interest please add \"mapbox.mapbox-streets-v7\" to the data source.", MessageType.Error); } } - EditorGUI.EndProperty(); - } - - void DrawLayerVisualizerProperties(VectorSourceType sourceType, SerializedProperty layerProperty) - { - EditorGUI.indentLevel++; - GUILayout.Label("Vector Layer Visualizer Properties"); - GUILayout.BeginVertical(); - var subLayerCoreOptions = layerProperty.FindPropertyRelative("coreOptions"); - VectorPrimitiveType primitiveTypeProp = (VectorPrimitiveType)subLayerCoreOptions.FindPropertyRelative("geometryType").enumValueIndex; + ShowSepartor(); - EditorGUILayout.PropertyField(subLayerCoreOptions); - - if (primitiveTypeProp != VectorPrimitiveType.Point && primitiveTypeProp != VectorPrimitiveType.Custom) - { - EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("colliderOptions")); - - EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("extrusionOptions")); - - EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("materialOptions")); - } - //EditorGUI.indentLevel--; - ShowOthers = EditorGUILayout.Foldout(ShowOthers, "Advanced"); - EditorGUI.indentLevel++; - if (ShowOthers) + //Draw Feature section. + ShowFeatures = EditorGUILayout.Foldout(ShowFeatures, "FEATURES"); + if (ShowFeatures) { - if (primitiveTypeProp == VectorPrimitiveType.Polygon && sourceType != VectorSourceType.MapboxStreets) - { - EditorGUI.indentLevel--; - layerProperty.FindPropertyRelative("honorBuildingIdSetting").boolValue = true; - EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("buildingsWithUniqueIds"), new GUIContent { text = "Buildings With Unique Ids", tooltip = "Turn on this setting only when rendering 3D buildings from the Mapbox Streets with Building Ids tileset. Using this setting with any other polygon layers or source will result in visual artifacts. " }); - EditorGUI.indentLevel++; - } - else - { - layerProperty.FindPropertyRelative("honorBuildingIdSetting").boolValue = false; - } - EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("filterOptions"), new GUIContent("Filters")); - //EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("modifierOptions"), new GUIContent("Modifiers")); - DrawModifiers(layerProperty, new GUIContent { text = "Modifier Options", tooltip = "Additional Feature modifiers to apply to the visualizer. " }); + _vectorSublayerDrawer.DrawUI(property); } - EditorGUI.indentLevel--; - GUILayout.EndVertical(); - EditorGUI.indentLevel--; - } - - void DrawModifiers(SerializedProperty property, GUIContent label) - { - var groupFeaturesProperty = property.FindPropertyRelative("coreOptions").FindPropertyRelative("groupFeatures"); - ShowPosition = EditorGUILayout.Foldout(ShowPosition, label.text); - EditorGUILayout.BeginVertical(); - if (ShowPosition) - { - - EditorGUILayout.BeginHorizontal(); - if (groupFeaturesProperty.boolValue == false) - { - EditorGUILayout.PrefixLabel(new GUIContent { text = "Feature Position", tooltip = "Position to place feature in the tile. " }); - var featurePositionProperty = property.FindPropertyRelative("moveFeaturePositionTo"); - featurePositionProperty.enumValueIndex = EditorGUILayout.Popup(featurePositionProperty.enumValueIndex, featurePositionProperty.enumDisplayNames); - } - EditorGUILayout.EndHorizontal(); - - EditorGUILayout.Space(); - - EditorGUILayout.LabelField(new GUIContent { text = "Mesh Modifiers", tooltip = "Modifiers that manipulate the features mesh. " }); - var meshfac = property.FindPropertyRelative("MeshModifiers"); - - for (int i = 0; i < meshfac.arraySize; i++) - { - var ind = i; - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.BeginVertical(); - meshfac.GetArrayElementAtIndex(ind).objectReferenceValue = EditorGUILayout.ObjectField(meshfac.GetArrayElementAtIndex(i).objectReferenceValue, typeof(MeshModifier), false) as ScriptableObject; - EditorGUILayout.EndVertical(); - if (GUILayout.Button(new GUIContent("+"), (GUIStyle)"minibuttonleft", GUILayout.Width(30))) - { - ScriptableCreatorWindow.Open(typeof(MeshModifier), meshfac, ind); - } - if (GUILayout.Button(new GUIContent("-"), (GUIStyle)"minibuttonright", GUILayout.Width(30))) - { - meshfac.DeleteArrayElementAtIndex(ind); - } - EditorGUILayout.EndHorizontal(); - } - - EditorGUILayout.Space(); - EditorGUI.indentLevel++; - EditorGUILayout.BeginHorizontal(); - GUILayout.Space(EditorGUI.indentLevel * 12); - if (GUILayout.Button(new GUIContent("Add New Empty"), (GUIStyle)"minibuttonleft")) - { - meshfac.arraySize++; - meshfac.GetArrayElementAtIndex(meshfac.arraySize - 1).objectReferenceValue = null; - } - if (GUILayout.Button(new GUIContent("Find Asset"), (GUIStyle)"minibuttonright")) - { - ScriptableCreatorWindow.Open(typeof(MeshModifier), meshfac); - } - EditorGUILayout.EndHorizontal(); - EditorGUI.indentLevel--; - EditorGUILayout.Space(); - EditorGUILayout.LabelField(new GUIContent { text = "Game Object Modifiers", tooltip = "Modifiers that manipulate the GameObject after mesh generation." }); - var gofac = property.FindPropertyRelative("GoModifiers"); - for (int i = 0; i < gofac.arraySize; i++) - { - var ind = i; - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.BeginVertical(); - GUILayout.Space(5); - gofac.GetArrayElementAtIndex(ind).objectReferenceValue = EditorGUILayout.ObjectField(gofac.GetArrayElementAtIndex(i).objectReferenceValue, typeof(GameObjectModifier), false) as ScriptableObject; - EditorGUILayout.EndVertical(); - - if (GUILayout.Button(new GUIContent("+"), (GUIStyle)"minibuttonleft", GUILayout.Width(30))) - { - ScriptableCreatorWindow.Open(typeof(GameObjectModifier), gofac, ind); - } - if (GUILayout.Button(new GUIContent("-"), (GUIStyle)"minibuttonright", GUILayout.Width(30))) - { - gofac.DeleteArrayElementAtIndex(ind); - } - EditorGUILayout.EndHorizontal(); - } - - EditorGUILayout.Space(); - EditorGUI.indentLevel++; - EditorGUILayout.BeginHorizontal(); - GUILayout.Space(EditorGUI.indentLevel * 12); - if (GUILayout.Button(new GUIContent("Add New Empty"), (GUIStyle)"minibuttonleft")) - { - gofac.arraySize++; - gofac.GetArrayElementAtIndex(gofac.arraySize - 1).objectReferenceValue = null; - } - if (GUILayout.Button(new GUIContent("Find Asset"), (GUIStyle)"minibuttonright")) - { - ScriptableCreatorWindow.Open(typeof(GameObjectModifier), gofac); - } - EditorGUILayout.EndHorizontal(); - EditorGUI.indentLevel--; - } - // - EditorGUILayout.EndVertical(); + EditorGUI.EndProperty(); } } } diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/TerrainFactoryEditor.cs b/sdkproject/Assets/Mapbox/Unity/Editor/TerrainFactoryEditor.cs deleted file mode 100644 index 33977eb71..000000000 --- a/sdkproject/Assets/Mapbox/Unity/Editor/TerrainFactoryEditor.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Mapbox.Editor -{ - using UnityEngine; - using UnityEditor; - using Mapbox.Unity.MeshGeneration.Factories; - using Mapbox.Unity.Map; - - [CustomEditor(typeof(TerrainFactory))] - public class TerrainFactoryEditor : FactoryEditor - { - public SerializedProperty layerProperties; - private MonoScript script; - - void OnEnable() - { - layerProperties = serializedObject.FindProperty("_elevationOptions"); - var terrainType = layerProperties.FindPropertyRelative("elevationLayerType"); - terrainType.enumValueIndex = (int)ElevationLayerType.TerrainWithElevation; - script = MonoScript.FromScriptableObject((TerrainFactory)target); - } - - public override void OnInspectorGUI() - { - serializedObject.Update(); - - GUI.enabled = false; - script = EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false) as MonoScript; - GUI.enabled = true; - EditorGUILayout.Space(); - EditorGUILayout.PropertyField(layerProperties); - EditorGUILayout.Space(); - - serializedObject.ApplyModifiedProperties(); - } - } -} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/TerrainFactoryEditor.cs.meta b/sdkproject/Assets/Mapbox/Unity/Editor/TerrainFactoryEditor.cs.meta deleted file mode 100644 index 6b8effe09..000000000 --- a/sdkproject/Assets/Mapbox/Unity/Editor/TerrainFactoryEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f20150ceca635c44dab37cfe0460aa36 -timeCreated: 1490923136 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/TerrainWithSideWallsFactoryEditor.cs b/sdkproject/Assets/Mapbox/Unity/Editor/TerrainWithSideWallsFactoryEditor.cs deleted file mode 100644 index 20c2377a1..000000000 --- a/sdkproject/Assets/Mapbox/Unity/Editor/TerrainWithSideWallsFactoryEditor.cs +++ /dev/null @@ -1,34 +0,0 @@ -using UnityEngine; -using UnityEditor; -using Mapbox.Unity.MeshGeneration.Factories; -using Mapbox.Unity.Map; -using Mapbox.Editor; - -[CustomEditor(typeof(TerrainWithSideWallsFactory))] -public class TerrainWithSideWallsFactoryEditor : FactoryEditor -{ - public SerializedProperty layerProperties; - private MonoScript script; - - void OnEnable() - { - layerProperties = serializedObject.FindProperty("_elevationOptions"); - var terrainType = layerProperties.FindPropertyRelative("elevationLayerType"); - terrainType.enumValueIndex = (int)ElevationLayerType.TerrainWithElevation; - script = MonoScript.FromScriptableObject((TerrainFactory)target); - } - - public override void OnInspectorGUI() - { - serializedObject.Update(); - - GUI.enabled = false; - script = EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false) as MonoScript; - GUI.enabled = true; - EditorGUILayout.Space(); - EditorGUILayout.PropertyField(layerProperties); - EditorGUILayout.Space(); - - serializedObject.ApplyModifiedProperties(); - } -} diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/TerrainWithSideWallsFactoryEditor.cs.meta b/sdkproject/Assets/Mapbox/Unity/Editor/TerrainWithSideWallsFactoryEditor.cs.meta deleted file mode 100644 index bd740c5d3..000000000 --- a/sdkproject/Assets/Mapbox/Unity/Editor/TerrainWithSideWallsFactoryEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 892db61955c75204eb4f906e6f82be51 -timeCreated: 1508723619 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/UnitTests.meta b/sdkproject/Assets/Mapbox/Unity/Editor/UnitTests.meta new file mode 100644 index 000000000..7e08135da --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/UnitTests.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 176608a5861a8f640a5d17d0440608fe +folderAsset: yes +timeCreated: 1525261465 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/UnitTests/MapboxUnitTests_CircularBuffer.cs b/sdkproject/Assets/Mapbox/Unity/Editor/UnitTests/MapboxUnitTests_CircularBuffer.cs new file mode 100644 index 000000000..85ca6b3e8 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/UnitTests/MapboxUnitTests_CircularBuffer.cs @@ -0,0 +1,74 @@ + +namespace Mapbox.Unity.UnitTest +{ + + using System.Collections.Generic; + using System.Linq; + using NUnit.Framework; + using Mapbox.Utils; + + + [TestFixture] + internal class CircularBufferTest + { + + [Test] + public void SettingAndGettingValues() + { + CircularBuffer cb = new CircularBuffer(5); + + Assert.AreEqual(0, cb.Count, "initializes to 0"); + + cb.Add(10); + Assert.AreEqual(1, cb.Count, "added one value. count == 3"); + + cb.Add(20); + cb.Add(30); + Assert.AreEqual(3, cb.Count, "added three values. count == 3"); + // newest value is at [0], oldest at cb[cb.Count-1] + Assert.AreEqual(30, cb[0], "circularbuffer[0] == 30"); + Assert.AreEqual(10, cb[cb.Count - 1], "circularbuffer[cb.Count-1] == 10"); + + cb.Add(40); + cb.Add(50); + Assert.AreEqual(5, cb.Count, "added five values. count == 5"); + + cb.Add(60); + Assert.AreEqual(5, cb.Count, "added six values. count == 5"); + Assert.AreEqual(60, cb[0], "circularbuffer[0] == 60"); + Assert.AreEqual(20, cb[cb.Count - 1], "circularbuffer[cb.Count-1] == 20"); + + cb.Add(70); + cb.Add(80); + + + // test getting values via different methods + + int[] expected = new int[] { 80, 70, 60, 50, 40 }; + + // test values via indexer + for (int i = 0; i < cb.Count; i++) + { + Assert.AreEqual(expected[i], cb[i], "indexer returned correct value"); + } + + // test values via Enumerator + int[] actual = new int[cb.Count]; + int idx = 0; + IEnumerator enumerator = cb.GetEnumerator(); + while (enumerator.MoveNext()) + { + actual[idx] = enumerator.Current; + idx++; + } + Assert.AreEqual(expected, actual, "IEnumerator returned correct sequence"); + + // test values via Enumerable + actual = cb.GetEnumerable().ToArray(); + Assert.AreEqual(expected, actual, "IEnumerable returned correct sequence"); + } + + + } +} + diff --git a/sdkproject/Assets/Mapbox/Unity/Editor/UnitTests/MapboxUnitTests_CircularBuffer.cs.meta b/sdkproject/Assets/Mapbox/Unity/Editor/UnitTests/MapboxUnitTests_CircularBuffer.cs.meta new file mode 100644 index 000000000..5d0d8eeed --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Editor/UnitTests/MapboxUnitTests_CircularBuffer.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 3ed6d8ff71089c94898c1ac318371408 +timeCreated: 1525261481 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/LayerProperties/CoreVectorLayerProperties.cs b/sdkproject/Assets/Mapbox/Unity/LayerProperties/CoreVectorLayerProperties.cs index 1989ec5b8..4a1b699b6 100644 --- a/sdkproject/Assets/Mapbox/Unity/LayerProperties/CoreVectorLayerProperties.cs +++ b/sdkproject/Assets/Mapbox/Unity/LayerProperties/CoreVectorLayerProperties.cs @@ -27,6 +27,8 @@ public class CoreVectorLayerProperties [Serializable] public class VectorFilterOptions { + [SerializeField] + private string _selectedLayerName; public List filters = new List(); [Tooltip("Operator to combine filters. ")] public LayerFilterCombinerOperationType combinerType = LayerFilterCombinerOperationType.All; diff --git a/sdkproject/Assets/Mapbox/Unity/LayerProperties/LayerProperties.cs b/sdkproject/Assets/Mapbox/Unity/LayerProperties/LayerProperties.cs index e63b1b57c..4b19dba7d 100644 --- a/sdkproject/Assets/Mapbox/Unity/LayerProperties/LayerProperties.cs +++ b/sdkproject/Assets/Mapbox/Unity/LayerProperties/LayerProperties.cs @@ -1,4 +1,6 @@ -namespace Mapbox.Unity.Map +using UnityEngine; + +namespace Mapbox.Unity.Map { public abstract class LayerProperties { diff --git a/sdkproject/Assets/Mapbox/Unity/LayerProperties/PrefabItemOptions.cs b/sdkproject/Assets/Mapbox/Unity/LayerProperties/PrefabItemOptions.cs new file mode 100644 index 000000000..4c235702c --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/LayerProperties/PrefabItemOptions.cs @@ -0,0 +1,148 @@ +namespace Mapbox.Unity.Map +{ + using UnityEngine; + using System.Collections; + using System; + using System.Collections.Generic; + using Mapbox.Unity.MeshGeneration.Modifiers; + using Mapbox.Unity.Utilities; + using Mapbox.Unity.MeshGeneration.Filters; + + [Serializable] + public class PrefabItemOptions : VectorSubLayerProperties + { + #region Fixed Properties + //Fixed primitiveType + public readonly VectorPrimitiveType primitiveType = VectorPrimitiveType.Point; + + //Group features turned off + public readonly bool groupFeatures = false; + + //No extrusion + public readonly ExtrusionType extrusionType = ExtrusionType.None; + + //Dictionary containing the layer names for each location prefab find by type + public readonly Dictionary layerNameFromFindByTypeDictionary = new Dictionary + { + {LocationPrefabFindBy.AddressOrLatLon, ""}, + {LocationPrefabFindBy.MapboxCategory, "poi_label"}, + {LocationPrefabFindBy.POIName, "poi_label"}, + }; + + //Dictionary containing the property names in the layer for each location prefab find by type + public readonly Dictionary categoryPropertyFromFindByTypeDictionary = new Dictionary + { + {LocationPrefabFindBy.AddressOrLatLon, ""}, + {LocationPrefabFindBy.MapboxCategory, "maki"}, + {LocationPrefabFindBy.POIName, "name"}, + }; + + //Dictionary containing the density names in the layer for each location prefab find by type + public readonly Dictionary densityPropertyFromFindByTypeDictionary = new Dictionary + { + {LocationPrefabFindBy.AddressOrLatLon, ""}, + {LocationPrefabFindBy.MapboxCategory, "localrank"}, + {LocationPrefabFindBy.POIName, "localrank"}, + }; + + //Dictionary containing the density names in the layer for each location prefab find by type + public readonly Dictionary namePropertyFromFindByTypeDictionary = new Dictionary + { + {LocationPrefabFindBy.AddressOrLatLon, ""}, + {LocationPrefabFindBy.MapboxCategory, ""}, + {LocationPrefabFindBy.POIName, "name"}, + }; + + //Force Move prefab feature position to the first vertex + public readonly PositionTargetType _movePrefabFeaturePositionTo = PositionTargetType.FirstVertex; + + public readonly LayerFilterCombinerOperationType _combinerType = LayerFilterCombinerOperationType.All; + #endregion + + #region User Choice Properties + + /// + /// Gets or sets a value indicating whether this item is active. + /// + /// true if is active; otherwise, false. + public bool isActive + { + get + { + return coreOptions.isActive; + } + set + { + coreOptions.isActive = value; + } + } + + public bool snapToTerrain + { + get + { + return coreOptions.snapToTerrain; + } + set + { + coreOptions.snapToTerrain = value; + } + } + + public string prefabItemName + { + get + { + return coreOptions.sublayerName; + } + set + { + coreOptions.sublayerName = value; + } + } + + /// + /// The prefab to be spawned on the map + /// + public SpawnPrefabOptions spawnPrefabOptions; + + /// + /// Find points-of-interest to spawn prefabs using this enum + /// + public LocationPrefabFindBy findByType = LocationPrefabFindBy.MapboxCategory;//default to Mapbox Category + + /// + /// Spawn at any location in the categories selected + /// + public LocationPrefabCategories categories; + + /// + /// Spawn at any location containing this name string + /// + public string nameString = "Name"; + + /// + /// Spawn at specific coordinates + /// + [Geocode] + public string[] coordinates; + + + [Range(1, 30)] + public int density = 15; + + public Action> OnAllPrefabsInstantiated + { + get + { + return spawnPrefabOptions.AllPrefabsInstatiated; + } + set + { + spawnPrefabOptions.AllPrefabsInstatiated = value; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/LayerProperties/PrefabItemOptions.cs.meta b/sdkproject/Assets/Mapbox/Unity/LayerProperties/PrefabItemOptions.cs.meta new file mode 100644 index 000000000..bb1c10751 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/LayerProperties/PrefabItemOptions.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 06b454a4295ed4bb2ba217a2196dfb15 +timeCreated: 1523915763 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/LayerProperties/VectorLayerProperties.cs b/sdkproject/Assets/Mapbox/Unity/LayerProperties/VectorLayerProperties.cs index 8bf547e27..51174fbfd 100644 --- a/sdkproject/Assets/Mapbox/Unity/LayerProperties/VectorLayerProperties.cs +++ b/sdkproject/Assets/Mapbox/Unity/LayerProperties/VectorLayerProperties.cs @@ -2,25 +2,58 @@ { using System; using System.Collections.Generic; + using Mapbox.Platform.TilesetTileJSON; using Mapbox.Unity.Utilities; using UnityEngine; [Serializable] public class VectorLayerProperties : LayerProperties { - public VectorSourceType sourceType = VectorSourceType.MapboxStreets; + /// + /// Raw tileJSON response received from the requested source tileset id(s) + /// + public TileJsonData tileJsonData = new TileJsonData(); + [SerializeField] + protected VectorSourceType _sourceType = VectorSourceType.MapboxStreets; + public VectorSourceType sourceType + { + get + { + return _sourceType; + } + set + { + if (value != VectorSourceType.Custom) + { + sourceOptions.Id = MapboxDefaultVector.GetParameters(value).Id; + } + + if (value == VectorSourceType.None) + { + sourceOptions.isActive = false; + } + else + { + sourceOptions.isActive = true; + } + + _sourceType = value; + } + } + public LayerSourceOptions sourceOptions = new LayerSourceOptions() { isActive = true, layerSource = MapboxDefaultVector.GetParameters(VectorSourceType.MapboxStreets) - }; [Tooltip("Use Mapbox style-optimized tilesets, remove any layers or features in the tile that are not represented by a Mapbox style. Style-optimized vector tiles are smaller, served over-the-wire, and a great way to reduce the size of offline caches.")] public bool useOptimizedStyle = false; [StyleSearch] public Style optimizedStyle; public LayerPerformanceOptions performanceOptions; - [NodeEditorElementAttribute("Vector Sublayers")] + [NodeEditorElementAttribute("Feature Sublayers")] public List vectorSubLayers = new List(); + [NodeEditorElementAttribute("POI Sublayers")] + public List locationPrefabList = new List(); } } diff --git a/sdkproject/Assets/Mapbox/Unity/Location/AbstractEditorLocationProvider.cs b/sdkproject/Assets/Mapbox/Unity/Location/AbstractEditorLocationProvider.cs index 98cd17242..a8b7d1d45 100644 --- a/sdkproject/Assets/Mapbox/Unity/Location/AbstractEditorLocationProvider.cs +++ b/sdkproject/Assets/Mapbox/Unity/Location/AbstractEditorLocationProvider.cs @@ -52,7 +52,7 @@ public void SendLocationEvent() } - void OnValidate() + protected virtual void OnValidate() { if (_sendEvent) { diff --git a/sdkproject/Assets/Mapbox/Unity/Location/DeviceLocationProvider.cs b/sdkproject/Assets/Mapbox/Unity/Location/DeviceLocationProvider.cs index a8d463c49..ab7e7c442 100644 --- a/sdkproject/Assets/Mapbox/Unity/Location/DeviceLocationProvider.cs +++ b/sdkproject/Assets/Mapbox/Unity/Location/DeviceLocationProvider.cs @@ -3,6 +3,9 @@ namespace Mapbox.Unity.Location using System.Collections; using UnityEngine; using Mapbox.Utils; + using Mapbox.CheapRulerCs; + using System; + using System.Linq; /// /// The DeviceLocationProvider is responsible for providing real world location and heading data, @@ -28,13 +31,30 @@ public class DeviceLocationProvider : AbstractLocationProvider [Tooltip("The minimum distance (measured in meters) a device must move laterally before Input.location property is updated. Higher values like 500 imply less overhead.")] float _updateDistanceInMeters = 5f; - Coroutine _pollRoutine; - double _lastLocationTimestamp; - - double _lastHeadingTimestamp; - - WaitForSeconds _wait1sec; + [SerializeField] + [Tooltip("The minimum time interval between location updates, in milliseconds.")] + long _updateTimeInMilliSeconds = 1000; + + + private Coroutine _pollRoutine; + private double _lastLocationTimestamp; + private double _lastHeadingTimestamp; + private WaitForSeconds _wait1sec; + private WaitForSeconds _waitUpdateTime; + /// list of positions to keep for calculations + private CircularBuffer _lastPositions; + /// number of last positons to keep + private int _maxLastPositions = 5; + /// minimum needed distance between oldest and newest position before UserHeading is calculated + private double _minDistanceOldestNewestPosition = 1.5; + /// weights for calculating 'UserHeading'. hardcoded for now. TODO: auto-calc based on time, distance, ... + private float[] _headingWeights = new float[]{ + 0, + -0.5f, + -1.0f, + -1.5f + }; // Android 6+ permissions have to be granted during runtime @@ -49,9 +69,19 @@ public class DeviceLocationProvider : AbstractLocationProvider #endif - void Awake() + protected virtual void Awake() { + _currentLocation.Provider = "unity"; _wait1sec = new WaitForSeconds(1f); + _waitUpdateTime = _updateTimeInMilliSeconds < 500 ? new WaitForSeconds(500) : new WaitForSeconds(_updateTimeInMilliSeconds / 1000); + + _lastPositions = new CircularBuffer(_maxLastPositions); + // safe measure till we have auto calculated weights + // "_maxLastPositions - 1" because we calculate user heading on the fly: nr of angles = nr of positions - 1 + if (_headingWeights.Length != _maxLastPositions - 1) + { + throw new Exception("number of last positions NOT equal number of heading weights"); + } if (_pollRoutine == null) { @@ -134,66 +164,100 @@ IEnumerator PollLocationRoutine() yield return _wait1sec; #endif - - float gpsInitializedTime = Time.realtimeSinceStartup; - // initially pass through all locations that come available - float gpsWarmupTime = 120f; //seconds System.Globalization.CultureInfo invariantCulture = System.Globalization.CultureInfo.InvariantCulture; while (true) { - _currentLocation.IsLocationServiceEnabled = true; - _currentLocation.IsHeadingUpdated = false; + _currentLocation.IsLocationServiceEnabled = Input.location.status == LocationServiceStatus.Running; + + _currentLocation.IsUserHeadingUpdated = false; _currentLocation.IsLocationUpdated = false; - var timestamp = Input.compass.timestamp; - if ( - Input.compass.enabled && timestamp > _lastHeadingTimestamp - || Time.realtimeSinceStartup < gpsInitializedTime + gpsWarmupTime - ) + if (!_currentLocation.IsLocationServiceEnabled) { - var heading = Input.compass.trueHeading; - _currentLocation.Heading = heading; - _currentLocation.HeadingMagnetic = Input.compass.magneticHeading; - _currentLocation.HeadingAccuracy = Input.compass.headingAccuracy; - _lastHeadingTimestamp = timestamp; - - _currentLocation.IsHeadingUpdated = true; + yield return _waitUpdateTime; + continue; } + // device orientation, user heading get calculated below + _currentLocation.DeviceOrientation = Input.compass.trueHeading; + + var lastData = Input.location.lastData; - timestamp = lastData.timestamp; + var timestamp = lastData.timestamp; //Debug.LogFormat("{0:yyyyMMdd-HHmmss} acc:{1:0.00} {2} / {3}", UnixTimestampUtils.From(timestamp), lastData.horizontalAccuracy, lastData.latitude, lastData.longitude); - if ( - (Input.location.status == LocationServiceStatus.Running && timestamp > _lastLocationTimestamp) - || Time.realtimeSinceStartup < gpsInitializedTime + gpsWarmupTime - ) + + //_currentLocation.LatitudeLongitude = new Vector2d(lastData.latitude, lastData.longitude); + // HACK to get back to double precision, does this even work? + // https://forum.unity.com/threads/precision-of-location-longitude-is-worse-when-longitude-is-beyond-100-degrees.133192/#post-1835164 + double latitude = double.Parse(lastData.latitude.ToString("R", invariantCulture), invariantCulture); + double longitude = double.Parse(lastData.longitude.ToString("R", invariantCulture), invariantCulture); + _currentLocation.LatitudeLongitude = new Vector2d(latitude, longitude); + + _currentLocation.Accuracy = (int)System.Math.Floor(lastData.horizontalAccuracy); + _currentLocation.IsLocationUpdated = timestamp > _lastLocationTimestamp; + _currentLocation.Timestamp = timestamp; + _lastLocationTimestamp = timestamp; + + if (_currentLocation.IsLocationUpdated) { - //_currentLocation.LatitudeLongitude = new Vector2d(lastData.latitude, lastData.longitude); - // HACK to get back to double precision, does this even work? - // https://forum.unity.com/threads/precision-of-location-longitude-is-worse-when-longitude-is-beyond-100-degrees.133192/#post-1835164 - double latitude = double.Parse(lastData.latitude.ToString("R", invariantCulture), invariantCulture); - double longitude = double.Parse(lastData.longitude.ToString("R", invariantCulture), invariantCulture); - _currentLocation.LatitudeLongitude = new Vector2d(latitude, longitude); - - _currentLocation.Accuracy = (int)System.Math.Floor(lastData.horizontalAccuracy); - _currentLocation.Timestamp = timestamp; - _lastLocationTimestamp = timestamp; - - _currentLocation.IsLocationUpdated = true; + _lastPositions.Add(_currentLocation.LatitudeLongitude); } - if (_currentLocation.IsHeadingUpdated || _currentLocation.IsLocationUpdated) + // calculate user heading. only if we have enough positions available + if (_lastPositions.Count < _maxLastPositions) { - if (_currentLocation.LatitudeLongitude != Vector2d.zero) + _currentLocation.UserHeading = 0; + } + else + { + Vector2d newestPos = _lastPositions[0]; + Vector2d oldestPos = _lastPositions[_maxLastPositions - 1]; + CheapRuler cheapRuler = new CheapRuler(newestPos.x, CheapRulerUnits.Meters); + // distance between last and first position in our buffer + double distance = cheapRuler.Distance( + new double[] { newestPos.y, newestPos.x }, + new double[] { oldestPos.y, oldestPos.x } + ); + // positions are minimum required distance apart (user is moving), calculate user heading + if (distance >= _minDistanceOldestNewestPosition) { - SendLocation(_currentLocation); + // calculate final heading from last positions but give newest headings more weight: + // '_lastPositions' contains newest at [0] + // formula: + // (heading[0] * e^weight[0] + heading[1] * e^weight[1] + .... ) / weight sum + float[] lastHeadings = new float[_maxLastPositions - 1]; + float[] actualWeights = new float[_maxLastPositions - 1]; + float finalHeading = 0f; + + for (int i = 1; i < _maxLastPositions; i++) + { + lastHeadings[i - 1] = (float)(Math.Atan2(_lastPositions[i].y - _lastPositions[i - 1].y, _lastPositions[i].x - _lastPositions[i - 1].x) * 180 / Math.PI); + // quick fix to take care of 355� and 5� being apart 10� and not 350� + if (lastHeadings[i - 1] > 180) { lastHeadings[i - 1] -= 360f; } + } + + for (int i = 0; i < lastHeadings.Length; i++) + { + actualWeights[i] = (float)Math.Exp(_headingWeights[i]); + finalHeading += lastHeadings[i] * actualWeights[i]; + } + + float weightSum = actualWeights.Sum(); + finalHeading /= weightSum; + // stay within [0..359] no negative angles + if (finalHeading < 0) { finalHeading += 360; } + + _currentLocation.UserHeading = finalHeading; + _currentLocation.IsUserHeadingUpdated = true; } } - yield return null; + SendLocation(_currentLocation); + + yield return _waitUpdateTime; } } } diff --git a/sdkproject/Assets/Mapbox/Unity/Location/DeviceLocationProviderAndroidNative.cs b/sdkproject/Assets/Mapbox/Unity/Location/DeviceLocationProviderAndroidNative.cs new file mode 100644 index 000000000..4a6f35463 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/DeviceLocationProviderAndroidNative.cs @@ -0,0 +1,442 @@ +namespace Mapbox.Unity.Location +{ + using UnityEngine; + using System.Collections; + using System.Globalization; + using System; + using System.IO; + using System.Text; + + + public class DeviceLocationProviderAndroidNative : AbstractLocationProvider, IDisposable + { + + + /// + /// The minimum distance (measured in meters) a device must move laterally before location is updated. + /// https://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.location.LocationListener) + /// + [SerializeField] + [Tooltip("The minimum distance (measured in meters) a device must move laterally before location is updated. Higher values like 500 imply less overhead.")] + float _updateDistanceInMeters = 0.5f; + + + /// + /// The minimum time interval between location updates, in milliseconds. + /// https://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.location.LocationListener) + /// + [SerializeField] + [Tooltip("The minimum time interval between location updates, in milliseconds.")] + long _updateTimeInMilliSeconds = 1000; + + + private WaitForSeconds _wait1sec; + private WaitForSeconds _wait5sec; + private WaitForSeconds _wait60sec; + /// polls location provider only at the requested update intervall to reduce load + private WaitForSeconds _waitUpdateTime; + private bool _disposed; + private static object _lock = new object(); + private Coroutine _pollLocation; + //private CultureInfo _invariantCulture = CultureInfo.InvariantCulture; + private AndroidJavaObject _activityContext = null; + private AndroidJavaObject _gpsInstance; + private AndroidJavaObject _sensorInstance; + + + ~DeviceLocationProviderAndroidNative() { Dispose(false); } + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + + protected virtual void Dispose(bool disposeManagedResources) + { + if (!_disposed) + { + if (disposeManagedResources) + { + shutdown(); + } + _disposed = true; + } + } + + + private void shutdown() + { + try + { + lock (_lock) + { + if (null != _gpsInstance) + { + _gpsInstance.Call("stopLocationListeners"); + _gpsInstance.Dispose(); + _gpsInstance = null; + } + if (null != _sensorInstance) + { + _sensorInstance.Call("stopSensorListeners"); + _sensorInstance.Dispose(); + _sensorInstance = null; + } + } + } + catch (Exception ex) + { + Debug.LogError(ex); + } + } + + + protected virtual void OnDestroy() { shutdown(); } + + + protected virtual void OnDisable() { shutdown(); } + + protected virtual void Awake() + { + + _wait1sec = new WaitForSeconds(1); + _wait5sec = new WaitForSeconds(5); + _wait60sec = new WaitForSeconds(60); + // throttle if entered update intervall is unreasonably low + _waitUpdateTime = _updateTimeInMilliSeconds < 500 ? new WaitForSeconds(500) : new WaitForSeconds(_updateTimeInMilliSeconds / 1000); + + _currentLocation.IsLocationServiceEnabled = false; + _currentLocation.IsLocationServiceInitializing = true; + + if (Application.platform == RuntimePlatform.Android) + { + getActivityContext(); + getGpsInstance(true); + getSensorInstance(); + + if (_pollLocation == null) + { + _pollLocation = StartCoroutine(locationRoutine()); + } + } + } + + + private void getActivityContext() + { + using (AndroidJavaClass activityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) + { + _activityContext = activityClass.GetStatic("currentActivity"); + } + + if (null == _activityContext) + { + Debug.LogError("Could not get UnityPlayer activity"); + return; + } + } + + + private void getGpsInstance(bool showToastMessages = false) + { + if (null == _activityContext) { return; } + + using (AndroidJavaClass androidGps = new AndroidJavaClass("com.mapbox.android.unity.AndroidGps")) + { + if (null == androidGps) + { + Debug.LogError("Could not get class 'AndroidGps'"); + return; + } + + _gpsInstance = androidGps.CallStatic("instance", _activityContext); + if (null == _gpsInstance) + { + Debug.LogError("Could not get 'AndroidGps' instance"); + return; + } + + _activityContext.Call("runOnUiThread", new AndroidJavaRunnable(() => { _gpsInstance.Call("showMessage", "starting location listeners"); })); + + _gpsInstance.Call("startLocationListeners", _updateDistanceInMeters, _updateTimeInMilliSeconds); + } + } + + + private void getSensorInstance() + { + if (null == _activityContext) { return; } + + using (AndroidJavaClass androidSensors = new AndroidJavaClass("com.mapbox.android.unity.AndroidSensors")) + { + if (null == androidSensors) + { + Debug.LogError("Could not get class 'AndroidSensors'"); + return; + } + + _sensorInstance = androidSensors.CallStatic("instance", _activityContext); + if (null == _sensorInstance) + { + Debug.LogError("Could not get 'AndroidSensors' instance"); + return; + } + + //_activityContext.Call("runOnUiThread", new AndroidJavaRunnable(() => { _sensorInstance.Call("showMessage", "starting sensor listeners"); })); + + _sensorInstance.Call("startSensorListeners"); + } + } + + + //private void Update() { + private IEnumerator locationRoutine() + { + + while (true) + { + // couldn't get player activity, wait and retry + if (null == _activityContext) + { + SendLocation(_currentLocation); + yield return _wait60sec; + getActivityContext(); + continue; + } + // couldn't get gps plugin instance, wait and retry + if (null == _gpsInstance) + { + SendLocation(_currentLocation); + yield return _wait60sec; + getGpsInstance(); + continue; + } + + // update device orientation + if (null != _sensorInstance) + { + _currentLocation.DeviceOrientation = _sensorInstance.Call("getOrientation"); + } + + bool locationServiceAvailable = _gpsInstance.Call("getIsLocationServiceAvailable"); + _currentLocation.IsLocationServiceEnabled = locationServiceAvailable; + + // app might have been started with location OFF but switched on after start + // check from time to time + if (!locationServiceAvailable) + { + _currentLocation.IsLocationServiceInitializing = true; + _currentLocation.Accuracy = 0; + _currentLocation.HasGpsFix = false; + _currentLocation.SatellitesInView = 0; + _currentLocation.SatellitesUsed = 0; + + SendLocation(_currentLocation); + _gpsInstance.Call("stopLocationListeners"); + yield return _wait5sec; + _gpsInstance.Call("startLocationListeners", _updateDistanceInMeters, _updateTimeInMilliSeconds); + yield return _wait1sec; + continue; + } + + + // if we got till here it means location services are running + _currentLocation.IsLocationServiceInitializing = false; + + try + { + AndroidJavaObject locNetwork = _gpsInstance.Get("lastKnownLocationNetwork"); + AndroidJavaObject locGps = _gpsInstance.Get("lastKnownLocationGps"); + + // easy cases: neither or either gps location or network location available + if (null == locGps & null == locNetwork) { populateCurrentLocation(null); } + if (null != locGps && null == locNetwork) { populateCurrentLocation(locGps); } + if (null == locGps && null != locNetwork) { populateCurrentLocation(locNetwork); } + + // gps- and network location available: figure out which one to use + if (null != locGps && null != locNetwork) { populateWithBetterLocation(locGps, locNetwork); } + + + SendLocation(_currentLocation); + } + catch (Exception ex) + { + Debug.LogErrorFormat("GPS plugin error: " + ex.ToString()); + } + yield return _waitUpdateTime; + } + } + + + private void populateCurrentLocation(AndroidJavaObject location) + { + if (null == location) + { + _currentLocation.IsLocationUpdated = false; + _currentLocation.IsUserHeadingUpdated = false; + return; + } + + double lat = location.Call("getLatitude"); + double lng = location.Call("getLongitude"); + Utils.Vector2d newLatLng = new Utils.Vector2d(lat, lng); + bool coordinatesUpdated = !newLatLng.Equals(_currentLocation.LatitudeLongitude); + _currentLocation.LatitudeLongitude = newLatLng; + + float newAccuracy = location.Call("getAccuracy"); + bool accuracyUpdated = newAccuracy != _currentLocation.Accuracy; + _currentLocation.Accuracy = newAccuracy; + + // divide by 1000. Android returns milliseconds, we work with seconds + long newTimestamp = location.Call("getTime") / 1000; + bool timestampUpdated = newTimestamp != _currentLocation.Timestamp; + _currentLocation.Timestamp = newTimestamp; + + string newProvider = location.Call("getProvider"); + bool providerUpdated = newProvider != _currentLocation.Provider; + _currentLocation.Provider = newProvider; + + bool hasBearing = location.Call("hasBearing"); + // only evalute bearing when location object actually has a bearing + // Android populates bearing (which is not equal to device orientation) + // only when the device is moving. + // Otherwise it is set to '0.0' + // https://developer.android.com/reference/android/location/Location.html#getBearing() + // We don't want that when we rotate a map according to the direction + // thes user is moving, thus don't update 'heading' with '0.0' + if (!hasBearing) + { + _currentLocation.IsUserHeadingUpdated = false; + } + else + { + float newHeading = location.Call("getBearing"); + _currentLocation.IsUserHeadingUpdated = newHeading != _currentLocation.UserHeading; + _currentLocation.UserHeading = newHeading; + } + + float? newSpeed = location.Call("getSpeed"); + bool speedUpdated = newSpeed != _currentLocation.SpeedMetersPerSecond; + _currentLocation.SpeedMetersPerSecond = newSpeed; + + // flag location as updated if any of below conditions evaluates to true + // Debug.LogFormat("coords:{0} acc:{1} time:{2} speed:{3}", coordinatesUpdated, accuracyUpdated, timestampUpdated, speedUpdated); + _currentLocation.IsLocationUpdated = + providerUpdated + || coordinatesUpdated + || accuracyUpdated + || timestampUpdated + || speedUpdated; + + // Un-comment if required. Throws a warning right now. + //bool networkEnabled = _gpsInstance.Call("getIsNetworkEnabled"); + bool gpsEnabled = _gpsInstance.Call("getIsGpsEnabled"); + if (!gpsEnabled) + { + _currentLocation.HasGpsFix = null; + _currentLocation.SatellitesInView = null; + _currentLocation.SatellitesUsed = null; + } + else + { + _currentLocation.HasGpsFix = _gpsInstance.Get("hasGpsFix"); + //int time2firstFix = _gpsInstance.Get("timeToFirstGpsFix"); + _currentLocation.SatellitesInView = _gpsInstance.Get("satellitesInView"); + _currentLocation.SatellitesUsed = _gpsInstance.Get("satellitesUsedInFix"); + } + + } + + + /// + /// If GPS and network location are available use the newer/better one + /// + /// + /// + private void populateWithBetterLocation(AndroidJavaObject locGps, AndroidJavaObject locNetwork) + { + + // check which location is fresher + long timestampGps = locGps.Call("getTime"); + long timestampNet = locNetwork.Call("getTime"); + if (timestampGps > timestampNet) + { + populateCurrentLocation(locGps); + return; + } + + // check which location has better accuracy + float accuracyGps = locGps.Call("getAccuracy"); + float accuracyNet = locNetwork.Call("getAccuracy"); + if (accuracyGps < accuracyNet) + { + populateCurrentLocation(locGps); + return; + } + + // default to network + populateCurrentLocation(locNetwork); + } + + + + protected virtual void Update() + { + + /* + if (Input.GetKeyDown(KeyCode.Escape)) + { + Debug.LogWarning("EXIT"); +#if UNITY_EDITOR + UnityEditor.EditorApplication.isPlaying = false; +#else + if (Application.platform == RuntimePlatform.Android) { + AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity"); + //activity.Call("moveTaskToBack", true); + activity.Call("finishAndRemoveTask"); + //activity.Call("finish"); + } else { + Application.Quit(); + } +#endif + } + */ + } + +#if UNITY_ANDROID + + private string time2str(AndroidJavaObject loc) + { + long time = loc.Call("getTime"); + DateTime dtPlugin = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Add(TimeSpan.FromMilliseconds(time)); + return dtPlugin.ToString("yyyyMMdd HHmmss"); + } + + + + private string loc2str(AndroidJavaObject loc) + { + + if (null == loc) { return "loc: NULL"; } + + try + { + + double lat = loc.Call("getLatitude"); + double lng = loc.Call("getLongitude"); + + return string.Format(CultureInfo.InvariantCulture, "{0:0.00000000} / {1:0.00000000}", lat, lng); + } + catch (Exception ex) + { + return ex.ToString(); + } + } + +#endif + + + + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/Location/DeviceLocationProviderAndroidNative.cs.meta b/sdkproject/Assets/Mapbox/Unity/Location/DeviceLocationProviderAndroidNative.cs.meta new file mode 100644 index 000000000..78635c575 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/DeviceLocationProviderAndroidNative.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: d3d557417079b1446999d2d86ff71dfb +timeCreated: 1524214127 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Location/EditorLocationProvider.cs b/sdkproject/Assets/Mapbox/Unity/Location/EditorLocationProvider.cs index 747acc0d4..d02ddb7c4 100644 --- a/sdkproject/Assets/Mapbox/Unity/Location/EditorLocationProvider.cs +++ b/sdkproject/Assets/Mapbox/Unity/Location/EditorLocationProvider.cs @@ -34,7 +34,7 @@ public class EditorLocationProvider : AbstractEditorLocationProvider bool _mapInitialized; #if UNITY_EDITOR - protected void Start() + protected virtual void Start() { LocationProviderFactory.Instance.mapManager.OnInitialized += Map_OnInitialized; //_map.OnInitialized += Map_OnInitialized; @@ -78,12 +78,12 @@ Vector2d LatitudeLongitude protected override void SetLocation() { - _currentLocation.Heading = _targetTransform.eulerAngles.y; + _currentLocation.UserHeading = _targetTransform.eulerAngles.y; _currentLocation.LatitudeLongitude = LatitudeLongitude; _currentLocation.Accuracy = _accuracy; _currentLocation.Timestamp = UnixTimestampUtils.To(DateTime.UtcNow); _currentLocation.IsLocationUpdated = true; - _currentLocation.IsHeadingUpdated = true; + _currentLocation.IsUserHeadingUpdated = true; _currentLocation.IsLocationServiceEnabled = true; } } diff --git a/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces.meta b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces.meta new file mode 100644 index 000000000..c56dcfb05 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 8232a48e0bb26b34caa7b4733871a9c3 +folderAsset: yes +timeCreated: 1524651375 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/driving_in_circles.txt b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/driving_in_circles.txt new file mode 100644 index 000000000..3f85eda86 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/driving_in_circles.txt @@ -0,0 +1,75 @@ +# +# Header Description: +# +# Version: v2.0.0.1 Platform: 8.1.0 Manufacturer: Google Model: Pixel 2 +# +# Raw,ElapsedRealtimeMillis,TimeNanos,LeapSecond,TimeUncertaintyNanos,FullBiasNanos,BiasNanos,BiasUncertaintyNanos,DriftNanosPerSecond,DriftUncertaintyNanosPerSecond,HardwareClockDiscontinuityCount,Svid,TimeOffsetNanos,State,ReceivedSvTimeNanos,ReceivedSvTimeUncertaintyNanos,Cn0DbHz,PseudorangeRateMetersPerSecond,PseudorangeRateUncertaintyMetersPerSecond,AccumulatedDeltaRangeState,AccumulatedDeltaRangeMeters,AccumulatedDeltaRangeUncertaintyMeters,CarrierFrequencyHz,CarrierCycles,CarrierPhase,CarrierPhaseUncertainty,MultipathIndicator,SnrInDb,ConstellationType,AgcDb,CarrierFrequencyHz +# +# Fix,Provider,Latitude,Longitude,Altitude,Speed,Accuracy,Bearing,Orientation,(UTC)TimeInMs +# +# Nav,Svid,Type,Status,MessageId,Sub-messageId,Data(Bytes) +# +Fix,gps,48.392460,15.580114,244.883911,9.390000,6.432000,301.899994,334.030670,1524811861000 +Fix,gps,48.392497,15.580005,244.502075,9.420000,6.432000,302.200012,356.722412,1524811862000 +Fix,gps,48.392535,15.579900,244.335815,9.110000,6.432000,302.100006,337.497375,1524811863000 +Fix,gps,48.392591,15.579806,245.396973,8.770000,6.432000,304.700012,328.809753,1524811864000 +Fix,gps,48.392640,15.579716,246.453857,8.240000,6.432000,306.899994,337.404144,1524811865000 +Fix,gps,48.392684,15.579633,247.263794,7.830000,6.432000,310.500000,343.111816,1524811866000 +Fix,gps,48.392726,15.579557,247.475830,6.980000,6.432000,311.700012,343.911804,1524811867000 +Fix,gps,48.392765,15.579495,247.146606,6.360000,6.432000,312.200012,301.802979,1524811868000 +Fix,gps,48.392801,15.579444,247.211426,5.640000,6.432000,320.700012,292.912048,1524811869000 +Fix,gps,48.392873,15.579432,248.650513,5.360000,5.360000,353.100006,312.574524,1524811870000 +Fix,gps,48.392936,15.579439,249.810303,5.370000,5.360000,4.000000,11.799591,1524811871000 +Fix,gps,48.393015,15.579457,251.073669,5.360000,5.360000,4.500000,9.302094,1524811872000 +Fix,gps,48.393060,15.579467,250.311707,5.240000,5.360000,5.600000,353.394348,1524811873000 +Fix,gps,48.393110,15.579506,248.511841,4.570000,5.360000,22.500000,20.054871,1524811874000 +Fix,gps,48.393134,15.579535,250.789001,2.630000,5.360000,52.700001,21.669250,1524811875000 +Fix,gps,48.393144,15.579542,251.441162,2.190000,5.360000,53.099998,38.185944,1524811876000 +Fix,gps,48.393155,15.579566,250.443970,2.320000,6.432000,60.500000,25.426697,1524811877000 +Fix,gps,48.393171,15.579592,249.187744,2.860000,5.360000,59.000000,2.520996,1524811878000 +Fix,gps,48.393190,15.579632,249.578064,3.300000,6.432000,62.400002,22.211792,1524811879000 +Fix,gps,48.393196,15.579679,249.463745,3.620000,7.504000,68.300003,23.735138,1524811880000 +Fix,gps,48.393178,15.579792,249.380310,6.160000,6.432000,87.400002,39.551819,1524811881000 +Fix,gps,48.393176,15.579887,249.851685,6.630000,6.432000,87.099998,45.347504,1524811882000 +Fix,gps,48.393177,15.579986,249.472839,7.310000,6.432000,90.099998,60.602692,1524811883000 +Fix,gps,48.393178,15.580067,251.104004,7.230000,6.432000,90.500000,55.074615,1524811884000 +Fix,gps,48.393179,15.580178,252.305542,7.710000,6.432000,89.800003,62.261932,1524811885000 +Fix,gps,48.393174,15.580299,252.311340,8.020000,6.432000,88.300003,56.904602,1524811886000 +Fix,gps,48.393178,15.580401,252.797974,8.130000,5.360000,89.400002,57.664520,1524811887000 +Fix,gps,48.393169,15.580510,253.922913,7.880000,6.432000,91.800003,59.466614,1524811888000 +Fix,gps,48.393158,15.580611,254.727783,7.380000,6.432000,98.699997,57.058105,1524811889000 +Fix,gps,48.393146,15.580707,254.793213,7.460000,8.576000,99.800003,58.042450,1524811890000 +Fix,gps,48.393142,15.580794,255.472534,7.230000,9.648001,100.099998,60.344513,1524811891000 +Fix,gps,48.393133,15.580865,254.628052,5.960000,10.720000,103.300003,43.094696,1524811892000 +Fix,gps,48.393152,15.580894,253.319580,3.660000,7.504000,94.300003,20.634552,1524811893000 +Fix,gps,48.393108,15.580980,253.978394,3.040000,6.432000,101.199997,35.580109,1524811894000 +Fix,gps,48.393123,15.580985,252.116333,2.510000,5.360000,111.300003,39.748627,1524811895000 +Fix,gps,48.393084,15.580971,249.278687,3.860000,4.288000,170.800003,77.634735,1524811896000 +Fix,gps,48.393032,15.580975,248.985718,4.890000,4.288000,182.399994,111.085358,1524811897000 +Fix,gps,48.392973,15.580979,248.940613,5.860000,4.288000,179.399994,91.379883,1524811898000 +Fix,gps,48.392909,15.580980,248.620728,6.580000,4.288000,181.199997,96.948364,1524811899000 +Fix,gps,48.392846,15.580961,248.185242,6.960000,4.288000,180.699997,101.203766,1524811900000 +Fix,gps,48.392775,15.580957,247.287048,7.540000,3.216000,179.500000,113.452393,1524811901000 +Fix,gps,48.392708,15.580955,249.459717,7.170000,4.288000,180.899994,112.928162,1524811902000 +Fix,gps,48.392629,15.580986,244.933838,6.950000,4.288000,176.899994,128.389648,1524811903000 +Fix,gps,48.392572,15.580986,245.168640,6.390000,4.288000,166.600006,114.726624,1524811904000 +Fix,gps,48.392516,15.581026,245.518494,5.840000,4.288000,163.000000,95.297943,1524811905000 +Fix,gps,48.392461,15.581032,246.189392,5.700000,4.288000,179.300003,117.780823,1524811906000 +Fix,gps,48.392420,15.581017,247.584778,5.050000,4.288000,195.699997,124.594269,1524811907000 +Fix,gps,48.392383,15.580989,247.182800,4.650000,4.288000,198.600006,138.293549,1524811908000 +Fix,gps,48.392345,15.580972,246.859680,4.370000,5.360000,197.600006,144.620636,1524811909000 +Fix,gps,48.392313,15.580951,247.098267,3.730000,5.360000,196.899994,134.438171,1524811910000 +Fix,gps,48.392290,15.580937,247.084595,2.540000,5.360000,197.300003,135.109497,1524811911000 +Fix,gps,48.392276,15.580941,248.742065,1.850000,5.360000,193.899994,126.031342,1524811912000 +Fix,gps,48.392265,15.580947,250.434326,2.050000,5.360000,196.199997,121.141296,1524811913000 +Fix,gps,48.392249,15.580924,248.297485,2.930000,5.360000,227.399994,180.330917,1524811914000 +Fix,gps,48.392235,15.580886,247.739380,3.560000,5.360000,246.699997,223.269897,1524811915000 +Fix,gps,48.392232,15.580815,247.006714,4.210000,5.360000,272.000000,260.906097,1524811916000 +Fix,gps,48.392244,15.580764,247.198364,5.010000,4.288000,296.500000,333.928589,1524811917000 +Fix,gps,48.392265,15.580697,246.952759,5.790000,4.288000,298.500000,320.642914,1524811918000 +Fix,gps,48.392300,15.580619,244.495605,6.740000,4.288000,298.899994,313.861298,1524811919000 +Fix,gps,48.392337,15.580541,245.298340,7.400000,5.360000,299.899994,332.772858,1524811920000 +Fix,gps,48.392357,15.580446,247.091309,7.790000,5.360000,300.500000,331.011536,1524811921000 +Fix,gps,48.392394,15.580357,248.781311,8.180000,5.360000,300.200012,322.085754,1524811922000 +Fix,gps,48.392436,15.580266,250.037842,8.310000,6.432000,301.200012,326.440704,1524811923000 +Fix,gps,48.392466,15.580163,250.725220,8.180000,6.432000,300.700012,322.919556,1524811924000 diff --git a/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/driving_in_circles.txt.meta b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/driving_in_circles.txt.meta new file mode 100644 index 000000000..300041673 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/driving_in_circles.txt.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b9abe7d031734c34e83d93fc4b21fa58 +timeCreated: 1524823523 +licenseType: Pro +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_1.txt b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_1.txt new file mode 100644 index 000000000..3a5ba5ac9 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_1.txt @@ -0,0 +1,67 @@ +# +# Header Description: +# +# Version: v2.0.0.1 Platform: 8.1.0 Manufacturer: Google Model: Pixel 2 +# +# Raw,ElapsedRealtimeMillis,TimeNanos,LeapSecond,TimeUncertaintyNanos,FullBiasNanos,BiasNanos,BiasUncertaintyNanos,DriftNanosPerSecond,DriftUncertaintyNanosPerSecond,HardwareClockDiscontinuityCount,Svid,TimeOffsetNanos,State,ReceivedSvTimeNanos,ReceivedSvTimeUncertaintyNanos,Cn0DbHz,PseudorangeRateMetersPerSecond,PseudorangeRateUncertaintyMetersPerSecond,AccumulatedDeltaRangeState,AccumulatedDeltaRangeMeters,AccumulatedDeltaRangeUncertaintyMeters,CarrierFrequencyHz,CarrierCycles,CarrierPhase,CarrierPhaseUncertainty,MultipathIndicator,SnrInDb,ConstellationType,AgcDb,CarrierFrequencyHz +# +# Fix,Provider,Latitude,Longitude,Altitude,Speed,Accuracy,Bearing,Orientation,(UTC)TimeInMs +# +# Nav,Svid,Type,Status,MessageId,Sub-messageId,Data(Bytes) +# +Fix,gps,48.401137,15.580709,245.929199,0.000000,4.288000,0.000000,36.201172,1524812233000 +Fix,gps,48.401139,15.580707,245.270020,0.000000,4.288000,0.000000,35.610931,1524812234000 +Fix,gps,48.401145,15.580716,243.787476,0.940000,4.288000,68.699997,46.157867,1524812235000 +Fix,gps,48.401150,15.580729,244.414124,0.910000,4.288000,69.000000,39.437592,1524812236000 +Fix,gps,48.401154,15.580745,245.492493,1.100000,4.288000,68.800003,39.046448,1524812237000 +Fix,gps,48.401156,15.580759,244.975525,0.720000,4.288000,68.900002,113.287476,1524812238000 +Fix,gps,48.401160,15.580770,245.419189,0.700000,4.288000,68.800003,148.380981,1524812239000 +Fix,gps,48.401167,15.580781,245.705994,0.920000,3.216000,68.800003,92.319824,1524812240000 +Fix,gps,48.401180,15.580790,249.440308,1.130000,4.288000,56.200001,117.828125,1524812241000 +Fix,gps,48.401190,15.580799,247.578369,0.650000,4.288000,56.099998,134.270660,1524812242000 +Fix,gps,48.401199,15.580807,246.863037,0.970000,4.288000,56.200001,105.560791,1524812243000 +Fix,gps,48.401210,15.580818,246.981628,1.240000,4.288000,56.200001,106.089172,1524812244000 +Fix,gps,48.401220,15.580831,247.495850,1.190000,4.288000,58.000000,71.565247,1524812245000 +Fix,gps,48.401225,15.580844,247.263489,0.610000,4.288000,58.700001,54.364960,1524812246000 +Fix,gps,48.401224,15.580860,246.933716,0.940000,4.288000,58.700001,64.185486,1524812247000 +Fix,gps,48.401224,15.580874,247.686707,0.800000,4.288000,58.700001,43.939209,1524812248000 +Fix,gps,48.401223,15.580887,247.793152,0.840000,4.288000,58.799999,14.145813,1524812249000 +Fix,gps,48.401227,15.580909,249.692810,1.450000,4.288000,72.500000,3.823486,1524812250000 +Fix,gps,48.401231,15.580930,249.153015,1.060000,4.288000,72.099998,51.032776,1524812251000 +Fix,gps,48.401235,15.580949,249.517578,1.330000,4.288000,73.099998,26.742035,1524812252000 +Fix,gps,48.401241,15.580969,248.711670,1.170000,4.288000,72.500000,5.418152,1524812253000 +Fix,gps,48.401245,15.580989,248.390015,1.070000,3.216000,72.199997,66.550507,1524812254000 +Fix,gps,48.401250,15.581006,247.221924,0.990000,3.216000,71.800003,66.619202,1524812255000 +Fix,gps,48.401258,15.581026,248.757263,1.480000,3.216000,65.800003,39.423584,1524812256000 +Fix,gps,48.401262,15.581041,247.216248,0.530000,4.288000,71.800003,19.969055,1524812257000 +Fix,gps,48.401263,15.581056,247.573120,1.010000,4.288000,72.099998,72.931488,1524812258000 +Fix,gps,48.401264,15.581074,245.630737,1.190000,4.288000,82.900002,115.124847,1524812259000 +Fix,gps,48.401267,15.581092,246.393066,1.150000,4.288000,71.599998,141.298950,1524812260000 +Fix,gps,48.401272,15.581111,246.450378,1.330000,4.288000,67.099998,124.325073,1524812261000 +Fix,gps,48.401281,15.581129,245.926758,1.460000,4.288000,51.900002,98.007538,1524812262000 +Fix,gps,48.401296,15.581148,246.954712,1.460000,4.288000,51.400002,111.513733,1524812263000 +Fix,gps,48.401305,15.581163,244.545898,0.970000,4.288000,66.199997,51.654816,1524812264000 +Fix,gps,48.401315,15.581180,245.624451,1.540000,4.288000,66.099998,63.866333,1524812265000 +Fix,gps,48.401326,15.581200,243.205444,1.300000,4.288000,65.900002,356.770752,1524812266000 +Fix,gps,48.401336,15.581217,243.070190,1.330000,3.216000,61.900002,14.589813,1524812267000 +Fix,gps,48.401346,15.581233,243.229004,1.580000,3.216000,61.900002,254.350632,1524812268000 +Fix,gps,48.401355,15.581248,243.035278,1.050000,3.216000,61.799999,255.439468,1524812269000 +Fix,gps,48.401364,15.581263,241.838318,1.230000,3.216000,62.599998,346.248627,1524812270000 +Fix,gps,48.401371,15.581281,242.006836,1.230000,3.216000,64.900002,214.524628,1524812271000 +Fix,gps,48.401374,15.581299,243.845337,0.980000,3.216000,64.699997,35.856598,1524812272000 +Fix,gps,48.401376,15.581316,244.388550,1.060000,3.216000,64.800003,289.739197,1524812273000 +Fix,gps,48.401381,15.581337,244.104736,1.510000,3.216000,66.699997,70.997620,1524812274000 +Fix,gps,48.401388,15.581358,244.617065,1.340000,3.216000,59.000000,92.856598,1524812275000 +Fix,gps,48.401396,15.581379,244.530151,1.350000,3.216000,59.000000,102.894409,1524812276000 +Fix,gps,48.401403,15.581398,244.302612,1.280000,3.216000,59.000000,143.935608,1524812277000 +Fix,gps,48.401409,15.581416,242.362427,1.500000,3.216000,60.599998,56.021271,1524812278000 +Fix,gps,48.401417,15.581434,242.836548,1.510000,3.216000,59.200001,115.338959,1524812279000 +Fix,gps,48.401426,15.581451,243.172363,1.290000,3.216000,62.900002,107.219208,1524812280000 +Fix,gps,48.401433,15.581465,243.601624,1.150000,3.216000,63.099998,154.416992,1524812281000 +Fix,gps,48.401440,15.581480,243.132446,1.320000,3.216000,60.500000,70.152557,1524812282000 +Fix,gps,48.401446,15.581496,243.096252,1.360000,3.216000,60.799999,91.036591,1524812283000 +Fix,gps,48.401450,15.581510,241.862244,0.850000,3.216000,60.700001,42.567261,1524812284000 +Fix,gps,48.401454,15.581524,240.710327,1.310000,3.216000,70.000000,61.725555,1524812285000 +Fix,gps,48.401458,15.581539,241.147034,0.910000,3.216000,70.199997,97.414124,1524812286000 +Fix,gps,48.401461,15.581553,240.948975,1.070000,3.216000,70.199997,48.457611,1524812287000 +Fix,gps,48.401463,15.581569,240.471313,1.100000,3.216000,70.199997,58.961212,1524812288000 diff --git a/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_1.txt.meta b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_1.txt.meta new file mode 100644 index 000000000..410054ee0 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_1.txt.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2f4711c36ccfd3f43bc3cfbbe2a68b6c +timeCreated: 1524823522 +licenseType: Pro +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_2.txt b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_2.txt new file mode 100644 index 000000000..d67e44248 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_2.txt @@ -0,0 +1,52 @@ +# +# Header Description: +# +# Version: v2.0.0.1 Platform: 8.1.0 Manufacturer: Google Model: Pixel 2 +# +# Raw,ElapsedRealtimeMillis,TimeNanos,LeapSecond,TimeUncertaintyNanos,FullBiasNanos,BiasNanos,BiasUncertaintyNanos,DriftNanosPerSecond,DriftUncertaintyNanosPerSecond,HardwareClockDiscontinuityCount,Svid,TimeOffsetNanos,State,ReceivedSvTimeNanos,ReceivedSvTimeUncertaintyNanos,Cn0DbHz,PseudorangeRateMetersPerSecond,PseudorangeRateUncertaintyMetersPerSecond,AccumulatedDeltaRangeState,AccumulatedDeltaRangeMeters,AccumulatedDeltaRangeUncertaintyMeters,CarrierFrequencyHz,CarrierCycles,CarrierPhase,CarrierPhaseUncertainty,MultipathIndicator,SnrInDb,ConstellationType,AgcDb,CarrierFrequencyHz +# +# Fix,Provider,Latitude,Longitude,Altitude,Speed,Accuracy,Bearing,Orientation,(UTC)TimeInMs +# +# Nav,Svid,Type,Status,MessageId,Sub-messageId,Data(Bytes) +# +Fix,gps,48.401470,15.581564,239.372437,1.250000,4.288000,243.699997,296.390839,1524812301000 +Fix,gps,48.401465,15.581543,240.132813,1.380000,4.288000,244.000000,209.778687,1524812302000 +Fix,gps,48.401462,15.581527,239.432861,1.310000,4.288000,243.899994,217.233627,1524812303000 +Fix,gps,48.401457,15.581511,238.657837,1.510000,4.288000,237.000000,205.576096,1524812304000 +Fix,gps,48.401451,15.581494,237.291260,1.200000,4.288000,237.899994,226.405075,1524812305000 +Fix,gps,48.401448,15.581479,237.910278,1.310000,3.216000,252.100006,185.663177,1524812306000 +Fix,gps,48.401445,15.581462,239.442322,1.460000,3.216000,251.600006,228.428009,1524812307000 +Fix,gps,48.401439,15.581445,239.804016,1.450000,3.216000,248.600006,288.253235,1524812308000 +Fix,gps,48.401434,15.581429,240.121399,1.360000,3.216000,248.300003,167.671753,1524812309000 +Fix,gps,48.401430,15.581414,240.766479,1.470000,3.216000,241.199997,244.694870,1524812310000 +Fix,gps,48.401425,15.581399,240.985352,1.390000,3.216000,241.500000,231.099686,1524812311000 +Fix,gps,48.401422,15.581382,241.680420,1.370000,3.216000,245.699997,213.599182,1524812312000 +Fix,gps,48.401416,15.581365,241.713623,1.330000,3.216000,245.699997,205.036087,1524812313000 +Fix,gps,48.401409,15.581348,242.522400,1.460000,3.216000,231.100006,221.961700,1524812314000 +Fix,gps,48.401404,15.581333,242.039795,0.960000,3.216000,231.899994,115.955505,1524812315000 +Fix,gps,48.401401,15.581320,244.083618,0.800000,3.216000,231.899994,353.523254,1524812316000 +Fix,gps,48.401399,15.581307,243.582642,0.910000,3.216000,231.800003,44.814453,1524812317000 +Fix,gps,48.401396,15.581291,243.239258,1.390000,3.216000,231.899994,186.703064,1524812318000 +Fix,gps,48.401391,15.581274,242.858276,1.250000,4.288000,231.899994,175.234802,1524812319000 +Fix,gps,48.401384,15.581258,243.053101,1.400000,4.288000,235.600006,46.602692,1524812320000 +Fix,gps,48.401375,15.581242,242.284119,1.430000,4.288000,234.300003,181.293716,1524812321000 +Fix,gps,48.401367,15.581230,242.040710,1.150000,4.288000,251.699997,180.824478,1524812322000 +Fix,gps,48.401359,15.581217,241.915222,1.240000,4.288000,251.000000,184.571945,1524812323000 +Fix,gps,48.401351,15.581201,241.671082,1.530000,3.216000,250.800003,224.857269,1524812324000 +Fix,gps,48.401343,15.581189,241.956238,0.940000,3.216000,250.399994,212.995300,1524812325000 +Fix,gps,48.401338,15.581180,240.524841,0.650000,4.288000,250.600006,241.228729,1524812326000 +Fix,gps,48.401332,15.581167,241.209290,1.310000,3.216000,243.600006,255.005325,1524812327000 +Fix,gps,48.401323,15.581147,240.034241,1.740000,3.216000,237.399994,224.298218,1524812328000 +Fix,gps,48.401318,15.581132,239.855530,0.630000,4.288000,237.399994,162.067444,1524812329000 +Fix,gps,48.401315,15.581123,239.742004,0.760000,3.216000,238.000000,128.484619,1524812330000 +Fix,gps,48.401312,15.581112,237.688782,1.010000,3.216000,237.800003,122.311005,1524812331000 +Fix,gps,48.401308,15.581093,237.908875,1.490000,3.216000,247.899994,82.809784,1524812332000 +Fix,gps,48.401304,15.581075,238.167175,1.260000,4.288000,247.899994,297.621918,1524812333000 +Fix,gps,48.401300,15.581062,238.709473,0.920000,4.288000,247.899994,263.619781,1524812334000 +Fix,gps,48.401295,15.581051,238.228394,0.740000,4.288000,247.800003,309.353851,1524812335000 +Fix,gps,48.401289,15.581045,238.358093,0.700000,4.288000,247.800003,91.646362,1524812336000 +Fix,gps,48.401281,15.581042,239.408081,0.630000,4.288000,247.699997,259.156616,1524812337000 +Fix,gps,48.401272,15.581041,239.833130,0.730000,4.288000,247.600006,136.276184,1524812338000 +Fix,gps,48.401260,15.581033,240.729187,1.410000,4.288000,214.500000,10.447052,1524812339000 +Fix,gps,48.401251,15.581016,240.395752,1.240000,4.288000,231.699997,252.099960,1524812340000 +Fix,gps,48.401243,15.580996,240.424194,1.460000,4.288000,229.600006,230.531143,1524812341000 diff --git a/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_2.txt.meta b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_2.txt.meta new file mode 100644 index 000000000..b630ffbe9 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/ExampleGpsTraces/walking_device_looking_in_different_direction_2.txt.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7a07747909ea237468470c6398307001 +timeCreated: 1524823522 +licenseType: Pro +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Location/Location.cs b/sdkproject/Assets/Mapbox/Unity/Location/Location.cs index 09d82694e..5e3c64072 100644 --- a/sdkproject/Assets/Mapbox/Unity/Location/Location.cs +++ b/sdkproject/Assets/Mapbox/Unity/Location/Location.cs @@ -1,7 +1,7 @@ namespace Mapbox.Unity.Location { using Mapbox.Utils; - + /// /// Location contains heading, latitude, longitude, accuracy and a timestamp. /// @@ -15,19 +15,20 @@ public struct Location public Vector2d LatitudeLongitude; /// - /// Heading represents a facing angle, generally between 0-359. Also need location services enabled via Input.location.Start() - /// - public float Heading; - - /// - /// The heading in degrees relative to the magnetic North Pole. + /// Heading represents a angle of direction during movement, generally between 0-359. + ///Initially 0 this property gets populated after the device has moved far enough to determine a direction + ///If the device stops moving last heading is kept till a new one can be caluculated. Check + ///Also needs location services enabled via Input.location.Start() + ///related /// - public float HeadingMagnetic; + public float UserHeading; /// - /// Accuracy of heading reading in degrees. + ///Orientation (where the device is looking). + ///Uses device compass + ///related /// - public float HeadingAccuracy; + public float DeviceOrientation; /// /// Timestamp (in seconds since 1970) when location was last updated. @@ -37,7 +38,7 @@ public struct Location /// /// Horizontal Accuracy of the location. /// - public int Accuracy; + public float Accuracy; /// /// Is the location service currently initializing? @@ -54,9 +55,45 @@ public struct Location /// public bool IsLocationUpdated; + /// + /// Has the location been aquired via a GPS fix. 'Null' if not supported by the active location provider or GPS not enabled. + /// + public bool? HasGpsFix; + + /// + /// How many satellites were in view when the location was acquired. 'Null' if not supported by the active location provider or GPS not enabled. + /// + public int? SatellitesInView; + + /// + /// How many satellites were used for the location. 'Null' if not supported by the active location provider or GPS not enabled. + /// + public int? SatellitesUsed; + + /// + /// Speed in [meters/second]. 'Null' if not supported by the active location provider. + /// + public float? SpeedMetersPerSecond; + + /// + /// Speed in [km/h]. 'Null' if not supported by the active location provider. + /// + public float? SpeedKmPerHour + { + get + { + if (!SpeedMetersPerSecond.HasValue) { return null; } + return SpeedMetersPerSecond * 3.6f; + } + } + /// + /// Name of the location provider. 'Null' if not supported by the active location provider. + /// + public string Provider; + /// /// Has the heading changed since last update? /// - public bool IsHeadingUpdated; + public bool IsUserHeadingUpdated; } } diff --git a/sdkproject/Assets/Mapbox/Unity/Location/LocationArrayEditorLocationProvider.cs b/sdkproject/Assets/Mapbox/Unity/Location/LocationArrayEditorLocationProvider.cs index 0e7fe4d93..623ee7461 100644 --- a/sdkproject/Assets/Mapbox/Unity/Location/LocationArrayEditorLocationProvider.cs +++ b/sdkproject/Assets/Mapbox/Unity/Location/LocationArrayEditorLocationProvider.cs @@ -34,19 +34,20 @@ Vector2d LatitudeLongitude get { idx++; - if (idx >= _latitudeLongitude.Length) { idx = _latitudeLongitude.Length - 1; } + // reset index to keep looping through the location array + if (idx >= _latitudeLongitude.Length) { idx = 0; } return Conversions.StringToLatLon(_latitudeLongitude[idx]); } } protected override void SetLocation() { - _currentLocation.Heading = _heading; + _currentLocation.UserHeading = _heading; _currentLocation.LatitudeLongitude = LatitudeLongitude; _currentLocation.Accuracy = _accuracy; _currentLocation.Timestamp = UnixTimestampUtils.To(DateTime.UtcNow); _currentLocation.IsLocationUpdated = true; - _currentLocation.IsHeadingUpdated = true; + _currentLocation.IsUserHeadingUpdated = true; } } -} \ No newline at end of file +} diff --git a/sdkproject/Assets/Mapbox/Unity/Location/LocationGpsLogEditorLocationProvider.cs b/sdkproject/Assets/Mapbox/Unity/Location/LocationGpsLogEditorLocationProvider.cs new file mode 100644 index 000000000..4f56cff01 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/LocationGpsLogEditorLocationProvider.cs @@ -0,0 +1,168 @@ +namespace Mapbox.Unity.Location +{ + using System; + using System.Globalization; + using System.IO; + using Mapbox.Unity.Utilities; + using Mapbox.Utils; + using UnityEngine; + + /// + /// + /// The EditorLocationProvider is responsible for providing mock location data via log file obtained + /// via a customized 'Google GnssLogger' for testing purposes in the Unity editor. + /// + /// GnssLogger was changed to include 'Bearing' and 'DeviceOrientation' in the log here: + /// + /// https://github.com/google/gps-measurement-tools/blob/2f6ba51e7ddfa3a34d0f75933f833af20417042a/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/FileLogger.java#L246-L256 + /// + /// + public class LocationGpsLogEditorLocationProvider : AbstractEditorLocationProvider + { + /// + /// The mock "latitude, longitude" location, respresented with a string. + /// You can search for a place using the embedded "Search" button in the inspector. + /// This value can be changed at runtime in the inspector. + /// + [SerializeField] + private TextAsset _gpsLogFile; + + + private TextReader _textReader; + private CultureInfo _invariantCulture = CultureInfo.InvariantCulture; + + +#if UNITY_EDITOR + protected override void Awake() + { + base.Awake(); + MemoryStream ms = new MemoryStream(_gpsLogFile.bytes); + _textReader = new StreamReader(ms); + } + +#endif + + private struct GpsFix + { + public string provider; + public Vector2d LatLng; + public double Timestamp; + public float Accuracy; + public float? Speed; + public float? UserHeading; + public float? DeviceOrientation; + public bool? HasGpxFix; + } + + private GpsFix NextLocationData + { + get + { + string line = string.Empty; + + while (1 == 1) + { + line = _textReader.ReadLine(); + // rewind if end of log (or last empty line) reached + if (null == line || string.IsNullOrEmpty(line)) + { + ((StreamReader)_textReader).BaseStream.Position = 0; + ((StreamReader)_textReader).DiscardBufferedData(); + continue; + } + + // skip comments + if (line.StartsWith("#")) { continue; } else { break; } + } + + string[] tokens = line.Split(",".ToCharArray()); + //log was neither created with stock GnssLogger nor with customized one + if (tokens.Length != 8 && tokens.Length != 10) + { + Debug.LogError("unsupported log file"); + return new GpsFix(); + } + + double lat; + double lng; + double timestamp; + float speed; + float accuracy; + float userHeading; + float deviceOrientation; + + GpsFix gpsFix = new GpsFix(); + + gpsFix.HasGpxFix = tokens[0].Equals("Fix") ? true : (bool?)null; + gpsFix.provider = tokens[1]; + + if ( + !double.TryParse(tokens[2], NumberStyles.Any, _invariantCulture, out lat) + || !double.TryParse(tokens[3], NumberStyles.Any, _invariantCulture, out lng) + ) + { + gpsFix.LatLng = Vector2d.zero; + } + else + { + gpsFix.LatLng = new Vector2d(lat, lng); + } + + gpsFix.Speed = float.TryParse(tokens[5], NumberStyles.Any, _invariantCulture, out speed) ? speed : (float?)null; + gpsFix.Accuracy = float.TryParse(tokens[6], NumberStyles.Any, _invariantCulture, out accuracy) ? accuracy : 0; + + // backwards compability with unmodified GnssLogger files that don't contain a 'Bearing' + // timestamp is always the last value + int idxTimestamp = tokens.Length - 1; + gpsFix.Timestamp = double.TryParse(tokens[idxTimestamp], NumberStyles.Any, _invariantCulture, out timestamp) ? timestamp / 1000 : 0; + + // bearing and orientation included + if (tokens.Length == 10) + { + gpsFix.UserHeading = float.TryParse(tokens[7], NumberStyles.Any, _invariantCulture, out userHeading) ? userHeading : (float?)null; + gpsFix.DeviceOrientation = float.TryParse(tokens[8], NumberStyles.Any, _invariantCulture, out deviceOrientation) ? deviceOrientation : (float?)null; + } + + return gpsFix; + } + } + + + protected override void SetLocation() + { + GpsFix gpsFix = NextLocationData; + + _currentLocation.IsLocationServiceEnabled = true; + + if (gpsFix.UserHeading.HasValue) + { + _currentLocation.UserHeading = gpsFix.UserHeading.Value; + } + else + { + // calculate heading ourselves + _currentLocation.UserHeading = (float)(Math.Atan2(gpsFix.LatLng.y - _currentLocation.LatitudeLongitude.y, gpsFix.LatLng.x - _currentLocation.LatitudeLongitude.x) * 180 / Math.PI); + } + + if (gpsFix.DeviceOrientation.HasValue) + { + _currentLocation.DeviceOrientation = gpsFix.DeviceOrientation.Value; + } + else + { + // simluate device rotating all the time + _currentLocation.DeviceOrientation += 15; + if (_currentLocation.DeviceOrientation > 359) { _currentLocation.DeviceOrientation = 0; } + } + + _currentLocation.Provider = gpsFix.provider; + _currentLocation.HasGpsFix = gpsFix.HasGpxFix; + _currentLocation.LatitudeLongitude = gpsFix.LatLng; + _currentLocation.Timestamp = gpsFix.Timestamp; + _currentLocation.Accuracy = gpsFix.Accuracy; + _currentLocation.SpeedMetersPerSecond = gpsFix.Speed; + _currentLocation.IsLocationUpdated = true; + _currentLocation.IsUserHeadingUpdated = true; + } + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/Location/LocationGpsLogEditorLocationProvider.cs.meta b/sdkproject/Assets/Mapbox/Unity/Location/LocationGpsLogEditorLocationProvider.cs.meta new file mode 100644 index 000000000..db578a894 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/LocationGpsLogEditorLocationProvider.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: b7aa6be6e90405940b281e996bcb2f20 +timeCreated: 1524639538 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Location/LocationProviderFactory.cs b/sdkproject/Assets/Mapbox/Unity/Location/LocationProviderFactory.cs index 1e918b2a8..2d2351dc3 100644 --- a/sdkproject/Assets/Mapbox/Unity/Location/LocationProviderFactory.cs +++ b/sdkproject/Assets/Mapbox/Unity/Location/LocationProviderFactory.cs @@ -4,9 +4,9 @@ namespace Mapbox.Unity.Location { - using System.Diagnostics; using UnityEngine; using Mapbox.Unity.Map; + using System.Text.RegularExpressions; /// /// Singleton factory to allow easy access to various LocationProviders. @@ -18,7 +18,12 @@ public class LocationProviderFactory : MonoBehaviour public AbstractMap mapManager; [SerializeField] - AbstractLocationProvider _deviceLocationProvider; + [Tooltip("Provider using Unity's builtin 'Input.Location' service")] + AbstractLocationProvider _deviceLocationProviderUnity; + + [SerializeField] + [Tooltip("Custom native Android location provider. If this is not set above provider is used")] + DeviceLocationProviderAndroidNative _deviceLocationProviderAndroid; [SerializeField] AbstractLocationProvider _editorLocationProvider; @@ -107,14 +112,14 @@ public ILocationProvider DeviceLocationProvider { get { - return _deviceLocationProvider; + return _deviceLocationProviderUnity; } } /// /// Create singleton instance and inject the DefaultLocationProvider upon initialization of this component. /// - private void Awake() + protected virtual void Awake() { if (Instance != null) { @@ -136,10 +141,10 @@ private void Awake() /// Injects the editor location provider. /// Depending on the platform, this method and calls to it will be stripped during compile. /// - [Conditional("UNITY_EDITOR")] + [System.Diagnostics.Conditional("UNITY_EDITOR")] void InjectEditorLocationProvider() { - UnityEngine.Debug.Log("LocationProviderFactory: " + "Injected EDITOR Location Provider"); + Debug.Log("LocationProviderFactory: " + "Injected EDITOR Location Provider"); DefaultLocationProvider = _editorLocationProvider; } @@ -147,11 +152,32 @@ void InjectEditorLocationProvider() /// Injects the device location provider. /// Depending on the platform, this method and calls to it will be stripped during compile. /// - [Conditional("NOT_UNITY_EDITOR")] + [System.Diagnostics.Conditional("NOT_UNITY_EDITOR")] void InjectDeviceLocationProvider() { - UnityEngine.Debug.Log("LocationProviderFactory: " + "Injected DEVICE Location Provider"); - DefaultLocationProvider = _deviceLocationProvider; + int AndroidApiVersion = 0; + var regex = new Regex(@"(?<=API-)-?\d+"); + Match match = regex.Match(SystemInfo.operatingSystem); // eg 'Android OS 8.1.0 / API-27 (OPM2.171019.029/4657601)' + if (match.Success) { int.TryParse(match.Groups[0].Value, out AndroidApiVersion); } + Debug.LogFormat("{0} => API version: {1}", SystemInfo.operatingSystem, AndroidApiVersion); + + + if (Application.platform == RuntimePlatform.Android + && null != _deviceLocationProviderAndroid + // API version 24 => Android 7 (Nougat): we are using GnssStatus 'https://developer.android.com/reference/android/location/GnssStatus.html' + // in the native plugin. + // GnssStatus is not available with versions lower than 24 + && AndroidApiVersion >= 24 + ) + { + Debug.Log("LocationProviderFactory: " + "Injected native Android DEVICE Location Provider"); + DefaultLocationProvider = _deviceLocationProviderAndroid; + } + else + { + Debug.Log("LocationProviderFactory: " + "Injected DEVICE Location Provider"); + DefaultLocationProvider = _deviceLocationProviderUnity; + } } } } diff --git a/sdkproject/Assets/Mapbox/Unity/Location/Plugins.meta b/sdkproject/Assets/Mapbox/Unity/Location/Plugins.meta new file mode 100644 index 000000000..8a4a0020c --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/Plugins.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 43baaadfc9d32d541a1ee7a2eb96ec13 +folderAsset: yes +timeCreated: 1524222478 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Location/Plugins/Android.meta b/sdkproject/Assets/Mapbox/Unity/Location/Plugins/Android.meta new file mode 100644 index 000000000..f9a417b51 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/Plugins/Android.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 11309dfa687722c47906aefe9ec1ba2c +folderAsset: yes +timeCreated: 1524222479 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Location/Plugins/Android/com.mapbox.android.unity-debug.aar b/sdkproject/Assets/Mapbox/Unity/Location/Plugins/Android/com.mapbox.android.unity-debug.aar new file mode 100644 index 000000000..318d1b49d Binary files /dev/null and b/sdkproject/Assets/Mapbox/Unity/Location/Plugins/Android/com.mapbox.android.unity-debug.aar differ diff --git a/sdkproject/Assets/Mapbox/Unity/Location/Plugins/Android/com.mapbox.android.unity-debug.aar.meta b/sdkproject/Assets/Mapbox/Unity/Location/Plugins/Android/com.mapbox.android.unity-debug.aar.meta new file mode 100644 index 000000000..7f396c364 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/Location/Plugins/Android/com.mapbox.android.unity-debug.aar.meta @@ -0,0 +1,31 @@ +fileFormatVersion: 2 +guid: e76e76754c0e43349882cd6d722a69ed +timeCreated: 1523530570 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/Location/TransformLocationProvider.cs b/sdkproject/Assets/Mapbox/Unity/Location/TransformLocationProvider.cs index 6c0d4e40f..db3df8c12 100644 --- a/sdkproject/Assets/Mapbox/Unity/Location/TransformLocationProvider.cs +++ b/sdkproject/Assets/Mapbox/Unity/Location/TransformLocationProvider.cs @@ -38,12 +38,12 @@ public Transform TargetTransform protected override void SetLocation() { var _map = LocationProviderFactory.Instance.mapManager; - _currentLocation.Heading = _targetTransform.eulerAngles.y; + _currentLocation.UserHeading = _targetTransform.eulerAngles.y; _currentLocation.LatitudeLongitude = _targetTransform.GetGeoPosition(_map.CenterMercator, _map.WorldRelativeScale); _currentLocation.Accuracy = _accuracy; _currentLocation.Timestamp = UnixTimestampUtils.To(DateTime.UtcNow); _currentLocation.IsLocationUpdated = true; - _currentLocation.IsHeadingUpdated = true; + _currentLocation.IsUserHeadingUpdated = true; } } } diff --git a/sdkproject/Assets/Mapbox/Unity/Map/AbstractMap.cs b/sdkproject/Assets/Mapbox/Unity/Map/AbstractMap.cs index e062533f1..1cd9dee6b 100644 --- a/sdkproject/Assets/Mapbox/Unity/Map/AbstractMap.cs +++ b/sdkproject/Assets/Mapbox/Unity/Map/AbstractMap.cs @@ -128,6 +128,7 @@ public TerrainLayer Terrain return _terrain; } } + /// /// The vector data. /// Options to control the vector data component of the map. @@ -290,16 +291,50 @@ public void SetWorldRelativeScale(float scale) { _worldRelativeScale = scale; } + + public bool IsAccessTokenValid + { + get + { + bool isAccessTokenValid = false; + try + { + var accessTokenCheck = Unity.MapboxAccess.Instance; + if (Unity.MapboxAccess.Instance.Configuration == null || string.IsNullOrEmpty(Unity.MapboxAccess.Instance.Configuration.AccessToken)) + { + return false; + } + + isAccessTokenValid = true; + } + catch (System.Exception) + { + isAccessTokenValid = false; + } + return isAccessTokenValid; + } + } + + /// + /// Event delegate, gets called after map is initialized + /// + /// public event Action OnInitialized = delegate { }; + /// + /// Event delegate, gets called after map is updated. + /// UpdateMap will trigger this event. + /// + /// + public event Action OnUpdated = delegate { }; - void Awake() + protected virtual void Awake() { // Setup a visualizer to get a "Starter" map. _mapVisualizer = ScriptableObject.CreateInstance(); } // Use this for initialization - void Start() + protected virtual void Start() { StartCoroutine("SetupAccess"); if (_initializeOnStart) @@ -502,6 +537,11 @@ public virtual void UpdateMap(Vector2d latLon, float zoom) _mapScaleFactor.y = 1; Root.localScale = _mapScaleFactor; } + + if (OnUpdated != null) + { + OnUpdated(); + } } /// /// Resets the map. @@ -645,6 +685,151 @@ public void SetLoadingTexture(Texture2D loadingTexture) Options.loadingTexture = loadingTexture; _mapVisualizer.SetLoadingTexture(loadingTexture); } + + #region Location Prefabs Methods + + /// + /// Places a prefab at the specified LatLon on the Map. + /// + /// A Game Object Prefab. + /// A Vector2d(Latitude Longitude) object + public void SpawnPrefabAtGeoLocation(GameObject prefab, + Vector2d LatLon, + Action> callback = null, + bool scaleDownWithWorld = true, + string locationItemName = "New Location") + { + var latLonArray = new Vector2d[] { LatLon }; + SpawnPrefabAtGeoLocation(prefab, latLonArray, callback, scaleDownWithWorld, locationItemName); + } + + /// + /// Places a prefab at all locations specified by the LatLon array. + /// + /// A Game Object Prefab. + /// A Vector2d(Latitude Longitude) object + public void SpawnPrefabAtGeoLocation(GameObject prefab, + Vector2d[] LatLon, + Action> callback = null, + bool scaleDownWithWorld = true, + string locationItemName = "New Location") + { + var coordinateArray = new string[LatLon.Length]; + for (int i = 0; i < LatLon.Length; i++) + { + coordinateArray[i] = LatLon[i].x + ", " + LatLon[i].y; + } + + PrefabItemOptions item = new PrefabItemOptions() + { + findByType = LocationPrefabFindBy.AddressOrLatLon, + prefabItemName = locationItemName, + spawnPrefabOptions = new SpawnPrefabOptions() + { + prefab = prefab, + scaleDownWithWorld = scaleDownWithWorld + }, + + coordinates = coordinateArray + }; + + if (callback != null) + { + item.OnAllPrefabsInstantiated += callback; + } + + CreatePrefabLayer(item); + } + + /// + /// Places the prefab for supplied categories. + /// + /// GameObject Prefab + /// For more than one category separate them by pipe + /// (eg: LocationPrefabCategories.Food | LocationPrefabCategories.Nightlife) + /// Density controls the number of POIs on the map.(Integer value between 1 and 30) + /// Name of this location prefab item for future reference + /// Should the prefab scale up/down along with the map game object? + public void SpawnPrefabByCategory(GameObject prefab, + LocationPrefabCategories categories = LocationPrefabCategories.AnyCategory, + int density = 30, Action> callback = null, + bool scaleDownWithWorld = true, + string locationItemName = "New Location") + { + PrefabItemOptions item = new PrefabItemOptions() + { + findByType = LocationPrefabFindBy.MapboxCategory, + categories = categories, + density = density, + prefabItemName = locationItemName, + spawnPrefabOptions = new SpawnPrefabOptions() + { + prefab = prefab, + scaleDownWithWorld = scaleDownWithWorld + } + }; + + if (callback != null) + { + item.OnAllPrefabsInstantiated += callback; + } + + CreatePrefabLayer(item); + } + + /// + /// Places the prefab at POI locations if its name contains the supplied string + /// GameObject Prefab + /// This is the string that will be checked against the POI name to see if is contained in it, and ony those POIs will be spawned + /// Density (Integer value between 1 and 30) + /// Name of this location prefab item for future reference + /// Should the prefab scale up/down along with the map game object? + /// + public void SpawnPrefabByName(GameObject prefab, + string nameString, + int density = 30, + Action> callback = null, + bool scaleDownWithWorld = true, + string locationItemName = "New Location") + { + PrefabItemOptions item = new PrefabItemOptions() + { + findByType = LocationPrefabFindBy.POIName, + nameString = nameString, + density = density, + prefabItemName = locationItemName, + spawnPrefabOptions = new SpawnPrefabOptions() + { + prefab = prefab, + scaleDownWithWorld = scaleDownWithWorld + } + }; + + CreatePrefabLayer(item); + } + + /// + /// Creates the prefab layer. + /// + /// the options of the prefab layer. + private void CreatePrefabLayer(PrefabItemOptions item) + { + if (_vectorData.LayerProperty.sourceType == VectorSourceType.None + || !_vectorData.LayerProperty.sourceOptions.Id.Contains(MapboxDefaultVector.GetParameters(VectorSourceType.MapboxStreets).Id)) + { + Debug.LogError("In order to place location prefabs please add \"mapbox.mapbox-streets-v7\" to the list of vector data sources"); + return; + } + + //ensure that there is a vector layer + if (_vectorData == null) + { + _vectorData = new VectorLayer(); + } + + _vectorData.AddLocationPrefabItem(item); + } + + #endregion } } - diff --git a/sdkproject/Assets/Mapbox/Unity/Map/CameraBoundsTileProvider.cs b/sdkproject/Assets/Mapbox/Unity/Map/CameraBoundsTileProvider.cs index 7e581d7e0..cbd2756ae 100644 --- a/sdkproject/Assets/Mapbox/Unity/Map/CameraBoundsTileProvider.cs +++ b/sdkproject/Assets/Mapbox/Unity/Map/CameraBoundsTileProvider.cs @@ -46,7 +46,7 @@ public override void OnInitialized() toRemove = new List(); } - void Update() + protected virtual void Update() { if (!_shouldUpdate) { diff --git a/sdkproject/Assets/Mapbox/Unity/Map/GlobeTileProvider.cs b/sdkproject/Assets/Mapbox/Unity/Map/GlobeTileProvider.cs index a13c39605..6d93414a6 100644 --- a/sdkproject/Assets/Mapbox/Unity/Map/GlobeTileProvider.cs +++ b/sdkproject/Assets/Mapbox/Unity/Map/GlobeTileProvider.cs @@ -12,13 +12,6 @@ public override void OnInitialized() { throw new System.Exception("Too many tiles! Use a lower zoom level!"); } - } - private void Update() - { - if (_map.AbsoluteZoom > 5) - { - throw new System.Exception("Too many tiles! Use a lower zoom level!"); - } var tileCover = TileCover.Get(Vector2dBounds.World(), _map.AbsoluteZoom); foreach (var tile in tileCover) diff --git a/sdkproject/Assets/Mapbox/Unity/Map/InitializeMapWithLocationProvider.cs b/sdkproject/Assets/Mapbox/Unity/Map/InitializeMapWithLocationProvider.cs index 6020cf056..f92c19910 100644 --- a/sdkproject/Assets/Mapbox/Unity/Map/InitializeMapWithLocationProvider.cs +++ b/sdkproject/Assets/Mapbox/Unity/Map/InitializeMapWithLocationProvider.cs @@ -10,14 +10,14 @@ public class InitializeMapWithLocationProvider : MonoBehaviour AbstractMap _map; ILocationProvider _locationProvider; - + private void Awake() { // Prevent double initialization of the map. _map.InitializeOnStart = false; } - IEnumerator Start() + protected virtual IEnumerator Start() { yield return null; _locationProvider = LocationProviderFactory.Instance.DefaultLocationProvider; diff --git a/sdkproject/Assets/Mapbox/Unity/Map/QuadTreeTileProvider.cs b/sdkproject/Assets/Mapbox/Unity/Map/QuadTreeTileProvider.cs index e99fa11de..6edff84a1 100644 --- a/sdkproject/Assets/Mapbox/Unity/Map/QuadTreeTileProvider.cs +++ b/sdkproject/Assets/Mapbox/Unity/Map/QuadTreeTileProvider.cs @@ -27,7 +27,7 @@ public override void OnInitialized() _shouldUpdate = true; } - void Update() + protected virtual void Update() { //Camera Debugging //Vector3[] frustumCorners = new Vector3[4]; diff --git a/sdkproject/Assets/Mapbox/Unity/Map/RangeAroundTransformTileProvider.cs b/sdkproject/Assets/Mapbox/Unity/Map/RangeAroundTransformTileProvider.cs index bf0d9157d..9ee211f3c 100644 --- a/sdkproject/Assets/Mapbox/Unity/Map/RangeAroundTransformTileProvider.cs +++ b/sdkproject/Assets/Mapbox/Unity/Map/RangeAroundTransformTileProvider.cs @@ -32,7 +32,7 @@ public override void OnInitialized() _cachedTile = new UnwrappedTileId(); } - private void Update() + protected virtual void Update() { if (!_initialized) return; diff --git a/sdkproject/Assets/Mapbox/Unity/Map/RangeTileProvider.cs b/sdkproject/Assets/Mapbox/Unity/Map/RangeTileProvider.cs index e3a3ef4d6..88372ab22 100644 --- a/sdkproject/Assets/Mapbox/Unity/Map/RangeTileProvider.cs +++ b/sdkproject/Assets/Mapbox/Unity/Map/RangeTileProvider.cs @@ -24,7 +24,7 @@ public override void OnInitialized() _initialized = true; } - private void Update() + protected virtual void Update() { if (!_initialized) { diff --git a/sdkproject/Assets/Mapbox/Unity/Map/TileErrorHandler.cs b/sdkproject/Assets/Mapbox/Unity/Map/TileErrorHandler.cs index d77104ede..19f8bdadf 100644 --- a/sdkproject/Assets/Mapbox/Unity/Map/TileErrorHandler.cs +++ b/sdkproject/Assets/Mapbox/Unity/Map/TileErrorHandler.cs @@ -21,7 +21,7 @@ public class TileErrorHandler : MonoBehaviour public TileErrorEvent OnTileError; - void OnEnable() + protected virtual void OnEnable() { if (_mapInstance == null) { @@ -83,7 +83,7 @@ private string printMessage(List exceptions, TileErrorEventArgs e) } - void OnDisable() + protected virtual void OnDisable() { _mapInstance.MapVisualizer.OnTileError -= _OnTileErrorHandler; } diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Components/VertexDebugger.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Components/VertexDebugger.cs index 1f9e4aebb..1e9f4811d 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Components/VertexDebugger.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Components/VertexDebugger.cs @@ -7,7 +7,7 @@ public class VertexDebugger : MonoBehaviour [Multiline(10)] public string Triangles; - void Start() + protected virtual void Start() { var mf = GetComponent(); if (mf) diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Components/VertexDebuggerGizmo.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Components/VertexDebuggerGizmo.cs index f888f2659..e8a97c1aa 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Components/VertexDebuggerGizmo.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Components/VertexDebuggerGizmo.cs @@ -16,7 +16,7 @@ public class VertexDebuggerGizmo : MonoBehaviour Mesh _mesh; - void Start() + protected virtual void Start() { var mf = GetComponent(); if (mf) @@ -31,7 +31,7 @@ void Start() } } - void OnDrawGizmosSelected() + protected virtual void OnDrawGizmosSelected() { if (_mesh) { diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Data/AtlasInfo.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Data/AtlasInfo.cs index 59c07d19a..9c58a9371 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Data/AtlasInfo.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Data/AtlasInfo.cs @@ -35,7 +35,7 @@ public void AddOnValidateEvent(UnityAction action) m_OnValidate.AddListener(action); } - private void OnValidate() + protected virtual void OnValidate() { if(m_OnValidate != null) { diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Data/UnityTile.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Data/UnityTile.cs index 51f3a3c54..16bb4e306 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Data/UnityTile.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Data/UnityTile.cs @@ -253,7 +253,7 @@ public void Cancel() } } - void OnDestroy() + protected virtual void OnDestroy() { Cancel(); if (_heightTexture != null) diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/AbstractTileFactory.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/AbstractTileFactory.cs index 846bde4e9..00928e5a1 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/AbstractTileFactory.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/AbstractTileFactory.cs @@ -106,10 +106,10 @@ public virtual void Unregister(UnityTile tile) OnUnregistered(tile); } - internal abstract void OnInitialized(); + protected abstract void OnInitialized(); - internal abstract void OnRegistered(UnityTile tile); + protected abstract void OnRegistered(UnityTile tile); - internal abstract void OnUnregistered(UnityTile tile); + protected abstract void OnUnregistered(UnityTile tile); } } \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/DirectionsFactory.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/DirectionsFactory.cs index 4c8a4062e..e967d0706 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/DirectionsFactory.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/DirectionsFactory.cs @@ -32,7 +32,7 @@ public class DirectionsFactory : MonoBehaviour GameObject _directionsGO; - void Awake() + protected virtual void Awake() { if (_map == null) { @@ -40,11 +40,13 @@ void Awake() } _directions = MapboxAccess.Instance.Directions; _map.OnInitialized += Query; + _map.OnUpdated += Query; } - void OnDestroy() + protected virtual void OnDestroy() { _map.OnInitialized -= Query; + _map.OnUpdated -= Query; } void Query() @@ -121,4 +123,4 @@ GameObject CreateGameObject(MeshData data) } } -} \ No newline at end of file +} diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatSphereTerrainFactory.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatSphereTerrainFactory.cs.meta deleted file mode 100644 index 57f4167e8..000000000 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatSphereTerrainFactory.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 859bc316b9b734bffaf7288cb86ffc0c -timeCreated: 1501082693 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatTerrainFactory.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatTerrainFactory.cs.meta deleted file mode 100644 index ee97c82c9..000000000 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatTerrainFactory.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0a6523094c07d4ee683da5d826fce510 -timeCreated: 1495046511 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/ImageDataFetcher.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/ImageDataFetcher.cs new file mode 100644 index 000000000..a3cce4495 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/ImageDataFetcher.cs @@ -0,0 +1,38 @@ +using Mapbox.Map; +using Mapbox.Unity.MeshGeneration.Data; +using System; +public class ImageDataFetcher : DataFetcher +{ + public Action DataRecieved = (t, s) => { }; + public Action FetchingError = (t, s) => { }; + + //tile here should be totally optional and used only not to have keep a dictionary in terrain factory base + public void FetchImage(CanonicalTileId canonicalTileId, string mapid, UnityTile tile = null, bool useRetina = false) + { + RasterTile rasterTile; + if (mapid.StartsWith("mapbox://", StringComparison.Ordinal)) + { + rasterTile = useRetina ? new RetinaRasterTile() : new RasterTile(); + } + else + { + rasterTile = useRetina ? new ClassicRetinaRasterTile() : new ClassicRasterTile(); + } + + if (tile != null) + { + tile.AddTile(rasterTile); + } + + rasterTile.Initialize(_fileSource, tile.CanonicalTileId, mapid, () => + { + if (rasterTile.HasError) + { + FetchingError(tile, new TileErrorEventArgs(tile.CanonicalTileId, rasterTile.GetType(), tile, rasterTile.Exceptions)); + return; + } + + DataRecieved(tile, rasterTile); + }); + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/ImageDataFetcher.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/ImageDataFetcher.cs.meta new file mode 100644 index 000000000..675df3a5c --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/ImageDataFetcher.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 6293dc8bcca4970409cf9f4e93d178b5 +timeCreated: 1524268181 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/LowPolyTerrainFactory.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/LowPolyTerrainFactory.cs.meta deleted file mode 100644 index 90d7f1af2..000000000 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/LowPolyTerrainFactory.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9ffef98732ebca048a22c90f6809321c -timeCreated: 1500160220 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/MapImageFactory.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/MapImageFactory.cs index d2830a071..862f9c3a6 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/MapImageFactory.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/MapImageFactory.cs @@ -23,7 +23,7 @@ public class MapImageFactory : AbstractTileFactory { [SerializeField] ImageryLayerProperties _properties; - + protected ImageDataFetcher DataFetcher; public string MapId { get @@ -37,27 +37,54 @@ public string MapId } } - public override void SetOptions(LayerProperties options) + #region UnityMethods + protected virtual void OnDestroy() { - _properties = (ImageryLayerProperties)options; + if (DataFetcher != null) + { + DataFetcher.DataRecieved -= OnImageRecieved; + DataFetcher.FetchingError -= OnDataError; + } + } + #endregion + + #region DataFetcherEvents + private void OnImageRecieved(UnityTile tile, RasterTile rasterTile) + { + if (tile != null) + { + Progress--; + tile.SetRasterData(rasterTile.Data, _properties.rasterOptions.useMipMap, _properties.rasterOptions.useCompression); + tile.RasterDataState = TilePropertyState.Loaded; + } } - // TODO: come back to this - //public override void Update() - //{ - // base.Update(); - // foreach (var tile in _tiles.Values) - // { - // Run(tile); - // } - //} + //merge this with OnErrorOccurred? + protected virtual void OnDataError(UnityTile tile, TileErrorEventArgs e) + { + if (tile != null) + { + Progress--; + tile.RasterDataState = TilePropertyState.Error; + OnErrorOccurred(e); + } + } + #endregion - internal override void OnInitialized() + #region AbstractFactoryOverrides + protected override void OnInitialized() { + DataFetcher = ScriptableObject.CreateInstance(); + DataFetcher.DataRecieved += OnImageRecieved; + DataFetcher.FetchingError += OnDataError; + } + public override void SetOptions(LayerProperties options) + { + _properties = (ImageryLayerProperties)options; } - internal override void OnRegistered(UnityTile tile) + protected override void OnRegistered(UnityTile tile) { if (_properties.sourceType == ImagerySourceType.None) { @@ -66,40 +93,9 @@ internal override void OnRegistered(UnityTile tile) return; } - RasterTile rasterTile; - if (MapId.StartsWith("mapbox://", StringComparison.Ordinal)) - { - rasterTile = _properties.rasterOptions.useRetina ? new RetinaRasterTile() : new RasterTile(); - } - else - { - rasterTile = _properties.rasterOptions.useRetina ? new ClassicRetinaRasterTile() : new ClassicRasterTile(); - } - tile.RasterDataState = TilePropertyState.Loading; - - tile.AddTile(rasterTile); Progress++; - rasterTile.Initialize(_fileSource, tile.CanonicalTileId, MapId, () => - { - if (tile == null) - { - Progress--; - return; - } - - if (rasterTile.HasError) - { - OnErrorOccurred(new TileErrorEventArgs(tile.CanonicalTileId, rasterTile.GetType(), tile, rasterTile.Exceptions)); - tile.RasterDataState = TilePropertyState.Error; - Progress--; - return; - } - - tile.SetRasterData(rasterTile.Data, _properties.rasterOptions.useMipMap, _properties.rasterOptions.useCompression); - tile.RasterDataState = TilePropertyState.Loaded; - Progress--; - }); + DataFetcher.FetchImage(tile.CanonicalTileId, MapId, tile, _properties.rasterOptions.useRetina); } /// @@ -108,12 +104,14 @@ internal override void OnRegistered(UnityTile tile) /// instance/ protected override void OnErrorOccurred(TileErrorEventArgs e) { - base.OnErrorOccurred(e); } - internal override void OnUnregistered(UnityTile tile) + protected override void OnUnregistered(UnityTile tile) { } + + + #endregion } } \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainDataFetcher.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainDataFetcher.cs new file mode 100644 index 000000000..43a499930 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainDataFetcher.cs @@ -0,0 +1,38 @@ +using Mapbox.Map; +using Mapbox.Unity; +using Mapbox.Unity.MeshGeneration.Data; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class DataFetcher : ScriptableObject +{ + protected MapboxAccess _fileSource; + + public void OnEnable() + { + _fileSource = MapboxAccess.Instance; + } +} + +public class TerrainDataFetcher : DataFetcher +{ + public Action DataRecieved = (t, s) => { }; + public Action FetchingError = (t, s) => { }; + + //tile here should be totally optional and used only not to have keep a dictionary in terrain factory base + public void FetchTerrain(CanonicalTileId canonicalTileId, string mapid, UnityTile tile = null) + { + var pngRasterTile = new RawPngRasterTile(); + pngRasterTile.Initialize(_fileSource, canonicalTileId, mapid, () => + { + if (pngRasterTile.HasError) + { + FetchingError(tile, new TileErrorEventArgs(canonicalTileId, pngRasterTile.GetType(), null, pngRasterTile.Exceptions)); + } + + DataRecieved(tile, pngRasterTile); + }); + } +} diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainDataFetcher.cs.meta similarity index 77% rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs.meta rename to sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainDataFetcher.cs.meta index 32769b3a8..4ae6c7131 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs.meta +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainDataFetcher.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 13c569393eedb4ed39120c82612bdd06 -timeCreated: 1510966847 +guid: c823321064d5b2f4db21c4fdbd6b1c1f +timeCreated: 1523880895 licenseType: Free MonoImporter: externalObjects: {} diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactory.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactory.cs.meta deleted file mode 100644 index 42df1eb4c..000000000 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactory.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8338f26893d62c1439f387800a8e1c9a -timeCreated: 1481718836 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 2ac69ccfbca692443a02f68e1a689694, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactoryBase.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactoryBase.cs new file mode 100644 index 000000000..ed24757f4 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactoryBase.cs @@ -0,0 +1,92 @@ +using Mapbox.Unity.MeshGeneration.Factories; +using System.Collections; +using UnityEngine; +using Mapbox.Unity.MeshGeneration.Data; +using Mapbox.Unity.Map; +using Mapbox.Map; +using Mapbox.Unity.MeshGeneration.Enums; +using Mapbox.Unity.MeshGeneration.Factories.TerrainStrategies; +using System; + +namespace Mapbox.Unity.MeshGeneration.Factories +{ + public class TerrainFactoryBase : AbstractTileFactory + { + public TerrainStrategy Strategy; + [SerializeField] + protected ElevationLayerProperties _elevationOptions = new ElevationLayerProperties(); + protected TerrainDataFetcher DataFetcher; + + #region UnityMethods + private void OnDestroy() + { + if (DataFetcher != null) + { + DataFetcher.DataRecieved -= OnTerrainRecieved; + DataFetcher.FetchingError -= OnDataError; + } + } + #endregion + + #region AbstractFactoryOverrides + protected override void OnInitialized() + { + Strategy.Initialize(_elevationOptions); + DataFetcher = ScriptableObject.CreateInstance(); + DataFetcher.DataRecieved += OnTerrainRecieved; + DataFetcher.FetchingError += OnDataError; + } + + public override void SetOptions(LayerProperties options) + { + _elevationOptions = (ElevationLayerProperties)options; + } + + protected override void OnRegistered(UnityTile tile) + { + Progress++; + if (Strategy is IElevationBasedTerrainStrategy) + { + tile.HeightDataState = TilePropertyState.Loading; + DataFetcher.FetchTerrain(tile.CanonicalTileId, _elevationOptions.sourceOptions.Id, tile); + } + else + { + Strategy.RegisterTile(tile); + Progress--; + } + + } + + protected override void OnUnregistered(UnityTile tile) + { + Progress--; + Strategy.UnregisterTile(tile); + } + #endregion + + #region DataFetcherEvents + private void OnTerrainRecieved(UnityTile tile, RawPngRasterTile pngRasterTile) + { + if (tile != null) + { + Progress--; + tile.SetHeightData(pngRasterTile.Data, _elevationOptions.requiredOptions.exaggerationFactor, _elevationOptions.modificationOptions.useRelativeHeight); + Strategy.RegisterTile(tile); + } + } + + private void OnDataError(UnityTile tile, TileErrorEventArgs e) + { + if (tile != null) + { + Progress--; + tile.HeightDataState = TilePropertyState.Error; + //strategy might want to act on this , i.e. flattening tile mesh on data fetching failed? + Strategy.DataErrorOccurred(tile, e); + } + } + #endregion + + } +} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactoryBase.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactoryBase.cs.meta new file mode 100644 index 000000000..46bd98e24 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactoryBase.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: af9867f09d360f2409d9d08a0ff16906 +timeCreated: 1522684959 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies.meta new file mode 100644 index 000000000..4783427d9 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 9a7ab3f3c54be5140aecaed29e7e4f65 +folderAsset: yes +timeCreated: 1522755730 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactory.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainStrategy.cs similarity index 78% rename from sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactory.cs rename to sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainStrategy.cs index 566e61487..f35db3542 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainFactory.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainStrategy.cs @@ -1,28 +1,14 @@ -namespace Mapbox.Unity.MeshGeneration.Factories +using System.Collections.Generic; +using UnityEngine; +using Mapbox.Unity.MeshGeneration.Data; +using Mapbox.Unity.Map; +using Mapbox.Map; +using Mapbox.Utils; + +namespace Mapbox.Unity.MeshGeneration.Factories.TerrainStrategies { - using System.Collections.Generic; - using UnityEngine; - using Mapbox.Map; - using Mapbox.Unity.MeshGeneration.Enums; - using Mapbox.Unity.MeshGeneration.Data; - using Utils; - using System; - using Mapbox.Unity.Map; - - public enum MapIdType + public class ElevatedTerrainStrategy : TerrainStrategy, IElevationBasedTerrainStrategy { - Standard, - Custom - } - - /// - /// Uses Mapbox Terrain api and creates terrain meshes. - /// - [CreateAssetMenu(menuName = "Mapbox/Factories/Terrain Factory")] - public class TerrainFactory : AbstractTileFactory - { - [SerializeField] - ElevationLayerProperties _elevationOptions = new ElevationLayerProperties(); Mesh _stitchTarget; protected Dictionary _meshData; @@ -37,43 +23,10 @@ public class TerrainFactory : AbstractTileFactory private int _vertA, _vertB, _vertC; private int _counter; - //public string MapId - //{ - // get - // { - // return _elevationOptions.sourceOptions.Id; - // } - - // set - // { - // _elevationOptions.sourceOptions.Id = value; - // } - //} - - public override void SetOptions(LayerProperties options) + public override void Initialize(ElevationLayerProperties elOptions) { - _elevationOptions = (ElevationLayerProperties)options; - } + base.Initialize(elOptions); - /// - /// Clears the mesh data and re-runs the terrain creation procedure using current settings. Clearing the old mesh data is important as terrain stitching function checks if the data exists or not. - /// - // TODO: come back to this - //public override void Update() - //{ - // base.Update(); - // foreach (var tile in _tiles.Values) - // { - // tile.MeshData = null; - // } - // foreach (var tile in _tiles.Values) - // { - // Run(tile); - // } - //} - - internal override void OnInitialized() - { _meshData = new Dictionary(); _currentTileMeshData = new MeshData(); _stitchTargetMeshData = new MeshData(); @@ -84,7 +37,7 @@ internal override void OnInitialized() _newTriangleList = new List(); } - internal override void OnRegistered(UnityTile tile) + public override void RegisterTile(UnityTile tile) { if (_elevationOptions.unityLayerOptions.addToLayer && tile.gameObject.layer != _elevationOptions.unityLayerOptions.layerId) { @@ -108,9 +61,20 @@ internal override void OnRegistered(UnityTile tile) tile.gameObject.AddComponent(); } - CreateTerrainHeight(tile); + GenerateTerrainMesh(tile); } + public override void UnregisterTile(UnityTile tile) + { + _meshData.Remove(tile.UnwrappedTileId); + } + + public override void DataErrorOccurred(UnityTile t, TileErrorEventArgs e) + { + + } + + #region mesh gen private void CreateBaseMesh(UnityTile tile) { //TODO use arrays instead of lists @@ -134,7 +98,7 @@ private void CreateBaseMesh(UnityTile tile) (float)(xx - tile.Rect.Center.x) * tile.TileScale, 0, (float)(yy - tile.Rect.Center.y) * tile.TileScale)); - _newNormalList.Add(Unity.Constants.Math.Vector3Up); + _newNormalList.Add(Mapbox.Unity.Constants.Math.Vector3Up); _newUvList.Add(new Vector2(x * 1f / (_sampleCount - 1), 1 - (y * 1f / (_sampleCount - 1)))); } } @@ -166,66 +130,6 @@ private void CreateBaseMesh(UnityTile tile) mesh.SetTriangles(_newTriangleList, 0); } - internal override void OnUnregistered(UnityTile tile) - { - _meshData.Remove(tile.UnwrappedTileId); - } - - /// - /// Creates the non-flat terrain using a height multiplier - /// - /// Tile. - private void CreateTerrainHeight(UnityTile tile) - { - tile.HeightDataState = TilePropertyState.Loading; - var pngRasterTile = new RawPngRasterTile(); - - tile.AddTile(pngRasterTile); - Progress++; - - pngRasterTile.Initialize(_fileSource, tile.CanonicalTileId, _elevationOptions.sourceOptions.Id, () => - { - if (tile == null) - { - Progress--; - return; - } - - if (pngRasterTile.HasError) - { - OnErrorOccurred(new TileErrorEventArgs(tile.CanonicalTileId, pngRasterTile.GetType(), tile, pngRasterTile.Exceptions)); - tile.HeightDataState = TilePropertyState.Error; - - // Handle missing elevation from server (404)! - // TODO: optimize this search! - if (pngRasterTile.ExceptionsAsString.Contains("404")) - { - ResetToFlatMesh(tile); - } - Progress--; - return; - } - - tile.SetHeightData(pngRasterTile.Data, _elevationOptions.requiredOptions.exaggerationFactor, _elevationOptions.modificationOptions.useRelativeHeight); - GenerateTerrainMesh(tile); - Progress--; - }); - } - - /// - /// Method to be called when a tile error has occurred. - /// - /// instance/ - protected override void OnErrorOccurred(TileErrorEventArgs e) - { - base.OnErrorOccurred(e); - } - - /// - /// Creates the non-flat terrain mesh, using a grid by defined resolution (_sampleCount). Vertex order goes right & up. Normals are calculated manually and UV map is fitted/stretched 1-1. - /// Any additional scripts or logic, like MeshCollider or setting layer, can be done here. - /// - /// private void GenerateTerrainMesh(UnityTile tile) { tile.MeshFilter.mesh.GetVertices(_currentTileMeshData.Vertices); @@ -240,7 +144,7 @@ private void GenerateTerrainMesh(UnityTile tile) _currentTileMeshData.Vertices[(int)(y * _sampleCount + x)].x, tile.QueryHeightData(x / (_sampleCount - 1), 1 - y / (_sampleCount - 1)), _currentTileMeshData.Vertices[(int)(y * _sampleCount + x)].z); - _currentTileMeshData.Normals[(int)(y * _sampleCount + x)] = Unity.Constants.Math.Vector3Zero; + _currentTileMeshData.Normals[(int)(y * _sampleCount + x)] = Mapbox.Unity.Constants.Math.Vector3Zero; } } @@ -302,7 +206,7 @@ private void ResetToFlatMesh(UnityTile tile) _currentTileMeshData.Vertices[i].x, 0, _currentTileMeshData.Vertices[i].z); - _currentTileMeshData.Normals[i] = Unity.Constants.Math.Vector3Up; + _currentTileMeshData.Normals[i] = Mapbox.Unity.Constants.Math.Vector3Up; } tile.MeshFilter.mesh.SetVertices(_currentTileMeshData.Vertices); @@ -481,5 +385,6 @@ private void FixStitches(UnwrappedTileId tileId, MeshData mesh) _stitchTargetMeshData.Normals[0].z); } } + #endregion } -} +} \ No newline at end of file diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainStrategy.cs.meta similarity index 77% rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs.meta rename to sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainStrategy.cs.meta index 3d846d1e6..e7bed0325 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs.meta +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainStrategy.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: f6b4b7c51c87443799d4fbeda15e9bdd -timeCreated: 1510945633 +guid: ea9b70aa9455c614f8701116ede4599d +timeCreated: 1522755494 licenseType: Free MonoImporter: externalObjects: {} diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainWithSideWallsFactory.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainWithSidesStrategy.cs similarity index 86% rename from sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainWithSideWallsFactory.cs rename to sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainWithSidesStrategy.cs index 4b0fbf729..671f187e4 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainWithSideWallsFactory.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainWithSidesStrategy.cs @@ -1,22 +1,14 @@ -namespace Mapbox.Unity.MeshGeneration.Factories +using System.Collections.Generic; +using UnityEngine; +using Mapbox.Unity.MeshGeneration.Data; +using Mapbox.Unity.Map; +using Mapbox.Map; +using Mapbox.Utils; + +namespace Mapbox.Unity.MeshGeneration.Factories.TerrainStrategies { - using System.Collections.Generic; - using UnityEngine; - using Mapbox.Map; - using Mapbox.Unity.MeshGeneration.Enums; - using Mapbox.Unity.MeshGeneration.Data; - using Utils; - using Mapbox.Unity.Map; - using System; - - /// - /// Uses Mapbox Terrain api and creates terrain meshes. - /// - [CreateAssetMenu(menuName = "Mapbox/Factories/Terrain Factory - Side Walls")] - public class TerrainWithSideWallsFactory : AbstractTileFactory + public class ElevatedTerrainWithSidesStrategy : TerrainStrategy, IElevationBasedTerrainStrategy { - [SerializeField] - ElevationLayerProperties _elevationOptions = new ElevationLayerProperties(); Mesh _stitchTarget; protected Dictionary _meshData; @@ -31,26 +23,10 @@ public class TerrainWithSideWallsFactory : AbstractTileFactory private int _vertA, _vertB, _vertC; private int _counter; - public string MapId + public override void Initialize(ElevationLayerProperties elOptions) { - get - { - return _elevationOptions.sourceOptions.layerSource.Id; - } - - set - { - _elevationOptions.sourceOptions.layerSource.Id = value; - } - } - - public override void SetOptions(LayerProperties options) - { - _elevationOptions = (ElevationLayerProperties)options; - } + _elevationOptions = elOptions; - internal override void OnInitialized() - { _meshData = new Dictionary(); _currentTileMeshData = new MeshData(); _stitchTargetMeshData = new MeshData(); @@ -61,7 +37,8 @@ internal override void OnInitialized() _newTriangleList = new List(); } - internal override void OnRegistered(UnityTile tile) + + public override void RegisterTile(UnityTile tile) { if (_elevationOptions.unityLayerOptions.addToLayer && tile.gameObject.layer != _elevationOptions.unityLayerOptions.layerId) { @@ -89,7 +66,7 @@ internal override void OnRegistered(UnityTile tile) tile.gameObject.AddComponent(); } - CreateTerrainHeight(tile); + GenerateTerrainMesh(tile); } private void CreateBaseMesh(UnityTile tile) @@ -115,7 +92,7 @@ private void CreateBaseMesh(UnityTile tile) (float)(xx - tile.Rect.Center.x) * tile.TileScale, 0, (float)(yy - tile.Rect.Center.y) * tile.TileScale)); - _newNormalList.Add(Unity.Constants.Math.Vector3Up); + _newNormalList.Add(Mapbox.Unity.Constants.Math.Vector3Up); _newUvList.Add(new Vector2(x * 1f / (_sampleCount - 1), 1 - (y * 1f / (_sampleCount - 1)))); } } @@ -248,61 +225,11 @@ private void CreateBaseMesh(UnityTile tile) mesh.SetTriangles(baseTriList, 1); } - internal override void OnUnregistered(UnityTile tile) + public override void UnregisterTile(UnityTile tile) { _meshData.Remove(tile.UnwrappedTileId); } - /// - /// Creates the non-flat terrain using a height multiplier - /// - /// - // Multiplier for queried height value - private void CreateTerrainHeight(UnityTile tile) - { - tile.HeightDataState = TilePropertyState.Loading; - var pngRasterTile = new RawPngRasterTile(); - - tile.AddTile(pngRasterTile); - Progress++; - - pngRasterTile.Initialize(_fileSource, tile.CanonicalTileId, MapId, () => - { - if (tile == null) - { - return; - } - - if (pngRasterTile.HasError) - { - OnErrorOccurred(new TileErrorEventArgs(tile.CanonicalTileId, pngRasterTile.GetType(), tile, pngRasterTile.Exceptions)); - tile.HeightDataState = TilePropertyState.Error; - - // Handle missing elevation from server (404)! - // TODO: optimize this search! - if (pngRasterTile.ExceptionsAsString.Contains("404")) - { - ResetToFlatMesh(tile); - } - Progress--; - return; - } - - tile.SetHeightData(pngRasterTile.Data, _elevationOptions.requiredOptions.exaggerationFactor); - GenerateTerrainMesh(tile); - Progress--; - }); - } - - /// - /// Method to be called when a tile error has occurred. - /// - /// instance/ - protected override void OnErrorOccurred(TileErrorEventArgs e) - { - base.OnErrorOccurred(e); - } - /// /// Creates the non-flat terrain mesh, using a grid by defined resolution (_sampleCount). Vertex order goes right & up. Normals are calculated manually and UV map is fitted/stretched 1-1. /// Any additional scripts or logic, like MeshCollider or setting layer, can be done here. @@ -324,7 +251,7 @@ private void GenerateTerrainMesh(UnityTile tile) _currentTileMeshData.Vertices[(int)(y * _sampleCount + x)].x, tile.QueryHeightData(x / (_sampleCount - 1), 1 - y / (_sampleCount - 1)), _currentTileMeshData.Vertices[(int)(y * _sampleCount + x)].z); - _currentTileMeshData.Normals[(int)(y * _sampleCount + x)] = Unity.Constants.Math.Vector3Zero; + _currentTileMeshData.Normals[(int)(y * _sampleCount + x)] = Mapbox.Unity.Constants.Math.Vector3Zero; if (y == 0) { @@ -404,7 +331,7 @@ private void ResetToFlatMesh(UnityTile tile) _currentTileMeshData.Vertices[i].x, 0, _currentTileMeshData.Vertices[i].z); - _currentTileMeshData.Normals[i] = Unity.Constants.Math.Vector3Up; + _currentTileMeshData.Normals[i] = Mapbox.Unity.Constants.Math.Vector3Up; } tile.MeshFilter.mesh.SetVertices(_currentTileMeshData.Vertices); @@ -584,5 +511,6 @@ private void FixStitches(UnwrappedTileId tileId, MeshData mesh) _stitchTargetMeshData.Normals[0].z); } } + } } \ No newline at end of file diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainWithSidesStrategy.cs.meta similarity index 77% rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs.meta rename to sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainWithSidesStrategy.cs.meta index 9ed0f4d32..50b57ad4d 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs.meta +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevatedTerrainWithSidesStrategy.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: a14d5807914814ffe873a6ae84fcd5dd -timeCreated: 1510945633 +guid: 3d67aa1b17136294b92c1a5f4d9d867a +timeCreated: 1522755493 licenseType: Free MonoImporter: externalObjects: {} diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevationBasedTerrainStrategy.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevationBasedTerrainStrategy.cs new file mode 100644 index 000000000..df752acc9 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevationBasedTerrainStrategy.cs @@ -0,0 +1,4 @@ +public interface IElevationBasedTerrainStrategy +{ + +} \ No newline at end of file diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevationBasedTerrainStrategy.cs.meta similarity index 77% rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs.meta rename to sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevationBasedTerrainStrategy.cs.meta index 81823db9e..559c10ba9 100644 --- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs.meta +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/ElevationBasedTerrainStrategy.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 7d20494e9cc8541f4bf16ac8a1eec2ef -timeCreated: 1509308701 +guid: 0629e9d95db9602439cbd191b7c35260 +timeCreated: 1522756350 licenseType: Free MonoImporter: externalObjects: {} diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatSphereTerrainFactory.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatSphereTerrainStrategy.cs similarity index 74% rename from sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatSphereTerrainFactory.cs rename to sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatSphereTerrainStrategy.cs index d7b1a92cd..f945bc0a3 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatSphereTerrainFactory.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatSphereTerrainStrategy.cs @@ -1,36 +1,23 @@ -namespace Mapbox.Unity.MeshGeneration.Factories +using System.Collections.Generic; +using UnityEngine; +using Mapbox.Unity.MeshGeneration.Data; +using Mapbox.Unity.Map; +using Mapbox.Utils; +using Mapbox.Unity.Utilities; + +namespace Mapbox.Unity.MeshGeneration.Factories.TerrainStrategies { - using UnityEngine; - using Mapbox.Unity.MeshGeneration.Data; - using Mapbox.Unity.Utilities; - using System.Collections.Generic; - using Mapbox.Utils; - using Mapbox.Unity.Map; - - [CreateAssetMenu(menuName = "Mapbox/Factories/Terrain Factory - Flat Sphere")] - public class FlatSphereTerrainFactory : AbstractTileFactory - { - public float Radius - { - get - { - return _elevationOptions.modificationOptions.earthRadius; - } - } - [SerializeField] - ElevationLayerProperties _elevationOptions = new ElevationLayerProperties(); - public override void SetOptions(LayerProperties options) - { - _elevationOptions = (ElevationLayerProperties)options; - } + public class FlatSphereTerrainStrategy : TerrainStrategy + { + public float Radius { get { return _elevationOptions.modificationOptions.earthRadius; } } - internal override void OnInitialized() + public override void Initialize(ElevationLayerProperties elOptions) { - + _elevationOptions = elOptions; } - internal override void OnRegistered(UnityTile tile) + public override void RegisterTile(UnityTile tile) { if (_elevationOptions.unityLayerOptions.addToLayer && tile.gameObject.layer != _elevationOptions.unityLayerOptions.layerId) { @@ -48,10 +35,7 @@ internal override void OnRegistered(UnityTile tile) tile.gameObject.AddComponent(); } - // HACK: This is here in to make the system trigger a finished state. - Progress++; GenerateTerrainMesh(tile); - Progress--; if (_elevationOptions.requiredOptions.addCollider && tile.Collider == null) { @@ -121,9 +105,10 @@ void GenerateTerrainMesh(UnityTile tile) tile.transform.localPosition = Mapbox.Unity.Constants.Math.Vector3Zero; } - internal override void OnUnregistered(UnityTile tile) + public override void UnregisterTile(UnityTile tile) { } } + } \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatSphereTerrainStrategy.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatSphereTerrainStrategy.cs.meta new file mode 100644 index 000000000..fe3959cae --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatSphereTerrainStrategy.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 830e93932f0e72840a1f6d588dce1a4a +timeCreated: 1522755493 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatTerrainFactory.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatTerrainStrategy.cs similarity index 80% rename from sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatTerrainFactory.cs rename to sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatTerrainStrategy.cs index effc4d328..3d498c3e2 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/FlatTerrainFactory.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatTerrainStrategy.cs @@ -1,30 +1,21 @@ -namespace Mapbox.Unity.MeshGeneration.Factories +using System.Collections.Generic; +using UnityEngine; +using Mapbox.Unity.MeshGeneration.Data; +using Mapbox.Unity.Map; +using Mapbox.Unity.Utilities; + +namespace Mapbox.Unity.MeshGeneration.Factories.TerrainStrategies { - using UnityEngine; - using Mapbox.Unity.MeshGeneration.Data; - using Mapbox.Unity.Utilities; - using System.Collections.Generic; - using Mapbox.Unity.Map; - - [CreateAssetMenu(menuName = "Mapbox/Factories/Terrain Factory - Flat")] - public class FlatTerrainFactory : AbstractTileFactory + public class FlatTerrainStrategy : TerrainStrategy { - Mesh _cachedQuad; - [SerializeField] - ElevationLayerProperties _elevationOptions = new ElevationLayerProperties(); - - public override void SetOptions(LayerProperties options) - { - _elevationOptions = (ElevationLayerProperties)options; - } - internal override void OnInitialized() + public override void Initialize(ElevationLayerProperties elOptions) { - + _elevationOptions = elOptions; } - internal override void OnRegistered(UnityTile tile) + public override void RegisterTile(UnityTile tile) { if (_elevationOptions.unityLayerOptions.addToLayer && tile.gameObject.layer != _elevationOptions.unityLayerOptions.layerId) { @@ -55,9 +46,7 @@ internal override void OnRegistered(UnityTile tile) } // HACK: This is here in to make the system trigger a finished state. - Progress++; tile.MeshFilter.sharedMesh = GetQuad(tile, _elevationOptions.sideWallOptions.isActive); - Progress--; if (_elevationOptions.requiredOptions.addCollider && tile.Collider == null) { @@ -65,11 +54,6 @@ internal override void OnRegistered(UnityTile tile) } } - internal override void OnUnregistered(UnityTile tile) - { - - } - private Mesh GetQuad(UnityTile tile, bool buildSide) { if (_cachedQuad != null) @@ -89,10 +73,10 @@ Mesh BuildQuad(UnityTile tile) verts[1] = tile.TileScale * (new Vector3((float)(tile.Rect.Max.x - tile.Rect.Center.x), 0, (float)(tile.Rect.Min.y - tile.Rect.Center.y))); verts[2] = tile.TileScale * ((tile.Rect.Max - tile.Rect.Center).ToVector3xz()); verts[3] = tile.TileScale * (new Vector3((float)(tile.Rect.Min.x - tile.Rect.Center.x), 0, (float)(tile.Rect.Max.y - tile.Rect.Center.y))); - norms[0] = Constants.Math.Vector3Up; - norms[1] = Constants.Math.Vector3Up; - norms[2] = Constants.Math.Vector3Up; - norms[3] = Constants.Math.Vector3Up; + norms[0] = Mapbox.Unity.Constants.Math.Vector3Up; + norms[1] = Mapbox.Unity.Constants.Math.Vector3Up; + norms[2] = Mapbox.Unity.Constants.Math.Vector3Up; + norms[3] = Mapbox.Unity.Constants.Math.Vector3Up; unityMesh.vertices = verts; unityMesh.normals = norms; @@ -123,16 +107,16 @@ private Mesh BuildQuadWithSides(UnityTile tile) verts[1] = tile.TileScale * (new Vector3((float)(tile.Rect.Max.x - tile.Rect.Center.x), 0, (float)(tile.Rect.Min.y - tile.Rect.Center.y))); verts[2] = tile.TileScale * ((tile.Rect.Max - tile.Rect.Center).ToVector3xz()); verts[3] = tile.TileScale * (new Vector3((float)(tile.Rect.Min.x - tile.Rect.Center.x), 0, (float)(tile.Rect.Max.y - tile.Rect.Center.y))); - norms[0] = Constants.Math.Vector3Up; - norms[1] = Constants.Math.Vector3Up; - norms[2] = Constants.Math.Vector3Up; - norms[3] = Constants.Math.Vector3Up; + norms[0] = Mapbox.Unity.Constants.Math.Vector3Up; + norms[1] = Mapbox.Unity.Constants.Math.Vector3Up; + norms[2] = Mapbox.Unity.Constants.Math.Vector3Up; + norms[3] = Mapbox.Unity.Constants.Math.Vector3Up; //verts goes //01 //32 unityMesh.subMeshCount = 2; - Vector3 norm = Constants.Math.Vector3Up; + Vector3 norm = Mapbox.Unity.Constants.Math.Vector3Up; for (int i = 0; i < 4; i++) { verts[4 * (i + 1)] = verts[i]; diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatTerrainStrategy.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatTerrainStrategy.cs.meta new file mode 100644 index 000000000..ebccf8e01 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/FlatTerrainStrategy.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: dc77d6f0c5be2cb49bf8014f58feeb43 +timeCreated: 1522755493 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/LowPolyTerrainFactory.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/LowPolyTerrainStrategy.cs similarity index 82% rename from sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/LowPolyTerrainFactory.cs rename to sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/LowPolyTerrainStrategy.cs index f27d19601..b2dd1a190 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/LowPolyTerrainFactory.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/LowPolyTerrainStrategy.cs @@ -1,28 +1,18 @@ -namespace Mapbox.Unity.MeshGeneration.Factories +using System.Collections.Generic; +using UnityEngine; +using Mapbox.Unity.MeshGeneration.Data; +using Mapbox.Unity.Map; +using Mapbox.Map; +using Mapbox.Utils; + +namespace Mapbox.Unity.MeshGeneration.Factories.TerrainStrategies { - using System.Collections.Generic; - using UnityEngine; - using Mapbox.Map; - using Mapbox.Unity.MeshGeneration.Enums; - using Mapbox.Unity.MeshGeneration.Data; - using Utils; - using Mapbox.Unity.Map; - using System; - - /// - /// Uses Mapbox Terrain api and creates terrain meshes. - /// - [CreateAssetMenu(menuName = "Mapbox/Factories/Terrain Factory - Low Poly")] - public class LowPolyTerrainFactory : AbstractTileFactory + public class LowPolyTerrainStrategy : TerrainStrategy, IElevationBasedTerrainStrategy { - [SerializeField] - ElevationLayerProperties _elevationOptions = new ElevationLayerProperties(); - Mesh _stitchTarget; - protected Dictionary _meshData; + private Mesh _stitchTarget; private MeshData _currentTileMeshData; private MeshData _stitchTargetMeshData; - private List _newVertexList; private List _newNormalList; private List _newUvList; @@ -31,26 +21,10 @@ public class LowPolyTerrainFactory : AbstractTileFactory private int _vertA, _vertB, _vertC; private int _counter; - public string MapId - { - get - { - return _elevationOptions.sourceOptions.layerSource.Id; - } - - set - { - _elevationOptions.sourceOptions.layerSource.Id = value; - } - } - - public override void SetOptions(LayerProperties options) - { - _elevationOptions = (ElevationLayerProperties)options; - } - internal override void OnInitialized() + public override void Initialize(ElevationLayerProperties elOptions) { + _elevationOptions = elOptions; _meshData = new Dictionary(); _currentTileMeshData = new MeshData(); _stitchTargetMeshData = new MeshData(); @@ -61,7 +35,12 @@ internal override void OnInitialized() _newTriangleList = new List(); } - internal override void OnRegistered(UnityTile tile) + public override void UnregisterTile(UnityTile tile) + { + _meshData.Remove(tile.UnwrappedTileId); + } + + public override void RegisterTile(UnityTile tile) { if (_elevationOptions.unityLayerOptions.addToLayer && tile.gameObject.layer != _elevationOptions.unityLayerOptions.layerId) { @@ -85,16 +64,7 @@ internal override void OnRegistered(UnityTile tile) tile.gameObject.AddComponent(); } - CreateTerrainHeight(tile); - } - - /// - /// Method to be called when a tile error has occurred. - /// - /// instance/ - protected override void OnErrorOccurred(TileErrorEventArgs e) - { - base.OnErrorOccurred(e); + GenerateTerrainMesh(tile); } private void CreateBaseMesh(UnityTile tile) @@ -124,13 +94,13 @@ private void CreateBaseMesh(UnityTile tile) _newVertexList.Add(new Vector3(x2, 0, y2)); _newVertexList.Add(new Vector3(x1, 0, y2)); - _newNormalList.Add(Unity.Constants.Math.Vector3Up); - _newNormalList.Add(Unity.Constants.Math.Vector3Up); - _newNormalList.Add(Unity.Constants.Math.Vector3Up); + _newNormalList.Add(Mapbox.Unity.Constants.Math.Vector3Up); + _newNormalList.Add(Mapbox.Unity.Constants.Math.Vector3Up); + _newNormalList.Add(Mapbox.Unity.Constants.Math.Vector3Up); //-- - _newNormalList.Add(Unity.Constants.Math.Vector3Up); - _newNormalList.Add(Unity.Constants.Math.Vector3Up); - _newNormalList.Add(Unity.Constants.Math.Vector3Up); + _newNormalList.Add(Mapbox.Unity.Constants.Math.Vector3Up); + _newNormalList.Add(Mapbox.Unity.Constants.Math.Vector3Up); + _newNormalList.Add(Mapbox.Unity.Constants.Math.Vector3Up); _newUvList.Add(new Vector2(x / cap, 1 - y / cap)); @@ -160,51 +130,6 @@ private void CreateBaseMesh(UnityTile tile) mesh.RecalculateBounds(); } - internal override void OnUnregistered(UnityTile tile) - { - _meshData.Remove(tile.UnwrappedTileId); - } - - /// - /// Creates the non-flat terrain using a height multiplier - /// - /// - // Multiplier for queried height value - private void CreateTerrainHeight(UnityTile tile) - { - tile.HeightDataState = TilePropertyState.Loading; - var pngRasterTile = new RawPngRasterTile(); - - tile.AddTile(pngRasterTile); - Progress++; - - pngRasterTile.Initialize(_fileSource, tile.CanonicalTileId, MapId, () => - { - if (tile == null) - { - return; - } - - if (pngRasterTile.HasError) - { - OnErrorOccurred(new TileErrorEventArgs(tile.CanonicalTileId, pngRasterTile.GetType(), tile, pngRasterTile.Exceptions)); - tile.HeightDataState = TilePropertyState.Error; - - // Handle missing elevation from server (404)! - // TODO: optimize this search! - if (pngRasterTile.ExceptionsAsString.Contains("404")) - { - ResetToFlatMesh(tile); - } - Progress--; - return; - } - - tile.SetHeightData(pngRasterTile.Data, _elevationOptions.requiredOptions.exaggerationFactor, _elevationOptions.modificationOptions.useRelativeHeight); - GenerateTerrainMesh(tile); - Progress--; - }); - } /// /// Creates the non-flat terrain mesh, using a grid by defined resolution (_sampleCount). Vertex order goes right & up. Normals are calculated manually and UV map is fitted/stretched 1-1. @@ -299,7 +224,7 @@ private void ResetToFlatMesh(UnityTile tile) _currentTileMeshData.Vertices[i].x, 0, _currentTileMeshData.Vertices[i].z); - _currentTileMeshData.Normals[i] = Unity.Constants.Math.Vector3Up; + _currentTileMeshData.Normals[i] = Mapbox.Unity.Constants.Math.Vector3Up; } tile.MeshFilter.mesh.SetVertices(_currentTileMeshData.Vertices); diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/LowPolyTerrainStrategy.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/LowPolyTerrainStrategy.cs.meta new file mode 100644 index 000000000..34c188ab2 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/LowPolyTerrainStrategy.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 2e1d75acbfaded5459635c6030b0f915 +timeCreated: 1522755493 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/TerrainStrategy.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/TerrainStrategy.cs new file mode 100644 index 000000000..570ca34dd --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/TerrainStrategy.cs @@ -0,0 +1,35 @@ +using UnityEngine; +using Mapbox.Unity.MeshGeneration.Data; +using System; +using Mapbox.Unity.Map; +using System.Collections.ObjectModel; +using Mapbox.Map; + +namespace Mapbox.Unity.MeshGeneration.Factories.TerrainStrategies +{ + public class TerrainStrategy + { + [SerializeField] + protected ElevationLayerProperties _elevationOptions = new ElevationLayerProperties(); + + public virtual void Initialize(ElevationLayerProperties elOptions) + { + _elevationOptions = elOptions; + } + + public virtual void RegisterTile(UnityTile tile) + { + + } + + public virtual void UnregisterTile(UnityTile tile) + { + + } + + public virtual void DataErrorOccurred(UnityTile tile, TileErrorEventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/TerrainStrategy.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/TerrainStrategy.cs.meta new file mode 100644 index 000000000..149de6769 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainStrategies/TerrainStrategy.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 33b4040c296ec314793ac7182cc3e81c +timeCreated: 1522755493 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainWithSideWallsFactory.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainWithSideWallsFactory.cs.meta deleted file mode 100644 index 61699a0c5..000000000 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/TerrainWithSideWallsFactory.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5632e34628bc2694f867c3f3c77bd796 -timeCreated: 1481718836 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 2ac69ccfbca692443a02f68e1a689694, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/VectorDataFetcher.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/VectorDataFetcher.cs new file mode 100644 index 000000000..d731dfac8 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/VectorDataFetcher.cs @@ -0,0 +1,28 @@ +using Mapbox.Map; +using Mapbox.Unity.Map; +using Mapbox.Unity.MeshGeneration.Data; +using Mapbox.Unity.MeshGeneration.Enums; +using System; +public class VectorDataFetcher : DataFetcher +{ + public Action DataRecieved = (t, s) => { }; + public Action FetchingError = (t, s) => { }; + + //tile here should be totally optional and used only not to have keep a dictionary in terrain factory base + public void FetchVector(CanonicalTileId canonicalTileId, string mapid, UnityTile tile = null, bool useOptimizedStyle = false, Style style = null) + { + var vectorTile = (useOptimizedStyle) ? new VectorTile(style.Id, style.Modified) : new VectorTile(); + tile.AddTile(vectorTile); + vectorTile.Initialize(_fileSource, tile.CanonicalTileId, mapid, () => + { + if (vectorTile.HasError) + { + FetchingError(tile, new TileErrorEventArgs(tile.CanonicalTileId, vectorTile.GetType(), tile, vectorTile.Exceptions)); + tile.VectorDataState = TilePropertyState.Error; + return; + } + + DataRecieved(tile, vectorTile); + }); + } +} diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/VectorDataFetcher.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/VectorDataFetcher.cs.meta new file mode 100644 index 000000000..597604299 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/VectorDataFetcher.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: b666b1dbd8d5d6444a8fc9945c0106ce +timeCreated: 1524487271 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/VectorTileFactory.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/VectorTileFactory.cs index cb0569029..d4d544818 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/VectorTileFactory.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Factories/VectorTileFactory.cs @@ -7,6 +7,7 @@ using Mapbox.Unity.MeshGeneration.Interfaces; using Mapbox.Map; using Mapbox.Unity.Map; + using System; /// /// Vector Tile Factory @@ -25,16 +26,9 @@ //[CreateAssetMenu(menuName = "Mapbox/Factories/Vector Tile Factory")] public class VectorTileFactory : AbstractTileFactory { - //[SerializeField] - //private string _mapId = "mapbox.mapbox-streets-v7"; - - //[NodeEditorElementAttribute("Layer Visalizers")] - //public List Visualizers; - private Dictionary> _layerBuilder; private Dictionary _cachedData = new Dictionary(); - - VectorLayerProperties _properties; + private VectorLayerProperties _properties; public string MapId { get @@ -47,24 +41,47 @@ public string MapId _properties.sourceOptions.Id = value; } } + protected VectorDataFetcher DataFetcher; - - public override void SetOptions(LayerProperties options) - { - _properties = (VectorLayerProperties)options; - } + #region AbstractFactoryOverrides /// /// Set up sublayers using VectorLayerVisualizers. /// - internal override void OnInitialized() + protected override void OnInitialized() { _layerBuilder = new Dictionary>(); _cachedData.Clear(); + DataFetcher = ScriptableObject.CreateInstance(); + DataFetcher.DataRecieved += OnVectorDataRecieved; + DataFetcher.FetchingError += OnDataError; + + foreach (var item in _properties.locationPrefabList) + { + LayerVisualizerBase visualizer = CreateInstance(); + ((LocationPrefabsLayerVisualizer)visualizer).SetProperties((PrefabItemOptions)item, _properties.performanceOptions); + + visualizer.Initialize(); + if (visualizer == null) + { + continue; + } + + if (_layerBuilder.ContainsKey(visualizer.Key)) + { + _layerBuilder[visualizer.Key].Add(visualizer); + } + else + { + _layerBuilder.Add(visualizer.Key, new List() { visualizer }); + } + } + foreach (var sublayer in _properties.vectorSubLayers) { - var visualizer = CreateInstance(); - visualizer.SetProperties(sublayer, _properties.performanceOptions); + //if its of type prefabitemoptions then separate the visualizer type + LayerVisualizerBase visualizer = CreateInstance(); + ((VectorLayerVisualizer)visualizer).SetProperties(sublayer, _properties.performanceOptions); visualizer.Initialize(); if (visualizer == null) @@ -83,11 +100,13 @@ internal override void OnInitialized() } } - internal override void OnRegistered(UnityTile tile) + public override void SetOptions(LayerProperties options) { - var vectorTile = (_properties.useOptimizedStyle) ? new VectorTile(_properties.optimizedStyle.Id, _properties.optimizedStyle.Modified) : new VectorTile(); - tile.AddTile(vectorTile); + _properties = (VectorLayerProperties)options; + } + protected override void OnRegistered(UnityTile tile) + { if (string.IsNullOrEmpty(MapId) || _properties.sourceOptions.isActive == false || _properties.vectorSubLayers.Count == 0) { // Do nothing; @@ -96,45 +115,9 @@ internal override void OnRegistered(UnityTile tile) } else { - vectorTile.Initialize(_fileSource, tile.CanonicalTileId, MapId, () => - { - if (tile == null) - { - Progress++; - Progress--; - return; - } - - if (vectorTile.HasError) - { - OnErrorOccurred(new TileErrorEventArgs(tile.CanonicalTileId, vectorTile.GetType(), tile, vectorTile.Exceptions)); - tile.VectorDataState = TilePropertyState.Error; - Progress++; - Progress--; - return; - } - - if (_cachedData.ContainsKey(tile)) - { - _cachedData[tile] = vectorTile; - } - else - { - _cachedData.Add(tile, vectorTile); - } - - // FIXME: we can make the request BEFORE getting a response from these! - if (tile.HeightDataState == TilePropertyState.Loading || - tile.RasterDataState == TilePropertyState.Loading) - { - tile.OnHeightDataChanged += DataChangedHandler; - tile.OnRasterDataChanged += DataChangedHandler; - } - else - { - CreateMeshes(tile); - } - }); + tile.VectorDataState = TilePropertyState.Loading; + Progress++; + DataFetcher.FetchVector(tile.CanonicalTileId, MapId, tile, _properties.useOptimizedStyle, _properties.optimizedStyle); } } @@ -147,7 +130,7 @@ protected override void OnErrorOccurred(TileErrorEventArgs e) base.OnErrorOccurred(e); } - internal override void OnUnregistered(UnityTile tile) + protected override void OnUnregistered(UnityTile tile) { // We are no longer interested in this tile's notifications. tile.OnHeightDataChanged -= DataChangedHandler; @@ -170,7 +153,51 @@ internal override void OnUnregistered(UnityTile tile) } } } + #endregion + + + #region DataFetcherEvents + private void OnVectorDataRecieved(UnityTile tile, VectorTile vectorTile) + { + Progress--; + if (_cachedData.ContainsKey(tile)) + { + _cachedData[tile] = vectorTile; + } + else + { + _cachedData.Add(tile, vectorTile); + } + + // FIXME: we can make the request BEFORE getting a response from these! + if (tile.HeightDataState == TilePropertyState.Loading || + tile.RasterDataState == TilePropertyState.Loading) + { + tile.OnHeightDataChanged += DataChangedHandler; + tile.OnRasterDataChanged += DataChangedHandler; + } + else + { + CreateMeshes(tile); + } + } + + private void OnDataError(UnityTile tile, TileErrorEventArgs e) + { + if (tile != null) + { + Progress--; + tile.VectorDataState = TilePropertyState.Error; + } + } + + #endregion + + /// + /// Vector Factory runs after Raster&Height data recieved and processed + /// + /// private void DataChangedHandler(UnityTile t) { if (t.RasterDataState != TilePropertyState.Loading && @@ -208,6 +235,21 @@ private void CreateMeshes(UnityTile tile) } } + //emptylayer for visualizers that don't depend on outside data sources + string emptyLayer = ""; + if (_layerBuilder.ContainsKey(emptyLayer)) + { + foreach (var builder in _layerBuilder[emptyLayer]) + { + if (builder.Active) + { + Progress++; + //just pass the first available layer - we should create a static null layer for this + builder.Create(_cachedData[tile].Data.GetLayer(_cachedData[tile].Data.LayerNames()[0]), tile, DecreaseProgressCounter); + } + } + } + tile.VectorDataState = TilePropertyState.Loaded; _cachedData.Remove(tile); } diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Filters/TypeFilter.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Filters/TypeFilter.cs index 26f602628..9594569ad 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Filters/TypeFilter.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Filters/TypeFilter.cs @@ -278,7 +278,14 @@ public class LayerPropertyContainsFilterComparer : LayerHasPropertyFilterCompare protected override bool PropertyComparer(object property) { - return ValueSet.Contains(property.ToString().ToLower()); + foreach (var value in ValueSet) + { + if (property.ToString().ToLower().Contains(value.ToString())) + { + return true; + } + } + return false; } } @@ -287,6 +294,9 @@ public class LayerFilter { [Tooltip("Name of the property to use as key. This property is case sensitive.")] public string Key; + [SerializeField] + [Tooltip("Description of the property defined as key.")] + private string KeyDescription; [Tooltip("Value to match using the operator. ")] public string PropertyValue = string.Empty; [Tooltip("Value to match using the operator. ")] diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/LayerVisualizers/LocationPrefabsLayerVisualizer.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/LayerVisualizers/LocationPrefabsLayerVisualizer.cs new file mode 100644 index 000000000..6c97b03d0 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/LayerVisualizers/LocationPrefabsLayerVisualizer.cs @@ -0,0 +1,314 @@ +namespace Mapbox.Unity.MeshGeneration.Interfaces +{ + using System; + using System.Collections.Generic; + using Mapbox.Unity.Utilities; + using Mapbox.Unity.MeshGeneration.Filters; + using UnityEngine; + using Mapbox.Unity.MeshGeneration.Modifiers; + using Mapbox.Unity.MeshGeneration.Data; + using Mapbox.Unity.Map; + using Mapbox.VectorTile; + + public class LocationPrefabsLayerVisualizer : VectorLayerVisualizer + { + private int maxDensity = 30; //This value is same as the density's max range value in PrefabItemOptions + + public void SetProperties(PrefabItemOptions item, LayerPerformanceOptions performanceOptions) + { + SubLayerProperties = item; + Active = item.isActive; + _performanceOptions = performanceOptions; + + + //Check to make sure that when Categories selection is none, the location prefab is disabled + if (item.findByType == LocationPrefabFindBy.MapboxCategory && item.categories == LocationPrefabCategories.None) + { + return; + } + + if(item.spawnPrefabOptions.prefab==null) + { + Debug.LogError("No prefab found. Please assign a prefab to spawn it on the map"); + } + + //These are fixed properties + item.coreOptions.geometryType = item.primitiveType; + item.extrusionOptions = new GeometryExtrusionOptions + { + extrusionType = item.extrusionType + }; + + + item.coreOptions.groupFeatures = item.groupFeatures; + item.moveFeaturePositionTo = item._movePrefabFeaturePositionTo; + + + string layerName = ""; + if (item.layerNameFromFindByTypeDictionary.TryGetValue(item.findByType, out layerName)) + { + item.coreOptions.layerName = layerName; + base.Key = layerName; + } + + //These properties are dependent on user choices + if (item.findByType != LocationPrefabFindBy.AddressOrLatLon) + { + if(item.findByType == LocationPrefabFindBy.MapboxCategory) + { + SetCategoryFilterOptions(item); + } + if(item.findByType == LocationPrefabFindBy.POIName) + { + SetNameFilters(item); + } + + SetDensityFilters(item); + } + + switch (item.coreOptions.geometryType) + { + case VectorPrimitiveType.Point: + if (typeof(PrefabItemOptions).IsAssignableFrom(item.GetType())) //to check that the instance is of type PrefabItemOptions + { + var itemProperties = (PrefabItemOptions)item; + var prefabModifier = ScriptableObject.CreateInstance(); + prefabModifier.SetProperties(itemProperties.spawnPrefabOptions); + _defaultStack = ScriptableObject.CreateInstance(); + if (_defaultStack.GoModifiers == null) + { + _defaultStack.GoModifiers = new List(); + } + _defaultStack.GoModifiers.Add(prefabModifier); + + if( itemProperties.snapToTerrain == true ) + { + _defaultStack.MeshModifiers.Add(ScriptableObject.CreateInstance()); + } + + } + break; + default: + break; + } + } + + /// + /// Sets the category filter options. + /// + /// Item. + private void SetCategoryFilterOptions(PrefabItemOptions item) + { + string propertyName = ""; + item.categoryPropertyFromFindByTypeDictionary.TryGetValue(item.findByType, out propertyName); + + if (item.findByType == LocationPrefabFindBy.MapboxCategory) + { + List categoriesList = GetSelectedCategoriesList(item.categories); + if (categoriesList == null || categoriesList.Count==0) + return; + + List stringsList = new List(); + var concatenatedString = ""; + + foreach (var category in categoriesList) + { + stringsList = LocationPrefabCategoryOptions.GetMakiListFromCategory(category); + if(string.IsNullOrEmpty(concatenatedString)) + concatenatedString = string.Join(",", stringsList.ToArray()); + else + concatenatedString += "," + string.Join(",", stringsList.ToArray()); + } + + LayerFilter filter = new LayerFilter(LayerFilterOperationType.Contains) + { + Key = propertyName, + PropertyValue = concatenatedString + }; + AddFilterToItem(item, filter); + } + } + + /// + /// Sets the density filters. + /// + /// Item. + private void SetDensityFilters(PrefabItemOptions item) + { + if (item.density >= maxDensity) // decided that the max value for density + return; + + string propertyName = ""; + item.densityPropertyFromFindByTypeDictionary.TryGetValue(item.findByType, out propertyName); + + if (item.findByType == LocationPrefabFindBy.MapboxCategory || item.findByType == LocationPrefabFindBy.POIName) + { + LayerFilter filter = new LayerFilter(LayerFilterOperationType.IsLess) + { + Key = propertyName, + Min = item.density + }; + AddFilterToItem(item, filter); + } + } + + /// + /// Sets the name filters. + /// + /// Item. + private void SetNameFilters(PrefabItemOptions item) + { + if (string.IsNullOrEmpty(item.nameString)) + return; + + string propertyName = ""; + item.namePropertyFromFindByTypeDictionary.TryGetValue(item.findByType, out propertyName); + + if (item.findByType == LocationPrefabFindBy.POIName) + { + LayerFilter filter = new LayerFilter(LayerFilterOperationType.Contains) + { + Key = propertyName, + PropertyValue = item.nameString + }; + AddFilterToItem(item, filter); + } + } + + /// + /// Merges the filters with item filters. + /// + /// Item. + void AddFilterToItem(PrefabItemOptions item, LayerFilter filter) + { + if (item.filterOptions == null) + { + item.filterOptions = new VectorFilterOptions(); + } + + item.filterOptions.filters.Add(filter); + item.filterOptions.combinerType = item._combinerType; + + } + + /// + /// Gets the list of categories selected through the dropdown + /// + /// The selected categories list. + /// Cat. + private List GetSelectedCategoriesList(LocationPrefabCategories selectedCategories) + { + List containingCategories = new List(); + + var eligibleValues = Enum.GetValues(typeof(LocationPrefabCategories)); + if (selectedCategories == LocationPrefabCategories.None || selectedCategories == LocationPrefabCategories.AnyCategory) + { + return containingCategories; + } + + //For any other categories other than None and Any + foreach(var value in eligibleValues) + { + var category = (LocationPrefabCategories)value; + + if (category == LocationPrefabCategories.AnyCategory || category==LocationPrefabCategories.None) + continue; + + if((category & selectedCategories) != 0) //to check if category is contained in cat + { + containingCategories.Add(category); + } + } + + return containingCategories; + } + + public override void Create(VectorTileLayer layer, UnityTile tile, Action callback) + { + //for layers using specific locations, ignore VectorTileLayer and + //pass coordinates to the modifierstack using BuildFeatureFromLatLon. + if( (SubLayerProperties as PrefabItemOptions).findByType + == LocationPrefabFindBy.AddressOrLatLon) + { + BuildFeatureFromLatLon(layer, tile); + if (callback != null) + { + callback(); + } + } + else + { + base.Create(layer, tile, callback); + + } + + } + + + /// + /// Creates a vector feature from lat lon and builds that feature using the modifier stack. + /// + /// Layer. + /// Tile. + private void BuildFeatureFromLatLon(VectorTileLayer layer, UnityTile tile) + { + var coordinates = (SubLayerProperties as PrefabItemOptions).coordinates; + + for (int i = 0; i < coordinates.Length; i++) + { + if(String.IsNullOrEmpty(coordinates[i])) + { + return; + } + + //check if the coordinate is in the tile + var coordinate = Conversions.StringToLatLon( coordinates[i] ); + var coordinateTileId = Conversions.LatitudeLongitudeToTileId( + coordinate.x, coordinate.y, tile.InitialZoom); + + if( coordinateTileId.Canonical.Equals(tile.CanonicalTileId)) + { + + //create new vector feature + var feature = new VectorFeatureUnity(); + feature.Properties = new Dictionary(); + feature.Points = new List>(); + + //create a point in tilespace from coordinates + var latLonPoint = new List(); + + //Create a feature point based on the coordinate + var _meters = Conversions.LatLonToMeters(coordinate); + var _rect = tile.Rect; + var _scale = tile.TileScale; + var _extent = layer.Extent; + + //vectortile space point (0 - layerExtent) + var point = new Vector3((float)((_meters - _rect.Min).x / _rect.Size.x) * _extent, + 0, + (float)((_meters - _rect.Max).y / _rect.Size.y) * _extent + ); + + //UnityTile space + latLonPoint.Add(new Vector3((float)(point.x / _extent * _rect.Size.x - (_rect.Size.x / 2)) * tile.TileScale, + 0, + (float)((point.z) / _extent * _rect.Size.y - (_rect.Size.y / 2)) * tile.TileScale + )); + + //add coordinate feature to feature points + feature.Points.Add(latLonPoint); + + //pass valid feature.Data to modifiers + //this data has no relation to the features being drawn + feature.Data = layer.GetFeature(0); + + //pass the feature to the mod stack + base.Build(feature, tile, tile.gameObject); + + } + + } + } + + } +} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/LayerVisualizers/LocationPrefabsLayerVisualizer.cs.meta b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/LayerVisualizers/LocationPrefabsLayerVisualizer.cs.meta new file mode 100644 index 000000000..233bd4213 --- /dev/null +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/LayerVisualizers/LocationPrefabsLayerVisualizer.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: b250e20966143455d807eddf832c7362 +timeCreated: 1524037447 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/LayerVisualizers/VectorLayerVisualizer.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/LayerVisualizers/VectorLayerVisualizer.cs index 584cc18d6..b3967e4ff 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/LayerVisualizers/VectorLayerVisualizer.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/LayerVisualizers/VectorLayerVisualizer.cs @@ -14,14 +14,37 @@ public class VectorLayerVisualizer : LayerVisualizerBase { VectorSubLayerProperties _layerProperties; - LayerPerformanceOptions _performanceOptions; - private Dictionary> _activeCoroutines; + public VectorSubLayerProperties SubLayerProperties + { + get + { + return _layerProperties; + } + set + { + _layerProperties = value; + } + } + + public ModifierStackBase DefaultModifierStack + { + get + { + return _defaultStack; + } + set + { + _defaultStack = value; + } + } + + protected LayerPerformanceOptions _performanceOptions; + protected Dictionary> _activeCoroutines; int _entityInCurrentCoroutine = 0; - ModifierStackBase _defaultStack; + protected ModifierStackBase _defaultStack; private HashSet _activeIds; private Dictionary> _idPool; //necessary to keep _activeIds list up to date when unloading tiles - private string _key; public override string Key @@ -29,11 +52,11 @@ public override string Key get { return _layerProperties.coreOptions.layerName; } set { _layerProperties.coreOptions.layerName = value; } } + public void SetProperties(VectorSubLayerProperties properties, LayerPerformanceOptions performanceOptions) { List defaultMeshModifierStack = new List(); - List defaultGOModifierStack = new List(); - + List defaultGOModifierStack = new List(); _layerProperties = properties; _performanceOptions = performanceOptions; @@ -154,10 +177,8 @@ public void SetProperties(VectorSubLayerProperties properties, LayerPerformanceO //Add any additional modifiers that were added. _defaultStack.MeshModifiers.AddRange(_layerProperties.MeshModifiers); _defaultStack.GoModifiers.AddRange(_layerProperties.GoModifiers); - } - public override void Initialize() { base.Initialize(); @@ -257,7 +278,7 @@ private IEnumerator ProcessLayer(VectorTileLayer layer, UnityTile tile, Action c } } - if (_performanceOptions.isEnabled && _entityInCurrentCoroutine >= _performanceOptions.entityPerCoroutine) + if (_performanceOptions!=null && _performanceOptions.isEnabled && _entityInCurrentCoroutine >= _performanceOptions.entityPerCoroutine) { _entityInCurrentCoroutine = 0; yield return null; @@ -291,7 +312,7 @@ private bool IsFeatureValid(VectorFeatureUnity feature) return true; } - private void Build(VectorFeatureUnity feature, UnityTile tile, GameObject parent) + protected void Build(VectorFeatureUnity feature, UnityTile tile, GameObject parent) { if (feature.Properties.ContainsKey("extrude") && !Convert.ToBoolean(feature.Properties["extrude"])) return; @@ -300,7 +321,7 @@ private void Build(VectorFeatureUnity feature, UnityTile tile, GameObject parent return; //this will be improved in next version and will probably be replaced by filters - var styleSelectorKey = FindSelectorKey(feature); + var styleSelectorKey = _layerProperties.coreOptions.sublayerName; var meshData = new MeshData(); meshData.TileRect = tile.Rect; diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/GameObjectModifiers/ColliderModifier.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/GameObjectModifiers/ColliderModifier.cs index c087067af..9251c28bf 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/GameObjectModifiers/ColliderModifier.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/GameObjectModifiers/ColliderModifier.cs @@ -14,6 +14,7 @@ public class ColliderModifier : GameObjectModifier //private ColliderType _colliderType; private IColliderStrategy _colliderStrategy; + [SerializeField] ColliderOptions _options; public override void SetProperties(ModifierProperties properties) diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/GameObjectModifiers/PrefabModifier.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/GameObjectModifiers/PrefabModifier.cs index a1ad6d741..1c0fa7d68 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/GameObjectModifiers/PrefabModifier.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/GameObjectModifiers/PrefabModifier.cs @@ -5,17 +5,22 @@ namespace Mapbox.Unity.MeshGeneration.Modifiers using Mapbox.Unity.MeshGeneration.Components; using Mapbox.Unity.MeshGeneration.Interfaces; using System.Collections.Generic; + using Mapbox.Unity.Map; + using System; [CreateAssetMenu(menuName = "Mapbox/Modifiers/Prefab Modifier")] public class PrefabModifier : GameObjectModifier { - [SerializeField] - private GameObject _prefab; + //[SerializeField] + //private GameObject _prefab; - [SerializeField] - private bool _scaleDownWithWorld = false; + //[SerializeField] + //private bool _scaleDownWithWorld = false; private Dictionary _objects; + [SerializeField] + private SpawnPrefabOptions _options; + private List _prefabList = new List(); public override void Initialize() { @@ -25,11 +30,16 @@ public override void Initialize() } } + public override void SetProperties(ModifierProperties properties) + { + _options = (SpawnPrefabOptions)properties; + } + public override void Run(VectorEntity ve, UnityTile tile) { int selpos = ve.Feature.Points[0].Count / 2; var met = ve.Feature.Points[0][selpos]; - + RectTransform goRectTransform; IFeaturePropertySettable settable = null; GameObject go; @@ -44,23 +54,42 @@ public override void Run(VectorEntity ve, UnityTile tile) } // set gameObject transform go.name = ve.Feature.Data.Id.ToString(); - go.transform.localPosition = met; - go.transform.localScale = Constants.Math.Vector3One; + goRectTransform = go.GetComponent(); + if (goRectTransform == null) + { + go.transform.localPosition = met; + } + else + { + goRectTransform.anchoredPosition3D = met; + } + - if (!_scaleDownWithWorld) + if (!_options.scaleDownWithWorld) { - go.transform.localScale = Vector3.one / tile.TileScale; + go.transform.localScale = (go.transform.localScale * (1.0f / tile.TileScale)); } return; } else { - go = Instantiate(_prefab); + go = Instantiate(_options.prefab); + _prefabList.Add(go); _objects.Add(ve.GameObject, go); } go.name = ve.Feature.Data.Id.ToString(); - go.transform.position = met; + + goRectTransform = go.GetComponent(); + if (goRectTransform == null) + { + go.transform.localPosition = met; + } + else + { + goRectTransform.anchoredPosition3D = met; + } + go.transform.SetParent(ve.GameObject.transform, false); go.transform.localScale = Constants.Math.Vector3One; @@ -70,11 +99,20 @@ public override void Run(VectorEntity ve, UnityTile tile) settable.Set(ve.Feature.Properties); } - if (!_scaleDownWithWorld) + if (!_options.scaleDownWithWorld) + { + go.transform.localScale = (go.transform.localScale * (1.0f / tile.TileScale)); + } + + if (_options.AllPrefabsInstatiated != null) { - go.transform.localScale = Vector3.one / tile.TileScale; + _options.AllPrefabsInstatiated(_prefabList); } + } + public List returnInstanceList() + { + return _prefabList; } } } diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MergedModifierStack.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MergedModifierStack.cs index 21aa9c2c4..a904a88d2 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MergedModifierStack.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MergedModifierStack.cs @@ -36,7 +36,7 @@ public class MergedModifierStack : ModifierStackBase private int _counter, _counter2; - private void OnEnable() + protected virtual void OnEnable() { //we'll use this to concat building data until it reaches 65000 verts _pool = new ObjectPool(() => diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MeshModifiers/HeightModifier.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MeshModifiers/HeightModifier.cs index 9026f3ad3..827f2ef58 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MeshModifiers/HeightModifier.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MeshModifiers/HeightModifier.cs @@ -230,7 +230,16 @@ protected virtual void QueryHeight(VectorFeatureUnity feature, MeshData md, Unit case ExtrusionType.MaxHeight: if (feature.Properties.ContainsKey(_options.propertyName)) { - maxHeight = Convert.ToSingle(feature.Properties[_options.propertyName]); + try + { + maxHeight = Convert.ToSingle(feature.Properties[_options.propertyName]); + } + catch (Exception) + { + Debug.LogError("Property: '" + _options.propertyName + "' must contain a numerical value for extrusion."); + return; + } + if (feature.Properties.ContainsKey("min_height")) { minHeight = Convert.ToSingle(feature.Properties["min_height"]); @@ -248,7 +257,18 @@ protected virtual void QueryHeight(VectorFeatureUnity feature, MeshData md, Unit _options.minimumHeight = _options.maximumHeight; _options.maximumHeight = temp; } - var featureHeight = Convert.ToSingle(feature.Properties[_options.propertyName]); + + float featureHeight; + try + { + featureHeight = Convert.ToSingle(feature.Properties[_options.propertyName]); + } + catch (Exception) + { + Debug.LogError("Property: '" + _options.propertyName + "' must contain a numerical value for extrusion."); + return; + } + maxHeight = Math.Min(Math.Max(_options.minimumHeight, featureHeight), _options.maximumHeight); if (feature.Properties.ContainsKey("min_height")) { diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MeshModifiers/LineMeshModifier.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MeshModifiers/LineMeshModifier.cs index ae2c2d73c..a407a742f 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MeshModifiers/LineMeshModifier.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MeshModifiers/LineMeshModifier.cs @@ -17,7 +17,7 @@ public class LineMeshModifier : MeshModifier private float _scaledWidth; public override ModifierType Type { get { return ModifierType.Preprocess; } } - private void OnEnable() + protected virtual void OnEnable() { _scaledWidth = Width; } diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/ModifierStack.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/ModifierStack.cs index c53f0abe5..8f137481b 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/ModifierStack.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/ModifierStack.cs @@ -51,7 +51,7 @@ public class ModifierStack : ModifierStackBase [NonSerialized] private int _counter; [NonSerialized] private int _secondCounter; - private void OnEnable() + protected virtual void OnEnable() { _pool = new ObjectPool(() => { @@ -181,14 +181,22 @@ public override GameObject Execute(UnityTile tile, VectorFeatureUnity feature, M _tempVectorEntity.Feature = feature; #if UNITY_EDITOR - _tempVectorEntity.GameObject.name = type + " - " + feature.Data.Id; + if (feature.Data != null) + { + _tempVectorEntity.GameObject.name = type + " - " + feature.Data.Id; + } + else + { + _tempVectorEntity.GameObject.name = type; + } #endif _tempVectorEntity.Mesh.subMeshCount = meshData.Triangles.Count; _tempVectorEntity.Mesh.SetVertices(meshData.Vertices); _tempVectorEntity.Mesh.SetNormals(meshData.Normals); if (meshData.Tangents.Count > 0) + { _tempVectorEntity.Mesh.SetTangents(meshData.Tangents); - + } _counter = meshData.Triangles.Count; for (int i = 0; i < _counter; i++) diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/ModifierStackBase.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/ModifierStackBase.cs index 8c581b552..5a280b8ea 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/ModifierStackBase.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/ModifierStackBase.cs @@ -10,8 +10,8 @@ namespace Mapbox.Unity.MeshGeneration.Modifiers { public class ModifierStackBase : ScriptableObject { - [NodeEditorElement("Mesh Modifiers")] public List MeshModifiers; - [NodeEditorElement("Game Object Modifiers")] public List GoModifiers; + [NodeEditorElement("Mesh Modifiers")] public List MeshModifiers = new List(); + [NodeEditorElement("Game Object Modifiers")] public List GoModifiers = new List(); public virtual GameObject Execute(UnityTile tile, VectorFeatureUnity feature, MeshData meshData, GameObject parent = null, string type = "") { diff --git a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/TextureSideWallModifier.cs b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/TextureSideWallModifier.cs index a691c202c..66aa91b9a 100644 --- a/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/TextureSideWallModifier.cs +++ b/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/TextureSideWallModifier.cs @@ -48,7 +48,8 @@ public class TextureSideWallModifier : MeshModifier private float rightOfEdgeUv; private float bottomOfTopUv; private float topOfBottomUv; - private float currentY; + private float currentY1; + private float currentY2; private float bottomOfMidUv; private float topOfMidUv; @@ -143,7 +144,8 @@ public override void Run(VectorFeatureUnity feature, MeshData md, UnityTile tile topOfBottomUv = _currentTextureRect.yMin + (_currentTextureRect.size.y * _currentFacade.BottomSectionRatio); // * (Mathf.Max(1, (float)Math.Floor(tby * textureSection.TopSectionFloorCount)) / textureSection.TopSectionFloorCount); wallNormal = new Vector3(-(v1.z - v2.z), 0, (v1.x - v2.x)).normalized; - currentY = v1.y; + currentY1 = v1.y; + currentY2 = v2.y; floorScaleRatio = Math.Min(1, midHeight / _scaledFloorHeight); var midSecHeight = (_currentTextureRect.height * (1 - _currentFacade.TopSectionRatio - _currentFacade.BottomSectionRatio)); @@ -172,12 +174,13 @@ private void MidFloors(MeshData md) { for (int f = 0; f < floorCount; f++) { - currentY -= scaledFloorHeight; + currentY1 -= scaledFloorHeight; + currentY2 -= scaledFloorHeight; - md.Vertices.Add(new Vector3(v1.x, currentY + scaledFloorHeight, v1.z)); - md.Vertices.Add(new Vector3(v2.x, currentY + scaledFloorHeight, v2.z)); - md.Vertices.Add(new Vector3(v1.x, currentY, v1.z)); - md.Vertices.Add(new Vector3(v2.x, currentY, v2.z)); + md.Vertices.Add(new Vector3(v1.x, currentY1 + scaledFloorHeight, v1.z)); + md.Vertices.Add(new Vector3(v2.x, currentY2 + scaledFloorHeight, v2.z)); + md.Vertices.Add(new Vector3(v1.x, currentY1, v1.z)); + md.Vertices.Add(new Vector3(v2.x, currentY2, v2.z)); md.UV[0].Add(new Vector2(_currentTextureRect.xMin, topOfMidUv)); md.UV[0].Add(new Vector2(rightOfEdgeUv, topOfMidUv)); @@ -208,7 +211,8 @@ private void MidFloors(MeshData md) private void TopFloor(MeshData md) { - currentY -= topHeight; + currentY1 -= topHeight; + currentY2 -= topHeight; md.Vertices.Add(new Vector3(v1.x, v1.y, v1.z)); md.Vertices.Add(new Vector3(v2.x, v2.y, v2.z)); md.Vertices.Add(new Vector3(v1.x, v1.y - topHeight, v1.z)); @@ -373,7 +377,7 @@ private void GenerateRoofMesh(MeshData md, float minHeight, float maxHeight) } } - private void QueryHeight(VectorFeatureUnity feature, MeshData md, UnityTile tile, out float maxHeight, out float minHeight) + protected virtual void QueryHeight(VectorFeatureUnity feature, MeshData md, UnityTile tile, out float maxHeight, out float minHeight) { minHeight = 0.0f; maxHeight = 0.0f; @@ -387,11 +391,20 @@ private void QueryHeight(VectorFeatureUnity feature, MeshData md, UnityTile tile case ExtrusionType.MaxHeight: if (feature.Properties.ContainsKey(_options.propertyName)) { - maxHeight = Convert.ToSingle(feature.Properties[_options.propertyName]); + try + { + maxHeight = Convert.ToSingle(feature.Properties[_options.propertyName]); + } + catch (Exception) + { + Debug.LogError("Property: '" + _options.propertyName + "' must contain a numerical value for extrusion."); + return; + } + if (feature.Properties.ContainsKey("min_height")) { minHeight = Convert.ToSingle(feature.Properties["min_height"]); - //hf -= minHeight; + //maxHeight -= minHeight; } } break; @@ -405,13 +418,23 @@ private void QueryHeight(VectorFeatureUnity feature, MeshData md, UnityTile tile _options.minimumHeight = _options.maximumHeight; _options.maximumHeight = temp; } - var featureHeight = Convert.ToSingle(feature.Properties[_options.propertyName]); + + float featureHeight; + try + { + featureHeight = Convert.ToSingle(feature.Properties[_options.propertyName]); + } + catch (Exception) + { + Debug.LogError("Property: '" + _options.propertyName + "' must contain a numerical value for extrusion."); + return; + } + maxHeight = Math.Min(Math.Max(_options.minimumHeight, featureHeight), _options.maximumHeight); if (feature.Properties.ContainsKey("min_height")) { var featureMinHeight = Convert.ToSingle(feature.Properties["min_height"]); minHeight = Math.Min(featureMinHeight, _options.maximumHeight); - //maxHeight -= minHeight; } } break; diff --git a/sdkproject/Assets/Mapbox/Unity/SourceLayers/TerrainLayer.cs b/sdkproject/Assets/Mapbox/Unity/SourceLayers/TerrainLayer.cs index 32d112916..d2bcc7693 100644 --- a/sdkproject/Assets/Mapbox/Unity/SourceLayers/TerrainLayer.cs +++ b/sdkproject/Assets/Mapbox/Unity/SourceLayers/TerrainLayer.cs @@ -4,6 +4,7 @@ using UnityEngine; using Mapbox.Unity.MeshGeneration.Factories; using Mapbox.Unity.Utilities; + using Mapbox.Unity.MeshGeneration.Factories.TerrainStrategies; // Layer Concrete Implementation. [Serializable] @@ -123,30 +124,32 @@ public void Initialize(LayerProperties properties) public void Initialize() { + _elevationFactory = ScriptableObject.CreateInstance(); switch (_layerProperty.elevationLayerType) { case ElevationLayerType.FlatTerrain: - _elevationFactory = ScriptableObject.CreateInstance(); + _elevationFactory.Strategy = new FlatTerrainStrategy(); break; case ElevationLayerType.LowPolygonTerrain: - _elevationFactory = ScriptableObject.CreateInstance(); + _elevationFactory.Strategy = new LowPolyTerrainStrategy(); break; case ElevationLayerType.TerrainWithElevation: if (_layerProperty.sideWallOptions.isActive) { - _elevationFactory = ScriptableObject.CreateInstance(); + _elevationFactory.Strategy = new ElevatedTerrainWithSidesStrategy(); } else { - _elevationFactory = ScriptableObject.CreateInstance(); + _elevationFactory.Strategy = new ElevatedTerrainStrategy(); } break; case ElevationLayerType.GlobeTerrain: - _elevationFactory = ScriptableObject.CreateInstance(); + _elevationFactory.Strategy = new FlatSphereTerrainStrategy(); break; default: break; } + _elevationFactory.SetOptions(_layerProperty); } @@ -169,7 +172,7 @@ public AbstractTileFactory Factory return _elevationFactory; } } - private AbstractTileFactory _elevationFactory; + private TerrainFactoryBase _elevationFactory; } } diff --git a/sdkproject/Assets/Mapbox/Unity/SourceLayers/VectorLayer.cs b/sdkproject/Assets/Mapbox/Unity/SourceLayers/VectorLayer.cs index c7717ef21..5c1ed3f27 100644 --- a/sdkproject/Assets/Mapbox/Unity/SourceLayers/VectorLayer.cs +++ b/sdkproject/Assets/Mapbox/Unity/SourceLayers/VectorLayer.cs @@ -20,6 +20,7 @@ public VectorLayerProperties LayerProperty return _layerProperty; } } + public MapLayerType LayerType { get @@ -71,6 +72,27 @@ public void SetLayerSource(string vectorSource) } } + public void AddLayerSource(string vectorSource) + { + if (!string.IsNullOrEmpty(vectorSource)) + { + if (!_layerProperty.sourceOptions.Id.Contains(vectorSource)) + { + if (string.IsNullOrEmpty(_layerProperty.sourceOptions.Id)) + { + SetLayerSource(vectorSource); + return; + } + var newLayerSource = _layerProperty.sourceOptions.Id + "," + vectorSource; + SetLayerSource(newLayerSource); + } + } + else + { + Debug.LogError("Empty source. Nothing was added to the list of data sources"); + } + } + public void AddVectorLayer(VectorSubLayerProperties subLayerProperties) { if (_layerProperty.vectorSubLayers == null) @@ -80,6 +102,21 @@ public void AddVectorLayer(VectorSubLayerProperties subLayerProperties) _layerProperty.vectorSubLayers.Add(subLayerProperties); } + public void AddLocationPrefabItem(PrefabItemOptions prefabItem) + { + //ensure that there is a list of prefabitems + if (PointsOfInterestSublayerList == null) + { + PointsOfInterestSublayerList = new List(); + } + + //add the prefab item if it doesn't already exist + if (!PointsOfInterestSublayerList.Contains(prefabItem)) + { + PointsOfInterestSublayerList.Add(prefabItem); + } + } + public void RemoveVectorLayer(int index) { if (_layerProperty.vectorSubLayers != null) @@ -88,6 +125,15 @@ public void RemoveVectorLayer(int index) } } + public void RemovePrefabItem(int index) + { + if (PointsOfInterestSublayerList != null) + { + PointsOfInterestSublayerList.RemoveAt(index); + } + } + + public void Initialize(LayerProperties properties) { _layerProperty = (VectorLayerProperties)properties; @@ -121,5 +167,17 @@ public VectorTileFactory Factory } } private VectorTileFactory _vectorTileFactory; + + public List PointsOfInterestSublayerList + { + get + { + return _layerProperty.locationPrefabList; + } + set + { + _layerProperty.locationPrefabList = value; + } + } } -} +} \ No newline at end of file diff --git a/sdkproject/Assets/Mapbox/Unity/Utilities/Console.cs b/sdkproject/Assets/Mapbox/Unity/Utilities/Console.cs index 1da712242..02d171a8a 100644 --- a/sdkproject/Assets/Mapbox/Unity/Utilities/Console.cs +++ b/sdkproject/Assets/Mapbox/Unity/Utilities/Console.cs @@ -23,7 +23,7 @@ public class Console : MonoBehaviour string _log; - void Awake() + protected virtual void Awake() { if (_instance != null) { diff --git a/sdkproject/Assets/Mapbox/Unity/Utilities/DontDestroyOnLoad.cs b/sdkproject/Assets/Mapbox/Unity/Utilities/DontDestroyOnLoad.cs index 317ac21d3..09c0293e0 100644 --- a/sdkproject/Assets/Mapbox/Unity/Utilities/DontDestroyOnLoad.cs +++ b/sdkproject/Assets/Mapbox/Unity/Utilities/DontDestroyOnLoad.cs @@ -9,7 +9,7 @@ public class DontDestroyOnLoad : MonoBehaviour [SerializeField] bool _useSingleInstance; - void Awake() + protected virtual void Awake() { if (_instance != null && _useSingleInstance) { diff --git a/sdkproject/Assets/Mapbox/Unity/Utilities/MapVisualizerPerformance.cs b/sdkproject/Assets/Mapbox/Unity/Utilities/MapVisualizerPerformance.cs index ecae799c1..ec048b99d 100644 --- a/sdkproject/Assets/Mapbox/Unity/Utilities/MapVisualizerPerformance.cs +++ b/sdkproject/Assets/Mapbox/Unity/Utilities/MapVisualizerPerformance.cs @@ -18,7 +18,7 @@ public class MapVisualizerPerformance : MonoBehaviour public float TotalTime = 0; private float _firstRun; - private void Awake() + protected virtual void Awake() { TotalTime = 0; _currentTest = 1; diff --git a/sdkproject/Assets/Mapbox/Unity/Utilities/OpenUrlOnButtonClick.cs b/sdkproject/Assets/Mapbox/Unity/Utilities/OpenUrlOnButtonClick.cs index 0c688f1fc..f71b80357 100644 --- a/sdkproject/Assets/Mapbox/Unity/Utilities/OpenUrlOnButtonClick.cs +++ b/sdkproject/Assets/Mapbox/Unity/Utilities/OpenUrlOnButtonClick.cs @@ -9,7 +9,7 @@ public class OpenUrlOnButtonClick : MonoBehaviour [SerializeField] string _url; - void Awake() + protected virtual void Awake() { GetComponent