private static void BuildCreationWindow(UIComponent parent) { if (eventCreationWindow == null) { eventCreationWindow = parent.AddUIComponent <UserEventCreationWindow>(); eventCreationWindow.name = "EventCreator"; LoggingWrapper.Log("Creating a new UserEventCreationWindow"); eventCreationWindow.Hide(); } }
private static void BuildCreationWindow(UIComponent parent) { if (eventCreationWindow == null) { eventCreationWindow = parent.AddUIComponent <UserEventCreationWindow>(); eventCreationWindow.name = "EventCreator"; CimTools.CimToolsHandler.CimToolBase.DetailedLogger.Log("Creating a new UserEventCreationWindow"); eventCreationWindow.Hide(); } }
public static void AddEventUI(CityServiceWorldInfoPanel cityServicePanel) { UIMultiStateButton locationButton = null; UIButton createEventButton = null; UIFastList eventSelection = null; UserEventCreationWindow eventCreationWindow = null; try { locationButton = cityServicePanel.Find <UIMultiStateButton>("LocationMarker"); } catch { } try { createEventButton = cityServicePanel.Find <UIButton>("CreateEventButton"); } catch { } try { eventSelection = cityServicePanel.Find <UIFastList>("EventSelectionList"); } catch { } try { eventCreationWindow = cityServicePanel.Find <UserEventCreationWindow>("EventCreator"); } catch { } FieldInfo m_InstanceIDInfo = typeof(CityServiceWorldInfoPanel).GetField("m_InstanceID", BindingFlags.NonPublic | BindingFlags.Instance); InstanceID?m_InstanceID = m_InstanceIDInfo.GetValue(cityServicePanel) as InstanceID?; lastInstanceID = m_InstanceID; BuildCreationWindow(cityServicePanel.component); if (eventSelection != null) { eventSelection.Hide(); } if (eventCreationWindow != null) { eventCreationWindow.Hide(); } if (createEventButton == null && locationButton != null) { createEventButton = cityServicePanel.component.AddUIComponent <UIButton>(); createEventButton.name = "CreateEventButton"; createEventButton.atlas = CimTools.CimToolsHandler.CimToolBase.SpriteUtilities.GetAtlas("Ingame"); createEventButton.normalFgSprite = "InfoIconLevel"; createEventButton.disabledFgSprite = "InfoIconLevelDisabled"; createEventButton.focusedFgSprite = "InfoIconLevelFocused"; createEventButton.hoveredFgSprite = "InfoIconLevelHovered"; createEventButton.pressedFgSprite = "InfoIconLevelPressed"; createEventButton.width = locationButton.width; createEventButton.height = locationButton.height; createEventButton.position = locationButton.position - new Vector3(createEventButton.width - 5f, 0); createEventButton.eventClicked += CreateEventButton_eventClicked; BuildDropdownList(createEventButton); } if (m_InstanceID != null) { BuildingManager _buildingManager = Singleton <BuildingManager> .instance; Building _currentBuilding = _buildingManager.m_buildings.m_buffer[lastInstanceID.Value.Building]; if (CityEventBuildings.instance.BuildingHasUserEvents(ref _currentBuilding)) { createEventButton.Show(); createEventButton.Enable(); m_NameField.width = originalNameWidth - 45f; } else { if (CityEventBuildings.instance.BuildingHasEvents(ref _currentBuilding)) { createEventButton.Show(); createEventButton.Disable(); m_NameField.width = originalNameWidth - 45f; } else { createEventButton.Hide(); m_NameField.width = originalNameWidth; } } } }