private void ShowAddressData(string addressId, Button button) { button.onClick.RemoveAllListeners(); //TODO, add groupable dropdrown that shows/hides the following fields at below the selected object StartCoroutine(ImportBAG.GetAddressData(addressId, (addressData) => { //Create group under button GameObject group = Interface.SidePanel.PropertiesPanel.Instance.CreateGroup(); group.transform.SetSiblingIndex(button.transform.GetSiblingIndex() + 1); //Next click closes (and removes) group again button.onClick.AddListener((() => { Destroy(group.gameObject); button.onClick.RemoveAllListeners(); button.onClick.AddListener((() => ShowAddressData(addressId, button))); })); Interface.SidePanel.PropertiesPanel.Instance.AddSeperatorLine(); Interface.SidePanel.PropertiesPanel.Instance.AddDataField("BAG ID", addressData.nummeraanduidingidentificatie); Interface.SidePanel.PropertiesPanel.Instance.AddDataField("Adres", addressData.adres + addressData.huisletter); Interface.SidePanel.PropertiesPanel.Instance.AddDataField("", addressData.postcode + ", " + addressData.woonplaats._display); Interface.SidePanel.PropertiesPanel.Instance.AddLink("Meer adres informatie", Config.activeConfiguration.moreAddressInfoUrl.Replace("{bagid}", addressData.nummeraanduidingidentificatie)); Interface.SidePanel.PropertiesPanel.Instance.AddSeperatorLine(); Interface.SidePanel.PropertiesPanel.Instance.CloseGroup(); })); }
/// <summary> /// Generates all premises buttons. If there is only 1 premises it will show just that premises /// </summary> /// <param name="pandData"></param> public void ShowBuildingData(string bagId) { if (bagId.Length < 5) { return; } StopAllCoroutines(); //Make sure all delayed Api coroutines are stopped before running this one again StartCoroutine(ImportBAG.GetBuildingData(bagId, (buildingData) => { EstimateBuildingThumbnailFrame(buildingData); Interface.SidePanel.PropertiesPanel.Instance.AddTitle("Pand " + bagId); Interface.SidePanel.PropertiesPanel.Instance.AddDataField("BAG ID", buildingData._display); Interface.SidePanel.PropertiesPanel.Instance.AddDataField("Stadsdeel", buildingData._stadsdeel.naam); Interface.SidePanel.PropertiesPanel.Instance.AddDataField("Wijk", buildingData._buurtcombinatie.naam); Interface.SidePanel.PropertiesPanel.Instance.AddDataField("Buurt", buildingData._buurt.naam); Interface.SidePanel.PropertiesPanel.Instance.AddDataField("Bouwjaar", buildingData.oorspronkelijk_bouwjaar); Interface.SidePanel.PropertiesPanel.Instance.AddDataField("Bouwlagen", buildingData.bouwlagen.ToString()); Interface.SidePanel.PropertiesPanel.Instance.AddDataField("Verblijfsobjecten", buildingData.verblijfsobjecten.count.ToString()); Interface.SidePanel.PropertiesPanel.Instance.AddLink("Meer pand informatie", Config.activeConfiguration.moreBuildingInfoUrl.Replace("{bagid}", buildingData._display)); Interface.SidePanel.PropertiesPanel.Instance.AddSeperatorLine(); //Load up the list of addresses tied to this building (in a Seperate API call) Interface.SidePanel.PropertiesPanel.Instance.AddTitle("Adressen"); StartCoroutine(ImportBAG.GetBuildingAdresses(bagId, (addressList) => { foreach (var address in addressList.results) { //We create a field and make it clickable, so addresses cant contain more data var dataKeyAndValue = Interface.SidePanel.PropertiesPanel.Instance.AddDataField(address._display, ""); var button = dataKeyAndValue.GetComponent <Button>(); button.onClick.AddListener((() => ShowAddressData(address.landelijk_id, button))); } })); })); }