public static bool RowsAlreadyExist(InstanceID instanceID) { CitizenRow[] CitizenRows = FavCimsCitizenRowsPanel.GetComponentsInChildren <CitizenRow> (); foreach (CitizenRow Rows in CitizenRows) { if (Rows.MyInstanceID == instanceID) { return(true); } } return(false); }
private void RecountRows(TimeableList <BudgetEntryXml> config, int?stopsCount) { UVMBudgetEditorLine[] currentLines = m_entryListContainer.GetComponentsInChildren <UVMBudgetEditorLine>(); m_timeRows = new List <UVMBudgetEditorLine>(); int count = 0; for (int i = 0; i < stopsCount; i++, count++) { if (i < currentLines.Length) { currentLines[i].SetLegendInfo(GetColorForNumber(i)); m_timeRows.Add(currentLines[i]); currentLines[i].Entry = config[i]; } else { UVMBudgetEditorLine line = KlyteMonoUtils.CreateElement <UVMBudgetEditorLine>(m_entryListContainer.transform); line.Entry = config[i]; line.SetLegendInfo(GetColorForNumber(i)); line.OnTimeChanged += ValidateTime; line.OnDie += RemoveTime; line.OnBudgetChanged += SetBudget; m_timeRows.Add(line); } } for (int i = count; i < currentLines.Length; i++) { GameObject.Destroy(currentLines[i].gameObject); } }
private void RecountRows(TimeableList <TicketPriceEntryXml> config, int?stopsCount, ref TransportLine tl) { TLMTicketPriceEditorLine[] currentLines = m_entryListContainer.GetComponentsInChildren <TLMTicketPriceEditorLine>(); m_timeRows = new List <TLMTicketPriceEditorLine>(); var tsd = TransportSystemDefinition.GetDefinitionForLine(ref tl); uint maxTicketPrice = TLMLineUtils.GetTicketPriceForLine(tsd, 0).First.Value * 5; int count = 0; for (int i = 0; i < stopsCount; i++, count++) { if (i < currentLines.Length) { currentLines[i].SetLegendInfo(GetColorForNumber(i), maxTicketPrice); m_timeRows.Add(currentLines[i]); currentLines[i].Entry = config[i]; } else { TLMTicketPriceEditorLine line = KlyteMonoUtils.CreateElement <TLMTicketPriceEditorLine>(m_entryListContainer.transform); line.Entry = config[i]; line.SetLegendInfo(GetColorForNumber(i), maxTicketPrice); line.OnTimeChanged += ValidateTime; line.OnDie += RemoveTime; line.OnBudgetChanged += SetBudget; m_timeRows.Add(line); } } for (int i = count; i < currentLines.Length; i++) { GameObject.Destroy(currentLines[i].gameObject); } }
protected void Start() { m_lastSortCriterionLines = LineSortCriterion.DEFAULT; UIComponent parent = GetComponent <UIComponent>(); KlyteMonoUtils.CreateUIElement(out m_autoNameAll, parent.transform); m_autoNameAll.relativePosition = new Vector3(parent.width - 50f, -5); m_autoNameAll.textScale = 0.6f; m_autoNameAll.width = 40; m_autoNameAll.height = 40; m_autoNameAll.tooltip = Locale.Get("K45_TLM_AUTO_NAME_ALL_TOOLTIP"); KlyteMonoUtils.InitButton(m_autoNameAll, true, "ButtonMenu"); m_autoNameAll.name = "AutoNameAll"; m_autoNameAll.isVisible = true; m_autoNameAll.normalFgSprite = KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoNameIcon); m_autoNameAll.eventClick += (component, eventParam) => { foreach (UVMLineListItem item in mainPanel.GetComponentsInChildren <UVMLineListItem>()) { item.DoAutoName(); } }; KlyteMonoUtils.CreateUIElement(out m_autoColorAll, parent.transform); m_autoColorAll.relativePosition = new Vector3(parent.width - 90f, -5); m_autoColorAll.textScale = 0.6f; m_autoColorAll.width = 40; m_autoColorAll.height = 40; m_autoColorAll.tooltip = Locale.Get("K45_TLM_AUTO_COLOR_ALL_TOOLTIP"); KlyteMonoUtils.InitButton(m_autoColorAll, true, "ButtonMenu"); m_autoColorAll.name = "AutoColorAll"; m_autoColorAll.isVisible = true; m_autoColorAll.normalFgSprite = KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoColorIcon); m_autoColorAll.eventClick += (component, eventParam) => { foreach (UVMLineListItem item in mainPanel.GetComponentsInChildren <UVMLineListItem>()) { item.DoAutoColor(); } }; }
public void Update() { if (MainContainer.isVisible) { foreach (UIButton btn in m_editTabstrip.GetComponentsInChildren <UIButton>()) { if (btn != m_plusButton) { btn.state = btn.zOrder == CurrentTab ? UIButton.ButtonState.Focused : UIButton.ButtonState.Normal; } } foreach (UIButton btn in m_orderedRulesList.GetComponentsInChildren <UIButton>()) { btn.state = btn.zOrder == CurrentTab - 1 ? UIButton.ButtonState.Focused : UIButton.ButtonState.Normal; } } }
private void RebuildList() { m_isLoading = true; AdrAzimuthEditorLineNeighbor[] currentLines = m_neighborsList?.GetComponentsInChildren <AdrAzimuthEditorLineNeighbor>(); if (currentLines is null) { return; } int stopsCount = AdrNeighborhoodExtension.GetStopsCount(); if (stopsCount == 0) { stopsCount = 1; } m_borderCities = new List <AdrAzimuthEditorLineNeighbor>(); int count = 0; for (int i = 0; i < stopsCount; i++, count++) { if (i < currentLines.Length) { currentLines[i].SetLegendInfo(GetColorForNumber(i), i + 1); m_borderCities.Add(currentLines[i]); } else { KlyteMonoUtils.CreateUIElement(out UIPanel newEntry, m_neighborsList.transform, "NeighborhoodEntry"); AdrAzimuthEditorLineNeighbor line = newEntry.gameObject.AddComponent <AdrAzimuthEditorLineNeighbor>(); line.SetLegendInfo(GetColorForNumber(i), i + 1); line.OnValueChange += ValidateAngleStr; line.OnFixedNameChange += SetFixedName; m_borderCities.Add(line); } } for (int i = count; i < currentLines.Length; i++) { GameObject.Destroy(currentLines[i].gameObject); } m_isLoading = false; ReordenateFields(); }
/// <summary> /// Updates a school building's tooltip (in the education tool panel). /// </summary> /// <param name="prefab">School prefab to update</param> private void UpdateSchoolTooltip(BuildingInfo prefab) { // Find education panel game object. GameObject educationPanelObject = GameObject.Find("EducationDefaultPanel"); if (educationPanelObject == null) { Logging.Message("couldn't find education panel object (tooltip won't be updated)"); } else { // Find education panel scrollable panel. UIScrollablePanel edScrollPanel = educationPanelObject.GetComponentInChildren <UIScrollablePanel>(); if (edScrollPanel == null) { Logging.Message("couldn't find education panel scrollable panel (tooltip won't be updated)"); } else { // Find buttons in panel. UIButton[] schoolButtons = edScrollPanel.GetComponentsInChildren <UIButton>(); if (schoolButtons == null) { Logging.Message("couldn't find school buttons (tooltip won't be updated)"); } else { // Iterate through list of buttons, looking for a match for our prefab. foreach (UIButton schoolButton in schoolButtons) { if (schoolButton.name.Equals(prefab.name)) { // Match! Update tooltip. schoolButton.tooltip = prefab.GetLocalizedTooltip(); } } } } } }