private void AddDefaultBuildingPropertiesButton(WorldInfoPanel infoPanel, out UIButton button, Vector3 offset) { button = UiUtils.CreateToggleButton(infoPanel.component, offset, UIAlignAnchor.BottomLeft, (comp, e) => { PanelType = InfoPanelType.Default; InstanceID instanceID = InstanceHelper.GetInstanceID(infoPanel); var building = BuildingManager.instance.m_buildings.m_buffer[instanceID.Building].Info; try { if (CustomizeItExtendedPanel == null || building != CurrentSelectedBuilding) { CustomizeItExtendedPanel = building.GenerateCustomizeItExtendedPanel(); } else { CustomizeItExtendedPanel.isVisible = false; UiUtils.DeepDestroy(CustomizeItExtendedPanel); } } catch (Exception ex) { Debug.Log($"{ex.Message} - {ex.StackTrace}"); } if (comp.hasFocus) { comp.Unfocus(); } }); }
private void AddButton(CitizenWorldInfoPanel infoPanel, out UIButton button, Vector3 offSet) { button = UiUtils.CreateToggleButton(infoPanel.component, offSet, UIAlignAnchor.BottomLeft, (component, e) => { InstanceID instanceID = InstanceHelper.GetInstanceID(infoPanel); var citizen = CitizenManager.instance.m_citizens.m_buffer[instanceID.Citizen]; try { if (CitizenPanelWrapper == null || instanceID.Citizen != SelectedCitizen) { CitizenPanelWrapper = citizen.GenerateCitizenPanel(instanceID.Citizen); } else { CitizenPanelWrapper.isVisible = false; UiUtils.DeepDestroy(CitizenPanelWrapper); } } catch (Exception ex) { Debug.Log($"{ex.Message} - {ex.StackTrace}"); } if (component.hasFocus) { component.Unfocus(); } }); }
private void AddBuildingInformationButton(WorldInfoPanel infoPanel, out UIButton button, Vector3 offset) { button = UiUtils.CreateToggleButton(ZoneBuildingPanel.component, offset, UIAlignAnchor.BottomLeft, (comp, e) => { InstanceID instanceID = InstanceHelper.GetInstanceID(infoPanel); var building = BuildingManager.instance.m_buildings.m_buffer[instanceID.Building].Info; try { if (ZonedBuildingPanelWrapper == null || building != CurrentSelectedBuilding) { ZonedBuildingPanelWrapper = building.GenerateBuildingInformation(); } else { ZonedBuildingPanelWrapper.isVisible = false; UiUtils.DeepDestroy(ZonedBuildingPanelWrapper); } } catch (Exception ex) { Debug.Log($"{ex.Message} - {ex.StackTrace}"); } if (comp.hasFocus) { comp.Unfocus(); } }); }
private void AddVehicleCustomizeButton(VehicleWorldInfoPanel infoPanel, out UIButton button, Vector3 offset) { button = UiUtils.CreateToggleButton(infoPanel.component, offset, UIAlignAnchor.BottomLeft, (component, e) => { InstanceID instanceID = InstanceHelper.GetInstanceID(infoPanel); SelectedInstanceID = instanceID; var vehicle = VehicleManager.instance.m_vehicles.m_buffer[instanceID.Vehicle].Info; try { if (VehiclePanelWrapper == null || vehicle != SelectedVehicle) { VehiclePanelWrapper = vehicle.GenerateVehiclePanel(); } else { VehiclePanelWrapper.isVisible = false; UiUtils.DeepDestroy(VehiclePanelWrapper); } } catch (Exception ex) { Debug.Log($"{ex.Message} - {ex.StackTrace}"); } if (component.hasFocus) { component.Unfocus(); } }); }