public void RefreshData() { if (Singleton <BuildingManager> .exists) { m_prefixesServedList = TLMDepotAI.getPrefixesServedByDepot(m_buildingID); if (m_prefixesServedList == null) { GameObject.Destroy(gameObject); return; } bool isRowVisible; isRowVisible = TLMPublicTransportDetailPanel.instance.isOnCurrentPrefixFilter(m_prefixesServedList); if (!isRowVisible) { GetComponent <UIComponent>().isVisible = false; return; } GetComponent <UIComponent>().isVisible = true; Building b = Singleton <BuildingManager> .instance.m_buildings.m_buffer[this.m_buildingID]; this.m_depotName.text = Singleton <BuildingManager> .instance.GetBuildingName(this.m_buildingID, default(InstanceID)); byte districtID = Singleton <DistrictManager> .instance.GetDistrict(b.m_position); string districtName = districtID == 0 ? Locale.Get("TLM_DISTRICT_NONE") : Singleton <DistrictManager> .instance.GetDistrictName(districtID); this.m_districtName.text = districtName; //prefix this.m_prefixesServed.text = TLMUtils.getPrefixesServedAbstract(this.m_buildingID); List <string> prefixOptions = TLMUtils.getDepotPrefixesOptions(TLMCW.getConfigIndexForTransportInfo((b.Info.GetAI() as DepotAI).m_transportInfo)); prefixOptions.Add(Locale.Get("TLM_REGIONAL")); if (this.m_prefixOptions.items.Length != prefixOptions.Count) { this.m_prefixOptions.items = prefixOptions.ToArray(); onChangePrefixSelected(m_prefixOptions.selectedIndex); } } }
private void updateDepotEditShortcutButton(UIPanel parent) { if (parent != null) { UIButton depotShortcut = parent.Find <UIButton>("TLMDepotShortcut"); if (!depotShortcut) { depotShortcut = initDepotShortcutOnWorldInfoPanel(parent); } var prop = typeof(WorldInfoPanel).GetField("m_InstanceID", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); ushort buildingId = ((InstanceID)(prop.GetValue(parent.gameObject.GetComponent <WorldInfoPanel>()))).Building; if (Singleton <BuildingManager> .instance.m_buildings.m_buffer[buildingId].Info.GetAI() as DepotAI != null) { depotShortcut.isVisible = true; UILabel label = depotShortcut.GetComponentInChildren <UILabel>(); label.text = TLMUtils.getPrefixesServedAbstract(buildingId); } else { depotShortcut.isVisible = false; } } }