public static void Postfix(CityServiceWorldInfoPanel __instance) { InstanceID instanceID = (InstanceID)__instance.GetType() .GetField("m_InstanceID", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); var building = BuildingManager.instance.m_buildings.m_buffer[instanceID.Building].Info; if (building.GetService() == ItemClass.Service.FireDepartment || building.GetService() == ItemClass.Service.Garbage || building.GetService() == ItemClass.Service.HealthCare || building.GetService() == ItemClass.Service.Disaster || building.GetService() == ItemClass.Service.PoliceDepartment) { return; } if (BuildingHelper.DisplayDistrictsButton(building.m_buildingAI)) { return; } var toggleButton = __instance.component.Find("ServiceRestrictionToggleButton") as UIButton; if (toggleButton == null) { return; } toggleButton.isEnabled = false; toggleButton.tooltip = "Service Restrictions does not currently cover this building."; }
private InstanceID GetServiceInstanceId() { if (baseSub == null) { baseSub = servicePanel.GetType().GetField("m_InstanceID", BindingFlags.NonPublic | BindingFlags.Instance); } return((InstanceID)baseSub.GetValue(servicePanel)); }
private void AddButton(CityServiceWorldInfoPanel infoPanel, out UIButton button, Vector3 offset) { button = UIUtils.CreateToggleButton(infoPanel.component, offset, UIAlignAnchor.BottomLeft, (component, e) => { InstanceID instanceID = (InstanceID)infoPanel.GetType() .GetField("m_InstanceID", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(infoPanel); if (RestrictedDistrictsPanelWrapper == null || instanceID.Building != SelectedBuildingID) { RestrictedDistrictsPanelWrapper = instanceID.Building.GenerateDistrictsPanelWrapper(); } else { RestrictedDistrictsPanelWrapper.isVisible = false; UIUtils.DeepDestroy(RestrictedDistrictsPanelWrapper); } if (component.hasFocus) { component.Unfocus(); } }); }
static void Postfix(CityServiceWorldInfoPanel __instance) { Painter.instance.IsPanelVisible = true; Painter.instance.BuildingID = ((InstanceID)__instance.GetType().GetField("m_InstanceID", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance)).Building; Painter.instance.ColorFields[PanelType.Service].selectedColor = Painter.instance.GetColor(); }