From 315a1d87f06ed46ddd3f29d094faf9ec2e80fcf0 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Mon, 24 Apr 2017 20:00:37 +0200 Subject: [PATCH 01/25] add third party asset: UnityMainThreadDispatcher --- .../UnityMainThreadDispatcher.meta | 9 + .../UnityMainThreadDispatcher/LICENSE | 201 ++++++++++++++++++ .../UnityMainThreadDispatcher/LICENSE.meta | 8 + .../UnityMainThreadDispatcher/README.md | 42 ++++ .../UnityMainThreadDispatcher/README.md.meta | 8 + .../UnityMainThreadDispatcher.cs | 92 ++++++++ .../UnityMainThreadDispatcher.cs.meta | 12 ++ .../UnityMainThreadDispatcher.prefab | 57 +++++ .../UnityMainThreadDispatcher.prefab.meta | 8 + 9 files changed, 437 insertions(+) create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher.meta create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE.meta create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md.meta create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs.meta create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab.meta diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher.meta b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher.meta new file mode 100644 index 000000000..066864af3 --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0204c3f97423296498dc89d386410d43 +folderAsset: yes +timeCreated: 1492513991 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE new file mode 100644 index 000000000..8dada3eda --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE @@ -0,0 +1,201 @@ + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + 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. diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE.meta b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE.meta new file mode 100644 index 000000000..494d22745 --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4d9e38f8b75c1f945a539a8d5296f239 +timeCreated: 1492513991 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md new file mode 100644 index 000000000..0bdd61771 --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md @@ -0,0 +1,42 @@ +# UnityMainThreadDispatcher + +A thread-safe way of dispatching IEnumerator functions to the main thread in unity. Useful for calling UI functions and other actions that Unity limits to the main thread from different threads. +### Version +1.0 - Tested and functional in one or more production mobile games (including https://get-wrecked.com) + +### Installation + +No dependencies needed other than Unity. This script was created in Unity 5.3, and has been tested in 5.3, 5.4, and 5.5. + +1. Download the UnityMainThreadDispatcher prefab and add it to your scene, or simple create an empty GameObject, call it UnityMainThreadDispatcher. +2. Download the UnityMainThreadDispatcher.cs script and add it to your prefab +3. You can now dispatch objects to the main thread in Unity. + +###Usage +```C# + public IEnumerator ThisWillBeExecutedOnTheMainThread() { + Debug.Log ("This is executed from the main thread"); + yield return null; + } + public void ExampleMainThreadCall() { + UnityMainThreadDispatcher.Instance().Enqueue(ThisWillBeExecutedOnTheMainThread()); + } +``` +OR + +```C# + UnityMainThreadDispatcher.Instance().Enqueue(() => Debug.Log ("This is executed from the main thread")); +``` +### Development + +Want to contribute? Great! If you find a bug or want to make improvements, simply fork the repo and make a pull request with your changes on your own fork. + +### Author +@PimDeWitte + + + + + + + diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md.meta b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md.meta new file mode 100644 index 000000000..5c5720e3c --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 13d972f356488444db37dd91537876e0 +timeCreated: 1492513991 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs new file mode 100644 index 000000000..081e71ce9 --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs @@ -0,0 +1,92 @@ +/* +Copyright 2015 Pim de Witte 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. +*/ + +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; + +/// Author: Pim de Witte (pimdewitte.com) and contributors +/// +/// A thread-safe class which holds a queue with actions to execute on the next Update() method. It can be used to make calls to the main thread for +/// things such as UI Manipulation in Unity. It was developed for use in combination with the Firebase Unity plugin, which uses separate threads for event handling +/// +public class UnityMainThreadDispatcher : MonoBehaviour { + + private static readonly Queue _executionQueue = new Queue(); + + public void Update() { + lock(_executionQueue) { + while (_executionQueue.Count > 0) { + _executionQueue.Dequeue().Invoke(); + } + } + } + + /// + /// Locks the queue and adds the IEnumerator to the queue + /// + /// IEnumerator function that will be executed from the main thread. + public void Enqueue(IEnumerator action) { + lock (_executionQueue) { + _executionQueue.Enqueue (() => { + StartCoroutine (action); + }); + } + } + + /// + /// Locks the queue and adds the Action to the queue + /// + /// function that will be executed from the main thread. + public void Enqueue(Action action) + { + Enqueue(ActionWrapper(action)); + } + IEnumerator ActionWrapper(Action a) + { + a(); + yield return null; + } + + + private static UnityMainThreadDispatcher _instance = null; + + public static bool Exists() { + return _instance != null; + } + + public static UnityMainThreadDispatcher Instance() { + if (!Exists ()) { + throw new Exception ("UnityMainThreadDispatcher could not find the UnityMainThreadDispatcher object. Please ensure you have added the MainThreadExecutor Prefab to your scene."); + } + return _instance; + } + + + void Awake() { + if (_instance == null) { + _instance = this; + DontDestroyOnLoad(this.gameObject); + } + } + + void OnDestroy() { + _instance = null; + } + + +} diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs.meta b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs.meta new file mode 100644 index 000000000..cdfc1ce16 --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 16173428f7358476fa784f899e396692 +timeCreated: 1459554404 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab new file mode 100644 index 000000000..f3c2904a7 --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab @@ -0,0 +1,57 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &184210 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22414968} + - 114: {fileID: 11464956} + m_Layer: 0 + m_Name: UnityMainThreadDispatcher + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &11464956 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 184210} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 16173428f7358476fa784f899e396692, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!224 &22414968 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 184210} + 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: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -50, y: -50} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0, y: 0} +--- !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: 184210} + m_IsPrefabParent: 1 diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab.meta b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab.meta new file mode 100644 index 000000000..4b1ceba6d --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8a749df5e56f6422ba9fe64d83915a89 +timeCreated: 1459554642 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: From 764a3c1e5acdff20fa6991c7240b23892631b5a9 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Mon, 24 Apr 2017 20:06:43 +0200 Subject: [PATCH 02/25] change mapbox-sdk-cs dependency to branch BergWerkGIS-multithread-filesource --- dependencies/mapbox-sdk-cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/mapbox-sdk-cs b/dependencies/mapbox-sdk-cs index 558cb770a..d80a8e8bd 160000 --- a/dependencies/mapbox-sdk-cs +++ b/dependencies/mapbox-sdk-cs @@ -1 +1 @@ -Subproject commit 558cb770ade50ff737bf4d6001b88af6e68578ba +Subproject commit d80a8e8bdba1b39f79b9243326627017958029fc From 99de9faaef3683182b6ce1c06caf171fad17933b Mon Sep 17 00:00:00 2001 From: David Rhodes Date: Mon, 24 Apr 2017 13:54:53 -0600 Subject: [PATCH 03/25] threaded slippy test scene --- sdkproject/Assets/ThreadedSlippyTest.unity | 661 ++++++++++++++++++ .../Assets/ThreadedSlippyTest.unity.meta | 8 + 2 files changed, 669 insertions(+) create mode 100644 sdkproject/Assets/ThreadedSlippyTest.unity create mode 100644 sdkproject/Assets/ThreadedSlippyTest.unity.meta diff --git a/sdkproject/Assets/ThreadedSlippyTest.unity b/sdkproject/Assets/ThreadedSlippyTest.unity new file mode 100644 index 000000000..80a5dd8d4 --- /dev/null +++ b/sdkproject/Assets/ThreadedSlippyTest.unity @@ -0,0 +1,661 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 7 + 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.58823526, g: 0.58823526, b: 0.58823526, 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: 3 + m_SkyboxMaterial: {fileID: 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, g: 0, b: 0, a: 1} +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 7 + m_GIWorkflowMode: 1 + 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: 4 + 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_DirectLightInLightProbes: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_LightingDataAsset: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: 0.16666667 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &743593631 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 743593633} + - 108: {fileID: 743593632} + 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 &743593632 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 743593631} + m_Enabled: 1 + serializedVersion: 7 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 0.64 + 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_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &743593633 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 743593631} + 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_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &1281281112 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1281281117} + - 20: {fileID: 1281281116} + - 92: {fileID: 1281281115} + - 124: {fileID: 1281281114} + - 81: {fileID: 1281281113} + - 114: {fileID: 1281281118} + 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 &1281281113 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1281281112} + m_Enabled: 1 +--- !u!124 &1281281114 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1281281112} + m_Enabled: 1 +--- !u!92 &1281281115 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1281281112} + m_Enabled: 1 +--- !u!20 &1281281116 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1281281112} + 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: 33 + 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: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &1281281117 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1281281112} + m_LocalRotation: {x: 0.4663866, y: 0, z: 0, w: 0.884581} + m_LocalPosition: {x: 0, y: 400, z: -100} + m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalEulerAnglesHint: {x: 55.6, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &1281281118 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1281281112} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9527fd56bc6a0c549a1e550219f9b16e, type: 3} + m_Name: + m_EditorClassIdentifier: + Speed: 100 +--- !u!1 &1378964790 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1378964791} + - 222: {fileID: 1378964793} + - 114: {fileID: 1378964792} + m_Layer: 5 + m_Name: KeyboardControls + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1378964791 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1378964790} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 1380781977} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 300} + m_Pivot: {x: 0.5, y: 1} +--- !u!114 &1378964792 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1378964790} + 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: 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: 69 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 119 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 'Use W, A, S, D to pan the map. + + New tiles will load in as needed.' +--- !u!222 &1378964793 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1378964790} +--- !u!1 &1380781973 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1380781977} + - 223: {fileID: 1380781976} + - 114: {fileID: 1380781975} + - 114: {fileID: 1380781974} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1380781974 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1380781973} + 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 &1380781975 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1380781973} + 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: 1920, y: 1080} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &1380781976 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1380781973} + m_Enabled: 1 + serializedVersion: 2 + 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_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1380781977 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1380781973} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 1515605196} + - {fileID: 1378964791} + m_Father: {fileID: 0} + m_RootOrder: 3 + 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 &1461465686 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1461465688} + - 114: {fileID: 1461465687} + - 114: {fileID: 1461465689} + m_Layer: 0 + m_Name: MapController + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1461465687 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1461465686} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c57173fef834bb94098b65581fb4f0e4, type: 3} + m_Name: + m_EditorClassIdentifier: + MapVisualization: {fileID: 11400000, guid: 7f949b7bf234f3049adb4259192eda3d, type: 2} + TileSize: 100 + _snapYToZero: 1 + LatLng: 69.5419324, 20.5512521 + Zoom: 12 + Range: {x: 0, y: 0, z: 0, w: 0} +--- !u!4 &1461465688 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1461465686} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 +--- !u!114 &1461465689 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1461465686} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ab322f3f81267624dbd388daa9e37945, type: 3} + m_Name: + m_EditorClassIdentifier: + _range: 2 +--- !u!1 &1515605195 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1515605196} + m_Layer: 5 + m_Name: PoiContainer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1515605196 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1515605195} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 1380781977} + m_RootOrder: 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.5, y: 0.5} +--- !u!1001 &1594774934 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_RootOrder + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_AnchoredPosition.x + value: -50 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_AnchoredPosition.y + value: -50 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_SizeDelta.x + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} + m_IsPrefabParent: 0 +--- !u!1 &1677468913 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1677468916} + - 114: {fileID: 1677468915} + - 114: {fileID: 1677468914} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1677468914 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1677468913} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, 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 &1677468915 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1677468913} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &1677468916 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1677468913} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 diff --git a/sdkproject/Assets/ThreadedSlippyTest.unity.meta b/sdkproject/Assets/ThreadedSlippyTest.unity.meta new file mode 100644 index 000000000..42543f9c7 --- /dev/null +++ b/sdkproject/Assets/ThreadedSlippyTest.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fc656e4496ae0405d9151bf8fe400732 +timeCreated: 1493063572 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: From 8ea362a4a731d81fbfbd2f1cc9a4e23c3271bd3d Mon Sep 17 00:00:00 2001 From: David Rhodes Date: Mon, 24 Apr 2017 13:55:23 -0600 Subject: [PATCH 04/25] Fixing some compile errors. --- sdkproject/Assets/Mapbox/Core/Unity/MapboxAccess.cs | 2 +- sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sdkproject/Assets/Mapbox/Core/Unity/MapboxAccess.cs b/sdkproject/Assets/Mapbox/Core/Unity/MapboxAccess.cs index ec76f8f1c..05f5e7b85 100644 --- a/sdkproject/Assets/Mapbox/Core/Unity/MapboxAccess.cs +++ b/sdkproject/Assets/Mapbox/Core/Unity/MapboxAccess.cs @@ -111,7 +111,7 @@ public IAsyncRequest Request(string url, Action callback) uriBuilder.Query = accessTokenQuery; } - return new HTTPRequest(uriBuilder.ToString(), callback); + return new Platform.HTTPRequest(uriBuilder.ToString(), callback); } class InvalidTokenException : Exception diff --git a/sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs b/sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs index 7ceb45546..2e5e099eb 100644 --- a/sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs +++ b/sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs @@ -50,7 +50,9 @@ private IEnumerator DoRequest() yield return 0; } var response = new Response(); - response.Error = this._request.error; + + // TODO: fix me! + //response.Error = this._request.error; response.Data = this._request.downloadHandler.data; _callback(response); From 7a43ae20ab901037c6fd18987cffdfb9adaed4db Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Tue, 25 Apr 2017 09:08:46 +0200 Subject: [PATCH 05/25] remove Mapbox.Unity.Utilities.HTTPRequest --- .../Core/Unity/Utilities/HTTPRequest.cs | 61 ------------------- .../Core/Unity/Utilities/HTTPRequest.cs.meta | 12 ---- 2 files changed, 73 deletions(-) delete mode 100644 sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs delete mode 100644 sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs.meta diff --git a/sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs b/sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs deleted file mode 100644 index 7ceb45546..000000000 --- a/sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs +++ /dev/null @@ -1,61 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (c) 2016 Mapbox. All rights reserved. -// -//----------------------------------------------------------------------- - -namespace Mapbox.Unity.Utilities -{ - using System; - using UnityEngine.Networking; - using System.Collections; - using Mapbox.Platform; - -#if UNITY_EDITOR - using UnityEditor; -#endif - - internal sealed class HTTPRequest : IAsyncRequest - { - private UnityWebRequest _request; - private readonly Action _callback; - - public HTTPRequest(string url, Action callback) - { - _request = UnityWebRequest.Get(url); - _callback = callback; - -#if UNITY_EDITOR - if (!EditorApplication.isPlaying) - { - Runnable.EnableRunnableInEditor(); - } -#endif - Runnable.Run(DoRequest()); - } - - public void Cancel() - { - if (_request != null) - { - _request.Abort(); - } - } - - private IEnumerator DoRequest() - { - _request.Send(); - while (!_request.isDone) - { - yield return 0; - } - var response = new Response(); - response.Error = this._request.error; - response.Data = this._request.downloadHandler.data; - - _callback(response); - _request.Dispose(); - _request = null; - } - } -} diff --git a/sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs.meta b/sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs.meta deleted file mode 100644 index 6379afd9e..000000000 --- a/sdkproject/Assets/Mapbox/Core/Unity/Utilities/HTTPRequest.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0af41ebc1f8e7485d93cb4b9070e9d1a -timeCreated: 1482363481 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: From 4f2f53811aa5bcdd5281ed642a2c0ea4302e7d2a Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Tue, 25 Apr 2017 09:16:32 +0200 Subject: [PATCH 06/25] update mapbox-sdk-cs --- dependencies/mapbox-sdk-cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/mapbox-sdk-cs b/dependencies/mapbox-sdk-cs index d80a8e8bd..78dec8cea 160000 --- a/dependencies/mapbox-sdk-cs +++ b/dependencies/mapbox-sdk-cs @@ -1 +1 @@ -Subproject commit d80a8e8bdba1b39f79b9243326627017958029fc +Subproject commit 78dec8ceaaad770800fc3f40261ac05fbb5053fc From af041f2cc588200a6cd5fd1e12aea434db5e07c6 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Tue, 25 Apr 2017 09:26:40 +0200 Subject: [PATCH 07/25] UnityMainThreadDispatcher --- .../UnityMainThreadDispatcher/LICENSE.meta | 8 --- .../UnityMainThreadDispatcher/README.md | 21 +++--- .../UnityMainThreadDispatcher/README.md.meta | 8 --- .../UnityMainThreadDispatcher.cs | 72 +++++++++---------- .../UnityMainThreadDispatcher.prefab | 57 --------------- .../UnityMainThreadDispatcher.prefab.meta | 8 --- 6 files changed, 45 insertions(+), 129 deletions(-) delete mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE.meta delete mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md.meta delete mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab delete mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab.meta diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE.meta b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE.meta deleted file mode 100644 index 494d22745..000000000 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4d9e38f8b75c1f945a539a8d5296f239 -timeCreated: 1492513991 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md index 0bdd61771..a82c0f562 100644 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md @@ -6,34 +6,39 @@ A thread-safe way of dispatching IEnumerator functions to the main thread in uni ### Installation -No dependencies needed other than Unity. This script was created in Unity 5.3, and has been tested in 5.3, 5.4, and 5.5. +No dependencies needed other than Unity. This script was created in Unity 5.3, and has been tested in 5.3 through 5.6. -1. Download the UnityMainThreadDispatcher prefab and add it to your scene, or simple create an empty GameObject, call it UnityMainThreadDispatcher. -2. Download the UnityMainThreadDispatcher.cs script and add it to your prefab -3. You can now dispatch objects to the main thread in Unity. +Just download the UnityMainThreadDispatcher.cs script, and you're done. +The script adds a singleton runner to the scene on it's own when you enter play mode, so you don't need to do anything to start using the static methods from the script. -###Usage + +### Usage ```C# public IEnumerator ThisWillBeExecutedOnTheMainThread() { Debug.Log ("This is executed from the main thread"); yield return null; } public void ExampleMainThreadCall() { - UnityMainThreadDispatcher.Instance().Enqueue(ThisWillBeExecutedOnTheMainThread()); + UnityMainThreadDispatcher.Enqueue(ThisWillBeExecutedOnTheMainThread()); } ``` OR ```C# - UnityMainThreadDispatcher.Instance().Enqueue(() => Debug.Log ("This is executed from the main thread")); + UnityMainThreadDispatcher.Enqueue(() => Debug.Log ("This is executed from the main thread")); ``` ### Development Want to contribute? Great! If you find a bug or want to make improvements, simply fork the repo and make a pull request with your changes on your own fork. ### Author -@PimDeWitte +@PimDeWitte, Special thanks to: +https://github.com/Fireforge +https://github.com/Baste-RainGames +https://github.com/aphex- +https://github.com/bbuanes +For amazing contributions and architectural decisions. diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md.meta b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md.meta deleted file mode 100644 index 5c5720e3c..000000000 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 13d972f356488444db37dd91537876e0 -timeCreated: 1492513991 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs index 081e71ce9..541c80c6c 100644 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs @@ -18,6 +18,7 @@ limitations under the License. using System.Collections; using System.Collections.Generic; using System; +using UnityEditor.Callbacks; /// Author: Pim de Witte (pimdewitte.com) and contributors /// @@ -26,67 +27,58 @@ limitations under the License. /// public class UnityMainThreadDispatcher : MonoBehaviour { - private static readonly Queue _executionQueue = new Queue(); - - public void Update() { - lock(_executionQueue) { - while (_executionQueue.Count > 0) { - _executionQueue.Dequeue().Invoke(); - } - } - } + private static readonly Queue _executionQueue = new Queue(); + private static UnityMainThreadDispatcher _instance; /// /// Locks the queue and adds the IEnumerator to the queue /// /// IEnumerator function that will be executed from the main thread. - public void Enqueue(IEnumerator action) { + public static void Enqueue(IEnumerator action) { lock (_executionQueue) { - _executionQueue.Enqueue (() => { - StartCoroutine (action); - }); + _executionQueue.Enqueue(action); } } - /// - /// Locks the queue and adds the Action to the queue + /// + /// Locks the queue and adds the Action to the queue /// /// function that will be executed from the main thread. - public void Enqueue(Action action) - { - Enqueue(ActionWrapper(action)); - } - IEnumerator ActionWrapper(Action a) - { - a(); - yield return null; + public static void Enqueue(Action action) { + Enqueue(_instance.ActionWrapper(action)); } - private static UnityMainThreadDispatcher _instance = null; - - public static bool Exists() { - return _instance != null; + /// + /// This ensures that there's exactly one UnityMainThreadDispatcher in every scene, so the singleton will exist no matter which scene you play from. + /// + [PostProcessScene] + private static void AddDispatcherToScene() { + var dispatcherContainer = new GameObject("UnityMainThreadDispatcher"); + DontDestroyOnLoad(dispatcherContainer); + dispatcherContainer.AddComponent(); } - public static UnityMainThreadDispatcher Instance() { - if (!Exists ()) { - throw new Exception ("UnityMainThreadDispatcher could not find the UnityMainThreadDispatcher object. Please ensure you have added the MainThreadExecutor Prefab to your scene."); + private void Awake() { + if (_instance != null) { + Destroy(gameObject); } - return _instance; - } - - - void Awake() { - if (_instance == null) { + else { _instance = this; - DontDestroyOnLoad(this.gameObject); } } - void OnDestroy() { - _instance = null; + private void Update() { + lock(_executionQueue) { + while (_executionQueue.Count > 0) { + StartCoroutine(_executionQueue.Dequeue()); + } + } } - + IEnumerator ActionWrapper(Action a) { + a(); + yield return null; + } } + diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab deleted file mode 100644 index f3c2904a7..000000000 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab +++ /dev/null @@ -1,57 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &184210 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 4 - m_Component: - - 224: {fileID: 22414968} - - 114: {fileID: 11464956} - m_Layer: 0 - m_Name: UnityMainThreadDispatcher - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &11464956 -MonoBehaviour: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 184210} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 16173428f7358476fa784f899e396692, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!224 &22414968 -RectTransform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 184210} - 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: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -50, y: -50} - m_SizeDelta: {x: 100, y: 100} - m_Pivot: {x: 0, y: 0} ---- !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: 184210} - m_IsPrefabParent: 1 diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab.meta b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab.meta deleted file mode 100644 index 4b1ceba6d..000000000 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.prefab.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8a749df5e56f6422ba9fe64d83915a89 -timeCreated: 1459554642 -licenseType: Pro -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: From 56f233470c0b9fa9e4742e00e0b3d87a356b783e Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Tue, 25 Apr 2017 15:52:08 +0200 Subject: [PATCH 08/25] update vector-tile-cs --- dependencies/vector-tile-cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/vector-tile-cs b/dependencies/vector-tile-cs index c99cc8435..3b92575ff 160000 --- a/dependencies/vector-tile-cs +++ b/dependencies/vector-tile-cs @@ -1 +1 @@ -Subproject commit c99cc8435ae177e4e54ed9b11397934c648868be +Subproject commit 3b92575ff882efc23f5db51fa6c89d65d3249a23 From 9e195a4eb03f6e11f2ab59aca437d30795d21170 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Tue, 25 Apr 2017 15:53:52 +0200 Subject: [PATCH 09/25] MapboxAccess: add CertificateValidationCallback --- .../Assets/Mapbox/Core/Unity/MapboxAccess.cs | 321 +++++++++--------- 1 file changed, 167 insertions(+), 154 deletions(-) diff --git a/sdkproject/Assets/Mapbox/Core/Unity/MapboxAccess.cs b/sdkproject/Assets/Mapbox/Core/Unity/MapboxAccess.cs index 05f5e7b85..c99b09c47 100644 --- a/sdkproject/Assets/Mapbox/Core/Unity/MapboxAccess.cs +++ b/sdkproject/Assets/Mapbox/Core/Unity/MapboxAccess.cs @@ -1,158 +1,171 @@ -namespace Mapbox.Unity -{ - using System.IO; - using UnityEngine; - using System; - using System.Collections; - using Mapbox.Geocoding; - using Mapbox.Directions; - using Mapbox.Platform; - using Mapbox.Unity.Utilities; - - /// - /// Object for retrieving an API token and making http requests. - /// Contains a lazy Geocoder and a lazy Directions for convenience. - /// - public class MapboxAccess : IFileSource - { - readonly string _accessPath = Path.Combine(Application.streamingAssetsPath, Constants.Path.TOKEN_FILE); - - static MapboxAccess _instance = new MapboxAccess(); - - /// - /// The singleton instance. - /// - public static MapboxAccess Instance - { - get - { - return _instance; - } - } - - MapboxAccess() - { - ValidateMapboxAccessFile(); - LoadAccessToken(); - } - - /// - /// The Mapbox API access token. - /// See Mapbox API Congfiguration in Unity. - /// - string _accessToken; - public string AccessToken - { - get - { - return _accessToken; - } - set - { - if (string.IsNullOrEmpty(value)) - { - throw new InvalidTokenException("Please configure your access token in the menu!"); - } - _accessToken = value; - } - } - - void ValidateMapboxAccessFile() - { - if (!Directory.Exists(Application.streamingAssetsPath) || !File.Exists(_accessPath)) - { - throw new InvalidTokenException("Please configure your access token in the menu!"); - } - } - - /// - /// Loads the access token from StreamingAssets. - /// - void LoadAccessToken() - { -#if UNITY_EDITOR || !UNITY_ANDROID - AccessToken = File.ReadAllText(_accessPath); +namespace Mapbox.Unity { + using System.IO; + using UnityEngine; + using System; + using System.Collections; + using Mapbox.Geocoding; + using Mapbox.Directions; + using Mapbox.Platform; +#if !NETFX_CORE + using System.Security.Cryptography.X509Certificates; +#endif + using System.Net.Security; + + + /// + /// Object for retrieving an API token and making http requests. + /// Contains a lazy Geocoder and a lazy Directions for convenience. + /// + public class MapboxAccess : IFileSource { + readonly string _accessPath = Path.Combine(Application.streamingAssetsPath, Constants.Path.TOKEN_FILE); + + static MapboxAccess _instance = new MapboxAccess(); + + /// + /// The singleton instance. + /// + public static MapboxAccess Instance { + get { + return _instance; + } + } + + + MapboxAccess() { +#if !NETFX_CORE + System.Net.ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback; +#endif + System.Net.ServicePointManager.DefaultConnectionLimit = 1600; + ValidateMapboxAccessFile(); + LoadAccessToken(); + } + + + /// + /// The Mapbox API access token. + /// See Mapbox API Congfiguration in Unity. + /// + string _accessToken; + public string AccessToken { + get { + return _accessToken; + } + set { + if (string.IsNullOrEmpty(value)) { + throw new InvalidTokenException("Please configure your access token in the menu!"); + } + _accessToken = value; + } + } + + + void ValidateMapboxAccessFile() { + if (!Directory.Exists(Application.streamingAssetsPath) || !File.Exists(_accessPath)) { + throw new InvalidTokenException("Please configure your access token in the menu!"); + } + } + + + /// + /// Loads the access token from StreamingAssets. + /// + void LoadAccessToken() { +#if UNITY_EDITOR || !UNITY_ANDROID + AccessToken = File.ReadAllText(_accessPath); #else Runnable.Run(LoadMapboxAccess()); #endif - } - - /// - /// Android-specific token file loading. - /// - IEnumerator LoadMapboxAccess() - { - var request = new WWW(_accessPath); - while (!request.isDone) - { - yield return 0; - } - AccessToken = request.text; - } - - /// - /// Makes an asynchronous url query. - /// - /// The request. - /// URL. - /// Callback. - public IAsyncRequest Request(string url, Action callback) - { - var uriBuilder = new UriBuilder(url); - - string accessTokenQuery = "access_token=" + AccessToken; - - if (uriBuilder.Query != null && uriBuilder.Query.Length > 1) - { - uriBuilder.Query = uriBuilder.Query.Substring(1) + "&" + accessTokenQuery; - } - else - { - uriBuilder.Query = accessTokenQuery; - } - - return new Platform.HTTPRequest(uriBuilder.ToString(), callback); - } - - class InvalidTokenException : Exception - { - public InvalidTokenException(string message) : base(message) - { - } - } - - Geocoder _geocoder; - - /// - /// Lazy geocoder. - /// - public Geocoder Geocoder - { - get - { - if (_geocoder == null) - { - _geocoder = new Geocoder(this); - } - return _geocoder; - } - } - - Directions _directions; - - /// - /// Lazy Directions. - /// - public Directions Directions - { - get - { - if (_directions == null) - { - _directions = new Directions(this); - } - return _directions; - } - } - } + } + + + /// + /// Android-specific token file loading. + /// + IEnumerator LoadMapboxAccess() { + var request = new WWW(_accessPath); + while (!request.isDone) { + yield return 0; + } + AccessToken = request.text; + } + + + /// + /// Makes an asynchronous url query. + /// + /// The request. + /// URL. + /// Callback. + public IAsyncRequest Request(string url, Action callback) { + var uriBuilder = new UriBuilder(url); + + string accessTokenQuery = "access_token=" + AccessToken; + + if (uriBuilder.Query != null && uriBuilder.Query.Length > 1) { + uriBuilder.Query = uriBuilder.Query.Substring(1) + "&" + accessTokenQuery; + } else { + uriBuilder.Query = accessTokenQuery; + } + + return new Platform.HTTPRequest(uriBuilder.ToString(), callback); + } + + class InvalidTokenException : Exception { + public InvalidTokenException(string message) : base(message) { + } + } + + Geocoder _geocoder; + + /// + /// Lazy geocoder. + /// + public Geocoder Geocoder { + get { + if (_geocoder == null) { + _geocoder = new Geocoder(this); + } + return _geocoder; + } + } + + Directions _directions; + + /// + /// Lazy Directions. + /// + public Directions Directions { + get { + if (_directions == null) { + _directions = new Directions(this); + } + return _directions; + } + } + + +#if !NETFX_CORE + public bool MyRemoteCertificateValidationCallback(System.Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { + bool isOk = true; + // If there are errors in the certificate chain, look at each error to determine the cause. + if (sslPolicyErrors != SslPolicyErrors.None) { + for (int i = 0; i < chain.ChainStatus.Length; i++) { + if (chain.ChainStatus[i].Status != X509ChainStatusFlags.RevocationStatusUnknown) { + chain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain; + chain.ChainPolicy.RevocationMode = X509RevocationMode.Online; + chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 1, 0); + chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllFlags; + bool chainIsValid = chain.Build((X509Certificate2)certificate); + if (!chainIsValid) { + isOk = false; + } + } + } + } + return isOk; + } +#endif + + + } } From 69d29d87f7fe595d7a7c3f13576bd943051ccda5 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Tue, 25 Apr 2017 16:01:29 +0200 Subject: [PATCH 10/25] revert update of vector-tile-cs as latest changes (generic geometry, scale, ...) haven't been implemented yet --- dependencies/vector-tile-cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/vector-tile-cs b/dependencies/vector-tile-cs index 3b92575ff..c99cc8435 160000 --- a/dependencies/vector-tile-cs +++ b/dependencies/vector-tile-cs @@ -1 +1 @@ -Subproject commit 3b92575ff882efc23f5db51fa6c89d65d3249a23 +Subproject commit c99cc8435ae177e4e54ed9b11397934c648868be From cb8cfe77d1df5968f69963f502dc379b90b5af4b Mon Sep 17 00:00:00 2001 From: David Rhodes Date: Tue, 25 Apr 2017 10:21:39 -0600 Subject: [PATCH 11/25] Fixed thread dispatcher so that it works outside the editor. Profiling scene modified for simplicity. --- .../TerrainVisualization.asset | 1 - .../UnityMainThreadDispatcher.cs | 11 --- sdkproject/Assets/ThreadedSlippyTest.unity | 95 ++----------------- 3 files changed, 6 insertions(+), 101 deletions(-) diff --git a/sdkproject/Assets/Mapbox/Examples/SlippyVectorTerrain/TerrainVisualization.asset b/sdkproject/Assets/Mapbox/Examples/SlippyVectorTerrain/TerrainVisualization.asset index 5a17c80d3..fa30cd175 100644 --- a/sdkproject/Assets/Mapbox/Examples/SlippyVectorTerrain/TerrainVisualization.asset +++ b/sdkproject/Assets/Mapbox/Examples/SlippyVectorTerrain/TerrainVisualization.asset @@ -14,4 +14,3 @@ MonoBehaviour: Factories: - {fileID: 11400000, guid: 12ce4c2ca6ab967418d8a2efe3805178, type: 2} - {fileID: 11400000, guid: 8aa6dfef55a93474fbc6cdfbb145b7d1, type: 2} - - {fileID: 11400000, guid: b6db6e4901cc50246b1ed5c328d73872, type: 2} diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs index 541c80c6c..d054ed2ff 100644 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs +++ b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs @@ -18,7 +18,6 @@ limitations under the License. using System.Collections; using System.Collections.Generic; using System; -using UnityEditor.Callbacks; /// Author: Pim de Witte (pimdewitte.com) and contributors /// @@ -49,16 +48,6 @@ public static void Enqueue(Action action) { } - /// - /// This ensures that there's exactly one UnityMainThreadDispatcher in every scene, so the singleton will exist no matter which scene you play from. - /// - [PostProcessScene] - private static void AddDispatcherToScene() { - var dispatcherContainer = new GameObject("UnityMainThreadDispatcher"); - DontDestroyOnLoad(dispatcherContainer); - dispatcherContainer.AddComponent(); - } - private void Awake() { if (_instance != null) { Destroy(gameObject); diff --git a/sdkproject/Assets/ThreadedSlippyTest.unity b/sdkproject/Assets/ThreadedSlippyTest.unity index 80a5dd8d4..e19bb0726 100644 --- a/sdkproject/Assets/ThreadedSlippyTest.unity +++ b/sdkproject/Assets/ThreadedSlippyTest.unity @@ -211,7 +211,7 @@ Camera: width: 1 height: 1 near clip plane: 0.3 - far clip plane: 1000 + far clip plane: 5000 field of view: 33 orthographic: 0 orthographic size: 5 @@ -234,10 +234,10 @@ Transform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1281281112} - m_LocalRotation: {x: 0.4663866, y: 0, z: 0, w: 0.884581} - m_LocalPosition: {x: 0, y: 400, z: -100} + m_LocalRotation: {x: 0.53729963, y: 0, z: 0, w: 0.8433915} + m_LocalPosition: {x: 0, y: 2490, z: -1075} m_LocalScale: {x: 1, y: 1, z: 1} - m_LocalEulerAnglesHint: {x: 55.6, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 65, y: 0, z: 0} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 @@ -456,7 +456,7 @@ MonoBehaviour: _snapYToZero: 1 LatLng: 69.5419324, 20.5512521 Zoom: 12 - Range: {x: 0, y: 0, z: 0, w: 0} + Range: {x: 5, y: 5, z: 5, w: 5} --- !u!4 &1461465688 Transform: m_ObjectHideFlags: 0 @@ -478,10 +478,9 @@ MonoBehaviour: m_GameObject: {fileID: 1461465686} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ab322f3f81267624dbd388daa9e37945, type: 3} + m_Script: {fileID: 11500000, guid: 16173428f7358476fa784f899e396692, type: 3} m_Name: m_EditorClassIdentifier: - _range: 2 --- !u!1 &1515605195 GameObject: m_ObjectHideFlags: 0 @@ -515,88 +514,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} ---- !u!1001 &1594774934 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_RootOrder - value: 5 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_AnchoredPosition.x - value: -50 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_AnchoredPosition.y - value: -50 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_SizeDelta.x - value: 100 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_SizeDelta.y - value: 100 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_AnchorMin.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_AnchorMin.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_AnchorMax.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_AnchorMax.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_Pivot.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22414968, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - propertyPath: m_Pivot.y - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: 8a749df5e56f6422ba9fe64d83915a89, type: 2} - m_IsPrefabParent: 0 --- !u!1 &1677468913 GameObject: m_ObjectHideFlags: 0 From 3cc01e6c0ba920349337881741d0424f749172b1 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Wed, 26 Apr 2017 13:33:20 +0200 Subject: [PATCH 12/25] add UnityToolbag Dispatcher --- .../UnityToolbagDispatcher/Dispatcher.cs | 106 ++++++++++++++++++ .../UnityToolbagDispatcher/Dispatcher.cs.meta | 12 ++ 2 files changed, 118 insertions(+) create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs.meta diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs new file mode 100644 index 000000000..3d8cda959 --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs @@ -0,0 +1,106 @@ +using UnityEngine; +using System; +using System.Collections.Generic; +using System.Threading; + +namespace UnityToolbag { + /// + /// A system for dispatching code to execute on the main thread. + /// + [AddComponentMenu("UnityToolbag/Dispatcher")] + public class Dispatcher : MonoBehaviour { + private static Dispatcher _instance; + + // We can't use the behaviour reference from other threads, so we use a separate bool + // to track the instance so we can use that on the other threads. + private static bool _instanceExists; + + private static Thread _mainThread; + private static object _lockObject = new object(); + private static readonly Queue _actions = new Queue(); + + /// + /// Gets a value indicating whether or not the current thread is the game's main thread. + /// + public static bool isMainThread { + get { + return Thread.CurrentThread == _mainThread; + } + } + + /// + /// Queues an action to be invoked on the main game thread. + /// + /// The action to be queued. + public static void InvokeAsync(Action action) { + if (!_instanceExists) { + Debug.LogError("No Dispatcher exists in the scene. Actions will not be invoked!"); + return; + } + + if (isMainThread) { + // Don't bother queuing work on the main thread; just execute it. + action(); + } else { + lock (_lockObject) { + _actions.Enqueue(action); + } + } + } + + /// + /// Queues an action to be invoked on the main game thread and blocks the + /// current thread until the action has been executed. + /// + /// The action to be queued. + public static void Invoke(Action action) { + if (!_instanceExists) { + Debug.LogError("No Dispatcher exists in the scene. Actions will not be invoked!"); + return; + } + + bool hasRun = false; + + InvokeAsync(() => { + action(); + hasRun = true; + }); + + // Lock until the action has run + while (!hasRun) { + Thread.Sleep(5); + } + } + + void Awake() { + if (_instance) { + DestroyImmediate(this); + } else { + _instance = this; + _instanceExists = true; + _mainThread = Thread.CurrentThread; + } + } + + void OnDestroy() { + if (_instance == this) { + _instance = null; + _instanceExists = false; + } + } + + int cnt = 0; + void Update() { + //cnt++; + //if (cnt < 100) { return; } + //cnt = 0; + ////if (_actions.Count > 0) UnityEngine.Debug.Log("-------------------- update -----------------" + DateTime.Now.Ticks); + lock (_lockObject) { + while (_actions.Count > 0) { + //UnityEngine.Debug.Log("QUEUE: " + _actions.Count + " " + DateTime.Now.Ticks); + _actions.Dequeue()(); + } + } + } + } +} diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs.meta b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs.meta new file mode 100644 index 000000000..99c6c3dc6 --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dd2511162df91294fa0c4ea0b0d740ed +timeCreated: 1493142390 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 5bbbf86e887f11ae108dcd1ab95b8051733e7dea Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Wed, 26 Apr 2017 13:33:50 +0200 Subject: [PATCH 13/25] update mapbox-sdk-cs for much(!) improved HTTPWebRequest speed --- dependencies/mapbox-sdk-cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/mapbox-sdk-cs b/dependencies/mapbox-sdk-cs index 78dec8cea..034e52557 160000 --- a/dependencies/mapbox-sdk-cs +++ b/dependencies/mapbox-sdk-cs @@ -1 +1 @@ -Subproject commit 78dec8ceaaad770800fc3f40261ac05fbb5053fc +Subproject commit 034e52557eb2a59361466b7810e00b3989b18c03 From eeb36d49409d4e2a8fa69b1c1fd0e9d1aaf0ab43 Mon Sep 17 00:00:00 2001 From: David Rhodes Date: Thu, 27 Apr 2017 13:11:07 -0600 Subject: [PATCH 14/25] updated scene with toolbag and slippy for testing --- .../UnityToolbagDispatcher.meta | 9 +++++++++ sdkproject/Assets/ThreadedSlippyTest.unity | 17 +++++++++++++++-- .../ProjectSettings/EditorBuildSettings.asset | 2 +- .../ProjectSettings/ProjectSettings.asset | 2 ++ 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher.meta diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher.meta b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher.meta new file mode 100644 index 000000000..e898ff19b --- /dev/null +++ b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9b8e3a59ff0dc4000a4fda4d9fa6931d +folderAsset: yes +timeCreated: 1493311191 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdkproject/Assets/ThreadedSlippyTest.unity b/sdkproject/Assets/ThreadedSlippyTest.unity index e19bb0726..5156731da 100644 --- a/sdkproject/Assets/ThreadedSlippyTest.unity +++ b/sdkproject/Assets/ThreadedSlippyTest.unity @@ -433,6 +433,7 @@ GameObject: - 4: {fileID: 1461465688} - 114: {fileID: 1461465687} - 114: {fileID: 1461465689} + - 114: {fileID: 1461465690} m_Layer: 0 m_Name: MapController m_TagString: Untagged @@ -456,7 +457,7 @@ MonoBehaviour: _snapYToZero: 1 LatLng: 69.5419324, 20.5512521 Zoom: 12 - Range: {x: 5, y: 5, z: 5, w: 5} + Range: {x: 10, y: 10, z: 10, w: 10} --- !u!4 &1461465688 Transform: m_ObjectHideFlags: 0 @@ -478,9 +479,21 @@ MonoBehaviour: m_GameObject: {fileID: 1461465686} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 16173428f7358476fa784f899e396692, type: 3} + m_Script: {fileID: 11500000, guid: dd2511162df91294fa0c4ea0b0d740ed, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &1461465690 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1461465686} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ab322f3f81267624dbd388daa9e37945, type: 3} + m_Name: + m_EditorClassIdentifier: + _range: 2 --- !u!1 &1515605195 GameObject: m_ObjectHideFlags: 0 diff --git a/sdkproject/ProjectSettings/EditorBuildSettings.asset b/sdkproject/ProjectSettings/EditorBuildSettings.asset index e8f9a8784..4cddae32e 100644 --- a/sdkproject/ProjectSettings/EditorBuildSettings.asset +++ b/sdkproject/ProjectSettings/EditorBuildSettings.asset @@ -6,4 +6,4 @@ EditorBuildSettings: serializedVersion: 2 m_Scenes: - enabled: 1 - path: Assets/Mapbox/Examples/LocationProvider/LocationProvider.unity + path: Assets/ThreadedSlippyTest.unity diff --git a/sdkproject/ProjectSettings/ProjectSettings.asset b/sdkproject/ProjectSettings/ProjectSettings.asset index 5a6777d45..c80ee601a 100644 --- a/sdkproject/ProjectSettings/ProjectSettings.asset +++ b/sdkproject/ProjectSettings/ProjectSettings.asset @@ -424,6 +424,7 @@ PlayerSettings: XboxOneAllowedProductIds: [] XboxOnePersistentLocalStorageSize: 0 intPropertyNames: + - Android::ScriptingBackend - Standalone::ScriptingBackend - WebGL::ScriptingBackend - WebGL::audioCompressionFormat @@ -431,6 +432,7 @@ PlayerSettings: - WebGL::memorySize - iOS::Architecture - iOS::ScriptingBackend + Android::ScriptingBackend: 0 Standalone::ScriptingBackend: 0 WebGL::ScriptingBackend: 1 WebGL::audioCompressionFormat: 4 From 7ed290a6e12c91c0ee04006583dce0a368975f53 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Wed, 3 May 2017 12:52:58 +0200 Subject: [PATCH 15/25] update mapbox-sdk-cs to latest HTTPRequest dev --- dependencies/mapbox-sdk-cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/mapbox-sdk-cs b/dependencies/mapbox-sdk-cs index 034e52557..c4c25a47c 160000 --- a/dependencies/mapbox-sdk-cs +++ b/dependencies/mapbox-sdk-cs @@ -1 +1 @@ -Subproject commit 034e52557eb2a59361466b7810e00b3989b18c03 +Subproject commit c4c25a47cd881e704a3719d9fa695b59e2e61c18 From a2399481df260918f35c7e2271f4f2edd49c480c Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Wed, 3 May 2017 13:05:10 +0200 Subject: [PATCH 16/25] remove UnityMainThreadDispatcher --- .../UnityMainThreadDispatcher.meta | 9 - .../UnityMainThreadDispatcher/LICENSE | 201 ------------------ .../UnityMainThreadDispatcher/README.md | 47 ---- .../UnityMainThreadDispatcher.cs | 73 ------- .../UnityMainThreadDispatcher.cs.meta | 12 -- 5 files changed, 342 deletions(-) delete mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher.meta delete mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE delete mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md delete mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs delete mode 100644 sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs.meta diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher.meta b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher.meta deleted file mode 100644 index 066864af3..000000000 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 0204c3f97423296498dc89d386410d43 -folderAsset: yes -timeCreated: 1492513991 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE deleted file mode 100644 index 8dada3eda..000000000 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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 - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md deleted file mode 100644 index a82c0f562..000000000 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# UnityMainThreadDispatcher - -A thread-safe way of dispatching IEnumerator functions to the main thread in unity. Useful for calling UI functions and other actions that Unity limits to the main thread from different threads. -### Version -1.0 - Tested and functional in one or more production mobile games (including https://get-wrecked.com) - -### Installation - -No dependencies needed other than Unity. This script was created in Unity 5.3, and has been tested in 5.3 through 5.6. - -Just download the UnityMainThreadDispatcher.cs script, and you're done. -The script adds a singleton runner to the scene on it's own when you enter play mode, so you don't need to do anything to start using the static methods from the script. - - -### Usage -```C# - public IEnumerator ThisWillBeExecutedOnTheMainThread() { - Debug.Log ("This is executed from the main thread"); - yield return null; - } - public void ExampleMainThreadCall() { - UnityMainThreadDispatcher.Enqueue(ThisWillBeExecutedOnTheMainThread()); - } -``` -OR - -```C# - UnityMainThreadDispatcher.Enqueue(() => Debug.Log ("This is executed from the main thread")); -``` -### Development - -Want to contribute? Great! If you find a bug or want to make improvements, simply fork the repo and make a pull request with your changes on your own fork. - -### Author -@PimDeWitte, Special thanks to: -https://github.com/Fireforge -https://github.com/Baste-RainGames -https://github.com/aphex- -https://github.com/bbuanes - -For amazing contributions and architectural decisions. - - - - - - diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs deleted file mode 100644 index d054ed2ff..000000000 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright 2015 Pim de Witte 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. -*/ - -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; - -/// Author: Pim de Witte (pimdewitte.com) and contributors -/// -/// A thread-safe class which holds a queue with actions to execute on the next Update() method. It can be used to make calls to the main thread for -/// things such as UI Manipulation in Unity. It was developed for use in combination with the Firebase Unity plugin, which uses separate threads for event handling -/// -public class UnityMainThreadDispatcher : MonoBehaviour { - - private static readonly Queue _executionQueue = new Queue(); - private static UnityMainThreadDispatcher _instance; - - /// - /// Locks the queue and adds the IEnumerator to the queue - /// - /// IEnumerator function that will be executed from the main thread. - public static void Enqueue(IEnumerator action) { - lock (_executionQueue) { - _executionQueue.Enqueue(action); - } - } - - /// - /// Locks the queue and adds the Action to the queue - /// - /// function that will be executed from the main thread. - public static void Enqueue(Action action) { - Enqueue(_instance.ActionWrapper(action)); - } - - - private void Awake() { - if (_instance != null) { - Destroy(gameObject); - } - else { - _instance = this; - } - } - - private void Update() { - lock(_executionQueue) { - while (_executionQueue.Count > 0) { - StartCoroutine(_executionQueue.Dequeue()); - } - } - } - - IEnumerator ActionWrapper(Action a) { - a(); - yield return null; - } -} - diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs.meta b/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs.meta deleted file mode 100644 index cdfc1ce16..000000000 --- a/sdkproject/Assets/ThirdPartyAssets/UnityMainThreadDispatcher/UnityMainThreadDispatcher.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 16173428f7358476fa784f899e396692 -timeCreated: 1459554404 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: From 792adabfed3af260f7e1b52aeedcf144d663f65f Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Wed, 3 May 2017 14:04:36 +0200 Subject: [PATCH 17/25] fixes for latest mapbox-sdk-cs multithreaded HTTPRequets --- .../Factories/MapImageFactory.cs | 2 +- .../MeshGeneration/Factories/MeshFactory.cs | 27 ++++++++++--------- .../Factories/TerrainFactory.cs | 2 +- .../Playground/Scripts/RasterTileExample.cs | 2 +- .../Playground/Scripts/VectorTileExample.cs | 2 +- .../Examples/Voxels/Scripts/VoxelTile.cs | 4 +-- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/MapImageFactory.cs b/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/MapImageFactory.cs index 4f6ad271c..7a8b64bc7 100644 --- a/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/MapImageFactory.cs +++ b/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/MapImageFactory.cs @@ -72,7 +72,7 @@ private void Run(UnityTile tile) var rasterTile = parameters.MapId.StartsWith("mapbox://") ? new RasterTile() : new ClassicRasterTile(); rasterTile.Initialize(parameters, (Action)(() => { - if (rasterTile.Error != null) + if (rasterTile.HasError) { tile.ImageDataState = TilePropertyState.Error; return; diff --git a/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/MeshFactory.cs b/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/MeshFactory.cs index 31704b475..fae3d643e 100644 --- a/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/MeshFactory.cs +++ b/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/MeshFactory.cs @@ -1,17 +1,18 @@ namespace Mapbox.Unity.MeshGeneration.Factories { - using System.Collections.Generic; - using UnityEngine; - using Mapbox.Unity.MeshGeneration.Enums; - using Mapbox.Unity.MeshGeneration.Data; - using Mapbox.Unity.MeshGeneration.Interfaces; - using Mapbox.Platform; + using System.Collections.Generic; + using UnityEngine; + using Mapbox.Unity.MeshGeneration.Enums; + using Mapbox.Unity.MeshGeneration.Data; + using Mapbox.Unity.MeshGeneration.Interfaces; + using Mapbox.Platform; + using System.Linq; - /// - /// Uses vector tile api to visualize vector data. - /// Fetches the vector data for given tile and passes layer data to layer visualizers. - /// - [CreateAssetMenu(menuName = "Mapbox/Factories/Mesh Factory")] + /// + /// Uses vector tile api to visualize vector data. + /// Fetches the vector data for given tile and passes layer data to layer visualizers. + /// + [CreateAssetMenu(menuName = "Mapbox/Factories/Mesh Factory")] public class MeshFactory : Factory { [SerializeField] @@ -107,9 +108,9 @@ private void CreateMeshes(UnityTile tile, object e) var vectorTile = new Mapbox.Map.VectorTile(); vectorTile.Initialize(parameters, () => { - if (vectorTile.Error != null) + if (vectorTile.HasError) { - Debug.Log(vectorTile.Error); + Debug.Log(string.Join(System.Environment.NewLine, vectorTile.Exceptions.Select(ex=>ex.Message).ToArray())); return; } diff --git a/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/TerrainFactory.cs b/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/TerrainFactory.cs index a6dae00f0..6a4cd6e6c 100644 --- a/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/TerrainFactory.cs +++ b/sdkproject/Assets/Mapbox/Core/Unity/MeshGeneration/Factories/TerrainFactory.cs @@ -112,7 +112,7 @@ private void CreateTerrainHeight(UnityTile tile, float heightMultiplier = 1) var pngRasterTile = new RawPngRasterTile(); pngRasterTile.Initialize(parameters, () => { - if (pngRasterTile.Error != null) + if (pngRasterTile.HasError) { tile.HeightDataState = TilePropertyState.Error; return; diff --git a/sdkproject/Assets/Mapbox/Examples/Playground/Scripts/RasterTileExample.cs b/sdkproject/Assets/Mapbox/Examples/Playground/Scripts/RasterTileExample.cs index c08d5aa96..ddd13065d 100644 --- a/sdkproject/Assets/Mapbox/Examples/Playground/Scripts/RasterTileExample.cs +++ b/sdkproject/Assets/Mapbox/Examples/Playground/Scripts/RasterTileExample.cs @@ -118,7 +118,7 @@ void ToggleDropdownStyles(int target) /// Tile. public void OnNext(RasterTile tile) { - if (tile.CurrentState != Tile.State.Loaded || tile.Error != null) + if (tile.CurrentState != Tile.State.Loaded || tile.HasError) { return; } diff --git a/sdkproject/Assets/Mapbox/Examples/Playground/Scripts/VectorTileExample.cs b/sdkproject/Assets/Mapbox/Examples/Playground/Scripts/VectorTileExample.cs index a69241de7..24da900ed 100644 --- a/sdkproject/Assets/Mapbox/Examples/Playground/Scripts/VectorTileExample.cs +++ b/sdkproject/Assets/Mapbox/Examples/Playground/Scripts/VectorTileExample.cs @@ -80,7 +80,7 @@ void Redraw() /// Tile. public void OnNext(VectorTile tile) { - if (tile.CurrentState != Tile.State.Loaded || tile.Error != null) + if (tile.CurrentState != Tile.State.Loaded || tile.HasError) { return; } diff --git a/sdkproject/Assets/Mapbox/Examples/Voxels/Scripts/VoxelTile.cs b/sdkproject/Assets/Mapbox/Examples/Voxels/Scripts/VoxelTile.cs index 3ad580043..659c69ee8 100644 --- a/sdkproject/Assets/Mapbox/Examples/Voxels/Scripts/VoxelTile.cs +++ b/sdkproject/Assets/Mapbox/Examples/Voxels/Scripts/VoxelTile.cs @@ -116,7 +116,7 @@ void FetchWorldData(Vector2d coordinates) public void OnNext(RasterTile tile) { - if (tile.CurrentState == Tile.State.Loaded && string.IsNullOrEmpty(tile.Error)) + if (tile.CurrentState == Tile.State.Loaded && !tile.HasError) { _rasterTexture = new Texture2D(2, 2); _rasterTexture.LoadImage(tile.Data); @@ -131,7 +131,7 @@ public void OnNext(RasterTile tile) public void OnNext(RawPngRasterTile tile) { - if (tile.CurrentState == Tile.State.Loaded && string.IsNullOrEmpty(tile.Error)) + if (tile.CurrentState == Tile.State.Loaded && !tile.HasError) { _elevationTexture = new Texture2D(2, 2); _elevationTexture.LoadImage(tile.Data); From 2802a74d309f1d8d09fce0f356fb25fa6c499e07 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Wed, 3 May 2017 14:04:59 +0200 Subject: [PATCH 18/25] UnityToolbagDispatcher: UWP fix --- .../UnityToolbagDispatcher/Dispatcher.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs index 3d8cda959..bef203416 100644 --- a/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs +++ b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs @@ -33,6 +33,7 @@ public static bool isMainThread { /// /// The action to be queued. public static void InvokeAsync(Action action) { + if (!_instanceExists) { Debug.LogError("No Dispatcher exists in the scene. Actions will not be invoked!"); return; @@ -54,11 +55,13 @@ public static void InvokeAsync(Action action) { /// /// The action to be queued. public static void Invoke(Action action) { + if (!_instanceExists) { Debug.LogError("No Dispatcher exists in the scene. Actions will not be invoked!"); return; } + bool hasRun = false; InvokeAsync(() => { @@ -68,7 +71,11 @@ public static void Invoke(Action action) { // Lock until the action has run while (!hasRun) { +#if !NETFX_CORE Thread.Sleep(5); +#else + System.Threading.Tasks.Task.Delay(5).Wait(); +#endif } } @@ -89,7 +96,7 @@ void OnDestroy() { } } - int cnt = 0; + //int cnt = 0; void Update() { //cnt++; //if (cnt < 100) { return; } From 7a94551c8422502fd025dbe20e8ccbb52ac77b17 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Thu, 4 May 2017 13:34:48 +0200 Subject: [PATCH 19/25] [wip] make UnityToolbag.Dispatcher work in Editor mode --- .../UnityToolbagDispatcher/Dispatcher.cs | 78 +++++++++++++++++-- 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs index bef203416..3d2246bee 100644 --- a/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs +++ b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs @@ -8,17 +8,26 @@ namespace UnityToolbag { /// A system for dispatching code to execute on the main thread. /// [AddComponentMenu("UnityToolbag/Dispatcher")] + [ExecuteInEditMode] + //[UnityEditor.InitializeOnLoad] public class Dispatcher : MonoBehaviour { + private static Dispatcher _instance; // We can't use the behaviour reference from other threads, so we use a separate bool // to track the instance so we can use that on the other threads. private static bool _instanceExists; + private static bool _enabled; + private static Thread _mainThread; private static object _lockObject = new object(); private static readonly Queue _actions = new Queue(); + //public Dispatcher() { + // UnityEngine.Debug.Log("Dispatcher()"); + //} + /// /// Gets a value indicating whether or not the current thread is the game's main thread. /// @@ -34,6 +43,12 @@ public static bool isMainThread { /// The action to be queued. public static void InvokeAsync(Action action) { + UnityEngine.Debug.Log(string.Format( + "InvokeAsync, enabled:{0} instanceExists:{1} mainthread:{2}" + , _enabled + , _instanceExists + , null == _mainThread ? "NULL" : _mainThread.ManagedThreadId.ToString() + )); if (!_instanceExists) { Debug.LogError("No Dispatcher exists in the scene. Actions will not be invoked!"); return; @@ -56,12 +71,13 @@ public static void InvokeAsync(Action action) { /// The action to be queued. public static void Invoke(Action action) { + UnityEngine.Debug.Log(string.Format("Invoke, enabled:{0} instanceExists:{1}", _enabled, _instanceExists)); + if (!_instanceExists) { Debug.LogError("No Dispatcher exists in the scene. Actions will not be invoked!"); return; } - bool hasRun = false; InvokeAsync(() => { @@ -80,34 +96,80 @@ public static void Invoke(Action action) { } void Awake() { + System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(true); + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + for (int i = 0; i < st.FrameCount; i++) { + System.Diagnostics.StackFrame sf = st.GetFrame(i); + sb.AppendLine(sf.GetMethod().ToString() + " " + sf.GetFileName() + " " + sf.GetFileLineNumber() + " " + sf.GetFileColumnNumber()); + } + UnityEngine.Debug.Log("Awake()" + Environment.NewLine + sb.ToString()); + +#if UNITY_EDITOR + if (Application.isEditor && !Application.isPlaying) { + UnityEngine.Debug.Log("Awake(), hooking into EditorUpdate"); + UnityEditor.EditorApplication.update += EditorUpdate; + } +#endif if (_instance) { + UnityEngine.Debug.Log("Awake() destroying instance"); DestroyImmediate(this); } else { + UnityEngine.Debug.Log("Awake() creating instance"); _instance = this; + //_instance = Mapbox.Unity.Utilities.Singleton.Instance; _instanceExists = true; _mainThread = Thread.CurrentThread; } + + UnityEngine.Debug.Log(string.Format( + "Awake(), enabled:{0} instanceExists:{1} mainthread:{2}" + , _enabled + , _instanceExists + , null == _mainThread ? "NULL" : _mainThread.ManagedThreadId.ToString() + )); } + void OnDestroy() { + UnityEngine.Debug.Log("OnDestroy()"); +#if UNITY_EDITOR + if (Application.isEditor && !Application.isPlaying) { + UnityEngine.Debug.Log("Awake(), disconnecting EditorUpdate"); + UnityEditor.EditorApplication.update -= EditorUpdate; + } +#endif if (_instance == this) { _instance = null; _instanceExists = false; } } - //int cnt = 0; - void Update() { - //cnt++; - //if (cnt < 100) { return; } - //cnt = 0; - ////if (_actions.Count > 0) UnityEngine.Debug.Log("-------------------- update -----------------" + DateTime.Now.Ticks); + + private void Update() { + UnityEngine.Debug.Log(string.Format("Update(), enabled:{0} instanceExists:{1}", _enabled, _instanceExists)); + MyUpdate(); + } + + + private void EditorUpdate() { + UnityEngine.Debug.Log(string.Format("EditorUpdate(), enabled:{0} instanceExists:{1}", _enabled, _instanceExists)); + MyUpdate(); + } + + void MyUpdate() { lock (_lockObject) { while (_actions.Count > 0) { - //UnityEngine.Debug.Log("QUEUE: " + _actions.Count + " " + DateTime.Now.Ticks); _actions.Dequeue()(); } } } + + + //private void OnEnable() { + // UnityEngine.Debug.Log("======== OnEnable() =========="); + // _enabled = true; + //} + + } } From d337a8aa1c27846e925a80cdbe328c65103420dd Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Fri, 5 May 2017 08:04:05 +0200 Subject: [PATCH 20/25] revert UnityToolbag.Dispatcher --- .../UnityToolbagDispatcher/Dispatcher.cs | 78 ++----------------- 1 file changed, 8 insertions(+), 70 deletions(-) diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs index 3d2246bee..bef203416 100644 --- a/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs +++ b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs @@ -8,26 +8,17 @@ namespace UnityToolbag { /// A system for dispatching code to execute on the main thread. /// [AddComponentMenu("UnityToolbag/Dispatcher")] - [ExecuteInEditMode] - //[UnityEditor.InitializeOnLoad] public class Dispatcher : MonoBehaviour { - private static Dispatcher _instance; // We can't use the behaviour reference from other threads, so we use a separate bool // to track the instance so we can use that on the other threads. private static bool _instanceExists; - private static bool _enabled; - private static Thread _mainThread; private static object _lockObject = new object(); private static readonly Queue _actions = new Queue(); - //public Dispatcher() { - // UnityEngine.Debug.Log("Dispatcher()"); - //} - /// /// Gets a value indicating whether or not the current thread is the game's main thread. /// @@ -43,12 +34,6 @@ public static bool isMainThread { /// The action to be queued. public static void InvokeAsync(Action action) { - UnityEngine.Debug.Log(string.Format( - "InvokeAsync, enabled:{0} instanceExists:{1} mainthread:{2}" - , _enabled - , _instanceExists - , null == _mainThread ? "NULL" : _mainThread.ManagedThreadId.ToString() - )); if (!_instanceExists) { Debug.LogError("No Dispatcher exists in the scene. Actions will not be invoked!"); return; @@ -71,13 +56,12 @@ public static void InvokeAsync(Action action) { /// The action to be queued. public static void Invoke(Action action) { - UnityEngine.Debug.Log(string.Format("Invoke, enabled:{0} instanceExists:{1}", _enabled, _instanceExists)); - if (!_instanceExists) { Debug.LogError("No Dispatcher exists in the scene. Actions will not be invoked!"); return; } + bool hasRun = false; InvokeAsync(() => { @@ -96,80 +80,34 @@ public static void Invoke(Action action) { } void Awake() { - System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(true); - System.Text.StringBuilder sb = new System.Text.StringBuilder(); - for (int i = 0; i < st.FrameCount; i++) { - System.Diagnostics.StackFrame sf = st.GetFrame(i); - sb.AppendLine(sf.GetMethod().ToString() + " " + sf.GetFileName() + " " + sf.GetFileLineNumber() + " " + sf.GetFileColumnNumber()); - } - UnityEngine.Debug.Log("Awake()" + Environment.NewLine + sb.ToString()); - -#if UNITY_EDITOR - if (Application.isEditor && !Application.isPlaying) { - UnityEngine.Debug.Log("Awake(), hooking into EditorUpdate"); - UnityEditor.EditorApplication.update += EditorUpdate; - } -#endif if (_instance) { - UnityEngine.Debug.Log("Awake() destroying instance"); DestroyImmediate(this); } else { - UnityEngine.Debug.Log("Awake() creating instance"); _instance = this; - //_instance = Mapbox.Unity.Utilities.Singleton.Instance; _instanceExists = true; _mainThread = Thread.CurrentThread; } - - UnityEngine.Debug.Log(string.Format( - "Awake(), enabled:{0} instanceExists:{1} mainthread:{2}" - , _enabled - , _instanceExists - , null == _mainThread ? "NULL" : _mainThread.ManagedThreadId.ToString() - )); } - void OnDestroy() { - UnityEngine.Debug.Log("OnDestroy()"); -#if UNITY_EDITOR - if (Application.isEditor && !Application.isPlaying) { - UnityEngine.Debug.Log("Awake(), disconnecting EditorUpdate"); - UnityEditor.EditorApplication.update -= EditorUpdate; - } -#endif if (_instance == this) { _instance = null; _instanceExists = false; } } - - private void Update() { - UnityEngine.Debug.Log(string.Format("Update(), enabled:{0} instanceExists:{1}", _enabled, _instanceExists)); - MyUpdate(); - } - - - private void EditorUpdate() { - UnityEngine.Debug.Log(string.Format("EditorUpdate(), enabled:{0} instanceExists:{1}", _enabled, _instanceExists)); - MyUpdate(); - } - - void MyUpdate() { + //int cnt = 0; + void Update() { + //cnt++; + //if (cnt < 100) { return; } + //cnt = 0; + ////if (_actions.Count > 0) UnityEngine.Debug.Log("-------------------- update -----------------" + DateTime.Now.Ticks); lock (_lockObject) { while (_actions.Count > 0) { + //UnityEngine.Debug.Log("QUEUE: " + _actions.Count + " " + DateTime.Now.Ticks); _actions.Dequeue()(); } } } - - - //private void OnEnable() { - // UnityEngine.Debug.Log("======== OnEnable() =========="); - // _enabled = true; - //} - - } } From e3f1f6e8b0178fa69eab10e93e900b80437be8f2 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Fri, 5 May 2017 08:34:46 +0200 Subject: [PATCH 21/25] update mapbox-sdk-cs to use Mapbox.Unity.DispatcherEditor --- dependencies/mapbox-sdk-cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/mapbox-sdk-cs b/dependencies/mapbox-sdk-cs index c4c25a47c..f99f6c3b0 160000 --- a/dependencies/mapbox-sdk-cs +++ b/dependencies/mapbox-sdk-cs @@ -1 +1 @@ -Subproject commit c4c25a47cd881e704a3719d9fa695b59e2e61c18 +Subproject commit f99f6c3b0c0692dd9b0a42bcc6ba8b2dc442bf0a From 40d17d8b7366dba440988cd9473deb0c2fadbfcb Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Fri, 5 May 2017 09:50:46 +0200 Subject: [PATCH 22/25] UnityToolbag.Dispatcher: make '_instanceExists' public --- .../ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs index bef203416..c76ef5f1c 100644 --- a/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs +++ b/sdkproject/Assets/ThirdPartyAssets/UnityToolbagDispatcher/Dispatcher.cs @@ -13,7 +13,8 @@ public class Dispatcher : MonoBehaviour { // We can't use the behaviour reference from other threads, so we use a separate bool // to track the instance so we can use that on the other threads. - private static bool _instanceExists; + // edit by BergWerkGIS: make public to see if dispatcher is attached + public static bool _instanceExists; private static Thread _mainThread; private static object _lockObject = new object(); From cbbda55c040bcb6ea4efa1a54daa12663d67ebe2 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Fri, 5 May 2017 09:51:05 +0200 Subject: [PATCH 23/25] add Mapbox.Unity.DispatcherEditor.cs --- .../Core/Unity/Utilities/DispatcherEditor.cs | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 sdkproject/Assets/Mapbox/Core/Unity/Utilities/DispatcherEditor.cs diff --git a/sdkproject/Assets/Mapbox/Core/Unity/Utilities/DispatcherEditor.cs b/sdkproject/Assets/Mapbox/Core/Unity/Utilities/DispatcherEditor.cs new file mode 100644 index 000000000..55f57bc3e --- /dev/null +++ b/sdkproject/Assets/Mapbox/Core/Unity/Utilities/DispatcherEditor.cs @@ -0,0 +1,51 @@ +namespace Mapbox.Unity { + + + using System; + using System.Collections.Generic; + using System.Threading; + using UnityEditor; + + + [InitializeOnLoad] + public static class DispatcherEditor { + + + static DispatcherEditor() { + _mainThread = Thread.CurrentThread; + EditorApplication.update += Update; + } + + + private static object _lock = new object(); + private static readonly Queue _actions = new Queue(); + private static Thread _mainThread; + + + private static bool isMainThread { + get { return Thread.CurrentThread == _mainThread; } + } + + + public static void Update() { + lock (_lock) { + while (_actions.Count > 0) { + _actions.Dequeue()(); + } + } + } + + + public static void InvokeAsync(Action action) { + if (isMainThread) { + action(); + }else { + lock (_lock) { + _actions.Enqueue(action); + } + } + } + + + } +} \ No newline at end of file From 399c0359bda372d7af40a269dd483e7f0298eb28 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Mon, 8 May 2017 14:39:34 +0200 Subject: [PATCH 24/25] update mapbox-sdk-cs to latest IAsyncRequestFactory branch --- dependencies/mapbox-sdk-cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/mapbox-sdk-cs b/dependencies/mapbox-sdk-cs index f99f6c3b0..474ee6598 160000 --- a/dependencies/mapbox-sdk-cs +++ b/dependencies/mapbox-sdk-cs @@ -1 +1 @@ -Subproject commit f99f6c3b0c0692dd9b0a42bcc6ba8b2dc442bf0a +Subproject commit 474ee6598697c8106b8ae1806332cc0548f67bf7 From 02f8e0513b879343c0de6d4774c229a4f4d0e054 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Tue, 9 May 2017 12:44:44 +0200 Subject: [PATCH 25/25] update to latest mapbox-sdk-cs@IAsyncFactory --- dependencies/mapbox-sdk-cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/mapbox-sdk-cs b/dependencies/mapbox-sdk-cs index 474ee6598..4824dab71 160000 --- a/dependencies/mapbox-sdk-cs +++ b/dependencies/mapbox-sdk-cs @@ -1 +1 @@ -Subproject commit 474ee6598697c8106b8ae1806332cc0548f67bf7 +Subproject commit 4824dab71812725cf34859f77757f5786cb3b6b4