diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index f93fb5b03..296e2a464 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -4557,19 +4557,19 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FeatureLinks: - - name: Searching by address -> ToggleSearch (GameObject) + - name: Zoeken op adres -> ToggleSearch (GameObject) feature: {fileID: 11400000, guid: 3684ee2c206979e4783d50e0c07322b3, type: 2} component: {fileID: 165824982} action: 1 - - name: Show buildings -> Buildings (GameObject) + - name: Toon gebouwen -> Buildings (GameObject) feature: {fileID: 11400000, guid: 621d91ece5b6d0145a271a1899949cdd, type: 2} component: {fileID: 1625012860} action: 1 - - name: Show terrain -> Terrain (GameObject) + - name: Toon het maaiveld -> Terrain (GameObject) feature: {fileID: 11400000, guid: 388ed5cdb7e3bc94d9f8b15243890251, type: 2} component: {fileID: 950477402} action: 1 - - name: Show neighbourhoods -> NeighbourhoodNames (GameObject) + - name: Toon namen van wijken -> NeighbourhoodNames (GameObject) feature: {fileID: 11400000, guid: cd4d713ac36eed3478e85868b1e0e0f9, type: 2} component: {fileID: 2135947165} action: 1 @@ -4577,7 +4577,7 @@ MonoBehaviour: feature: {fileID: 11400000, guid: 028a24369ee97184fa88b9716c686d0d, type: 2} component: {fileID: 2129315138} action: 1 - - name: Make screenshots -> ToggleSnapshot (GameObject) + - name: Maak screenshots -> ToggleSnapshot (GameObject) feature: {fileID: 11400000, guid: ff7d5f7ae5009d24c869aa8086473845, type: 2} component: {fileID: 1601663924} action: 1 @@ -4585,23 +4585,23 @@ MonoBehaviour: feature: {fileID: 11400000, guid: 42464fdf892b6b245a26a6156b70ed6d, type: 2} component: {fileID: 1585974259} action: 1 - - name: Traffic Simulation -> ToggleImportFile (GameObject) + - name: Verkeerssimulatie -> ToggleImportFile (GameObject) feature: {fileID: 11400000, guid: e649b402ab73d1144a36dfc3d3213136, type: 2} component: {fileID: 215354644} action: 1 - - name: Show Trees -> Trees (GameObject) + - name: Toon bomen -> Trees (GameObject) feature: {fileID: 11400000, guid: 8b0d3742935095d48941c64dd41343c0, type: 2} component: {fileID: 273624541} action: 1 - - name: Show Streetnames -> StreetNames (GameObject) + - name: Toon straatnamen -> StreetNames (GameObject) feature: {fileID: 11400000, guid: 2baaa0e46661c6248a5938b6b2c47544, type: 2} component: {fileID: 977031950} action: 1 - - name: Sun -> ToggleSunSettings (GameObject) + - name: Stel de zonnestand en schaduwen in -> ToggleSunSettings (GameObject) feature: {fileID: 11400000, guid: dbd04a92726eed247b22c8dc9eb160d8, type: 2} component: {fileID: 68587761} action: 1 - - name: Object Importer -> ToggleImportFile (GameObject) + - name: Importeer .obj bestanden -> ToggleImportFile (GameObject) feature: {fileID: 11400000, guid: 0ec3b91944ad94ebe98ebb1e0c1b25a3, type: 2} component: {fileID: 215354644} action: 1 diff --git a/Assets/Scriptables/Configuration.asset b/Assets/Scriptables/Configuration.asset index 1471a55d1..32276fb12 100644 --- a/Assets/Scriptables/Configuration.asset +++ b/Assets/Scriptables/Configuration.asset @@ -23,6 +23,7 @@ MonoBehaviour: - {fileID: 11400000, guid: e649b402ab73d1144a36dfc3d3213136, type: 2} - {fileID: 11400000, guid: ff7d5f7ae5009d24c869aa8086473845, type: 2} - {fileID: 11400000, guid: 0ec3b91944ad94ebe98ebb1e0c1b25a3, type: 2} + - {fileID: 11400000, guid: 444a73f31e87cd24c949922222c1927e, type: 2} OnOriginChanged: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Scriptables/Configurator.asset b/Assets/Scriptables/Configurator.asset index 13cc6ccbf..4fd84ab45 100644 --- a/Assets/Scriptables/Configurator.asset +++ b/Assets/Scriptables/Configurator.asset @@ -14,7 +14,7 @@ MonoBehaviour: m_EditorClassIdentifier: configuration: {fileID: 11400000, guid: ef4fdd9a7713bc0458843a4884b6e1c5, type: 2} setupSceneName: SetupWizard - debugUrl: + debugUrl: https://localhost/?origin=161088,503050,500&features=terrain,buildings,sun,indicators&indicators.dossier=provincie-utrecht/mike_test OnLoaded: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Scriptables/Features/Address Search.asset b/Assets/Scriptables/Features/Address Search.asset index cdfeb625c..940b1fb5d 100644 --- a/Assets/Scriptables/Features/Address Search.asset +++ b/Assets/Scriptables/Features/Address Search.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Address Search m_EditorClassIdentifier: Id: address-search - Caption: Searching by address + Caption: Zoeken op adres + configuration: {fileID: 0} isEnabled: 0 OnEnable: m_PersistentCalls: diff --git a/Assets/Scriptables/Features/Buildings.asset b/Assets/Scriptables/Features/Buildings.asset index 4d3835448..40a27bbd0 100644 --- a/Assets/Scriptables/Features/Buildings.asset +++ b/Assets/Scriptables/Features/Buildings.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Buildings m_EditorClassIdentifier: Id: buildings - Caption: Show buildings + Caption: Toon gebouwen + configuration: {fileID: 0} isEnabled: 1 OnEnable: m_PersistentCalls: diff --git a/Assets/Scriptables/Features/Configuration.meta b/Assets/Scriptables/Features/Configuration.meta new file mode 100644 index 000000000..c1459953b --- /dev/null +++ b/Assets/Scriptables/Features/Configuration.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c1b09ec4204c6e45ae4c0dd3d915807 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scriptables/Features/Configuration/Indicators.asset b/Assets/Scriptables/Features/Configuration/Indicators.asset new file mode 100644 index 000000000..e0b8d49a4 --- /dev/null +++ b/Assets/Scriptables/Features/Configuration/Indicators.asset @@ -0,0 +1,15 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b3ac3af9b31848fbb79dea303905e803, type: 3} + m_Name: Indicators + m_EditorClassIdentifier: + dossierId: diff --git a/Assets/Scriptables/Features/Configuration/Indicators.asset.meta b/Assets/Scriptables/Features/Configuration/Indicators.asset.meta new file mode 100644 index 000000000..a6ca74fee --- /dev/null +++ b/Assets/Scriptables/Features/Configuration/Indicators.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9649637ffb6f9c24da61c215efe6adaa +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scriptables/Features/Indicators.asset b/Assets/Scriptables/Features/Indicators.asset new file mode 100644 index 000000000..07db09cfe --- /dev/null +++ b/Assets/Scriptables/Features/Indicators.asset @@ -0,0 +1,24 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 714e859e1c414d479484fe937804ce24, type: 3} + m_Name: Indicators + m_EditorClassIdentifier: + Id: indicators + Caption: Indicatoren + configuration: {fileID: 11400000, guid: 9649637ffb6f9c24da61c215efe6adaa, type: 2} + isEnabled: 0 + OnEnable: + m_PersistentCalls: + m_Calls: [] + OnDisable: + m_PersistentCalls: + m_Calls: [] diff --git a/Assets/Scriptables/Features/Indicators.asset.meta b/Assets/Scriptables/Features/Indicators.asset.meta new file mode 100644 index 000000000..7fb01b05c --- /dev/null +++ b/Assets/Scriptables/Features/Indicators.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 444a73f31e87cd24c949922222c1927e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scriptables/Features/Neighbourhoods.asset b/Assets/Scriptables/Features/Neighbourhoods.asset index 316d3708a..93d850119 100644 --- a/Assets/Scriptables/Features/Neighbourhoods.asset +++ b/Assets/Scriptables/Features/Neighbourhoods.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Neighbourhoods m_EditorClassIdentifier: Id: neighbourhoods - Caption: Show neighbourhoods + Caption: Toon namen van wijken + configuration: {fileID: 0} isEnabled: 0 OnEnable: m_PersistentCalls: diff --git a/Assets/Scriptables/Features/Obj Importer.asset b/Assets/Scriptables/Features/Obj Importer.asset index e7149a9fc..9c104492b 100644 --- a/Assets/Scriptables/Features/Obj Importer.asset +++ b/Assets/Scriptables/Features/Obj Importer.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Obj Importer m_EditorClassIdentifier: Id: object-importer - Caption: Object Importer + Caption: Importeer .obj bestanden + configuration: {fileID: 0} isEnabled: 1 OnEnable: m_PersistentCalls: diff --git a/Assets/Scriptables/Features/Screenshots.asset b/Assets/Scriptables/Features/Screenshots.asset index d02a45e1e..32bc532ed 100644 --- a/Assets/Scriptables/Features/Screenshots.asset +++ b/Assets/Scriptables/Features/Screenshots.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Screenshots m_EditorClassIdentifier: Id: screenshot - Caption: Make screenshots + Caption: Maak screenshots + configuration: {fileID: 0} isEnabled: 0 OnEnable: m_PersistentCalls: diff --git a/Assets/Scriptables/Features/Streetnames.asset b/Assets/Scriptables/Features/Streetnames.asset index 95f8c7465..c2699e8e7 100644 --- a/Assets/Scriptables/Features/Streetnames.asset +++ b/Assets/Scriptables/Features/Streetnames.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Streetnames m_EditorClassIdentifier: Id: streets - Caption: Show Streetnames + Caption: Toon straatnamen + configuration: {fileID: 0} isEnabled: 0 OnEnable: m_PersistentCalls: diff --git a/Assets/Scriptables/Features/Sun.asset b/Assets/Scriptables/Features/Sun.asset index 9177b31b8..39df5b2bc 100644 --- a/Assets/Scriptables/Features/Sun.asset +++ b/Assets/Scriptables/Features/Sun.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Sun m_EditorClassIdentifier: Id: sun - Caption: Sun + Caption: Stel de zonnestand en schaduwen in + configuration: {fileID: 0} isEnabled: 0 OnEnable: m_PersistentCalls: diff --git a/Assets/Scriptables/Features/Terrain.asset b/Assets/Scriptables/Features/Terrain.asset index 8a56265ee..2bb21093b 100644 --- a/Assets/Scriptables/Features/Terrain.asset +++ b/Assets/Scriptables/Features/Terrain.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Terrain m_EditorClassIdentifier: Id: terrain - Caption: Show terrain + Caption: Toon het maaiveld + configuration: {fileID: 0} isEnabled: 1 OnEnable: m_PersistentCalls: diff --git a/Assets/Scriptables/Features/Traffic Simulation.asset b/Assets/Scriptables/Features/Traffic Simulation.asset index 3eb3b90f3..159ef21f8 100644 --- a/Assets/Scriptables/Features/Traffic Simulation.asset +++ b/Assets/Scriptables/Features/Traffic Simulation.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Traffic Simulation m_EditorClassIdentifier: Id: traffic - Caption: Traffic Simulation + Caption: Verkeerssimulatie + configuration: {fileID: 0} isEnabled: 0 OnEnable: m_PersistentCalls: diff --git a/Assets/Scriptables/Features/Trees.asset b/Assets/Scriptables/Features/Trees.asset index 8e18cb59b..78c1b9305 100644 --- a/Assets/Scriptables/Features/Trees.asset +++ b/Assets/Scriptables/Features/Trees.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Trees m_EditorClassIdentifier: Id: trees - Caption: Show Trees + Caption: Toon bomen + configuration: {fileID: 0} isEnabled: 0 OnEnable: m_PersistentCalls: diff --git a/Assets/Scripts/Configuration/Configuration.cs b/Assets/Scripts/Configuration/Configuration.cs index 1d1ede9fb..bca192a2e 100644 --- a/Assets/Scripts/Configuration/Configuration.cs +++ b/Assets/Scripts/Configuration/Configuration.cs @@ -4,26 +4,19 @@ using System.Linq; using System.Text; using Netherlands3D.Coordinates; +using Netherlands3D.Twin.Configuration.Indicators; using Netherlands3D.Twin.Features; using UnityEngine; using UnityEngine.Events; namespace Netherlands3D.Twin.Configuration { - public struct IndicatorConfiguration - { - public string dossierId; - } - [CreateAssetMenu(menuName = "Netherlands3D/Twin/Configuration", fileName = "Configuration", order = 0)] public class Configuration : ScriptableObject { - [SerializeField] - public string title = "Amersfoort"; - [SerializeField] - private Coordinate origin = new(CoordinateSystem.RD, 161088, 503050, 300); + [SerializeField] public string title = "Amersfoort"; + [SerializeField] private Coordinate origin = new(CoordinateSystem.RD, 161088, 503050, 300); public List Features = new(); - private IndicatorConfiguration indicatorConfiguration; public string Title { @@ -62,15 +55,31 @@ public bool LoadFromUrl(string url) LoadOriginFromString(queryParameters.Get("origin")); LoadFeaturesFromString(queryParameters.Get("features")); - indicatorConfiguration.dossierId = queryParameters.Get("indicators.dossier"); - if (indicatorConfiguration.dossierId != null) - { - OnDossierLoadingStart.Invoke(indicatorConfiguration.dossierId); - } + LoadIndicatorConfiguration(queryParameters); return true; } + private void LoadIndicatorConfiguration(NameValueCollection queryParameters) + { + var featureId = "indicators"; + var indicatorFeature = GetFeatureById(featureId); + if (!indicatorFeature) return; + + var indicatorConfiguration = indicatorFeature.configuration as Indicators.Configuration; + if (!indicatorConfiguration) return; + + indicatorConfiguration.dossierId = queryParameters.Get("indicators.dossier"); + if (indicatorConfiguration.dossierId == null) return; + + OnDossierLoadingStart.Invoke(indicatorConfiguration.dossierId); + } + + private Feature GetFeatureById(string featureId) + { + return Features.FirstOrDefault(feature => string.Equals(feature.Id, featureId)); + } + private bool UrlContainsConfiguration(NameValueCollection queryParameters) { string origin = queryParameters.Get("origin"); diff --git a/Assets/Scripts/Configuration/Indicators/Configuration.cs b/Assets/Scripts/Configuration/Indicators/Configuration.cs new file mode 100644 index 000000000..a10a4912d --- /dev/null +++ b/Assets/Scripts/Configuration/Indicators/Configuration.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace Netherlands3D.Twin.Configuration.Indicators +{ + [CreateAssetMenu(menuName = "Netherlands3D/Twin/Configuration/Indicators", fileName = "IndicatorConfiguration", order = 0)] + public class Configuration : ScriptableObject + { + public string dossierId; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Configuration/Indicators/Configuration.cs.meta b/Assets/Scripts/Configuration/Indicators/Configuration.cs.meta new file mode 100644 index 000000000..a9225dd6c --- /dev/null +++ b/Assets/Scripts/Configuration/Indicators/Configuration.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b3ac3af9b31848fbb79dea303905e803 +timeCreated: 1691645378 \ No newline at end of file diff --git a/Assets/Scripts/Configuration/Indicators/DossierLoader.cs b/Assets/Scripts/Configuration/Indicators/DossierLoader.cs index 0505690cc..7015cb95b 100644 --- a/Assets/Scripts/Configuration/Indicators/DossierLoader.cs +++ b/Assets/Scripts/Configuration/Indicators/DossierLoader.cs @@ -5,7 +5,7 @@ namespace Netherlands3D.Twin.Configuration.Indicators { public class DossierLoader : MonoBehaviour { - [SerializeField] private Configuration configuration; + [SerializeField] private Twin.Configuration.Configuration configuration; [SerializeField] private DossierSO dossier; private void OnEnable() diff --git a/Packages/eu.netherlands3d.twin-features/Scripts/Feature.cs b/Packages/eu.netherlands3d.twin-features/Scripts/Feature.cs index 9d45121d9..935c15ada 100644 --- a/Packages/eu.netherlands3d.twin-features/Scripts/Feature.cs +++ b/Packages/eu.netherlands3d.twin-features/Scripts/Feature.cs @@ -1,5 +1,7 @@ -using UnityEngine; +using Newtonsoft.Json; +using UnityEngine; using UnityEngine.Events; +using UnityEngine.Serialization; namespace Netherlands3D.Twin.Features { @@ -8,6 +10,9 @@ public class Feature : ScriptableObject { public string Id; public string Caption; + + [JsonProperty(TypeNameHandling = TypeNameHandling.Auto)] + public ScriptableObject configuration; [SerializeField] private bool isEnabled;