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); } }
public void Update() { if (m_container.isVisible) { ushort lineID = UVMPublicTransportWorldInfoPanel.GetLineID(); m_minutePointer.transform.localEulerAngles = new Vector3(0, 0, (SimulationManager.instance.m_currentDayTimeHour % 1 * -360) + 180); m_hourPointer.transform.localEulerAngles = new Vector3(0, 0, (SimulationManager.instance.m_currentDayTimeHour / 24 * -360) + 180); var tsd = TransportSystemDefinition.From(lineID); Tuple <TicketPriceEntryXml, int> value = TLMLineUtils.GetTicketPriceForLine(ref tsd, lineID); m_effectiveLabel.color = value.Second < 0 ? Color.gray : TLMTicketConfigTab.m_colorOrder[value.Second % TLMTicketConfigTab.m_colorOrder.Count]; m_effectiveLabel.text = (value.First.Value / 100f).ToString(Settings.moneyFormat, LocaleManager.cultureInfo); } }
private void PrintIncomeExpenseVehicle(ushort lineID, int idx, UILabel labelVehicle, long income, long expense, float scale) { var tsd = TransportSystemDefinition.From(lineID); m_vehicleButtons.items[idx].color = Color.Lerp(Color.white, income > expense ? Color.green : Color.red, Mathf.Max(income, expense) / scale * TLMLineUtils.GetTicketPriceForLine(tsd, lineID).First.Value); labelVehicle.text = $"\n<color #00cc00>{(income / 100.0f).ToString(Settings.moneyFormat, LocaleManager.cultureInfo)}</color>"; labelVehicle.suffix = $"\n<color #ff0000>{(expense / 100.0f).ToString(Settings.moneyFormat, LocaleManager.cultureInfo)}</color>"; }