public void updateBidings() { ushort lineID = m_lineIdSelecionado.TransportLine; TransportLine tl = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)lineID]; TransportInfo info = tl.Info; int turistas = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)lineID].m_passengers.m_touristPassengers.m_averageCount; int residentes = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)lineID].m_passengers.m_residentPassengers.m_averageCount; int residentesPorc = residentes; if (residentesPorc == 0) { residentesPorc = 1; } int criancas = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)lineID].m_passengers.m_childPassengers.m_averageCount; int adolescentes = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)lineID].m_passengers.m_teenPassengers.m_averageCount; int jovens = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)lineID].m_passengers.m_youngPassengers.m_averageCount; int adultos = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)lineID].m_passengers.m_adultPassengers.m_averageCount; int idosos = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)lineID].m_passengers.m_seniorPassengers.m_averageCount; int motoristas = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)lineID].m_passengers.m_carOwningPassengers.m_averageCount; int veiculosLinha = TLMLineUtils.GetVehiclesCount(lineID); int porcCriancas = (criancas * 100 / residentesPorc); int porcAdolescentes = (adolescentes * 100 / residentesPorc); int porcJovens = (jovens * 100 / residentesPorc); int porcAdultos = (adultos * 100 / residentesPorc); int porcIdosos = (idosos * 100 / residentesPorc); int soma = porcCriancas + porcAdolescentes + porcJovens + porcAdultos + porcIdosos; if (soma != 0 && soma != 100) { porcAdultos = 100 - (porcCriancas + porcAdolescentes + porcJovens + porcIdosos); } agesPanel.SetValues(new int[] { porcCriancas, porcAdolescentes, porcJovens, porcAdultos, porcIdosos }); passageirosEturistasLabel.text = LocaleFormatter.FormatGeneric("TRANSPORT_LINE_PASSENGERS", new object[] { residentes, turistas }); int viagensSalvas = 0; int coeficienteViagens = 0; if (residentes + turistas != 0) { coeficienteViagens += criancas * 0; coeficienteViagens += adolescentes * 5; coeficienteViagens += jovens * ((15 * residentes + 20 * turistas + (residentes + turistas >> 1)) / (residentes + turistas)); coeficienteViagens += adultos * ((20 * residentes + 20 * turistas + (residentes + turistas >> 1)) / (residentes + turistas)); coeficienteViagens += idosos * ((10 * residentes + 20 * turistas + (residentes + turistas >> 1)) / (residentes + turistas)); } if (coeficienteViagens != 0) { viagensSalvas = (int)(((long)motoristas * 10000L + (long)(coeficienteViagens >> 1)) / (long)coeficienteViagens); viagensSalvas = Mathf.Clamp(viagensSalvas, 0, 100); } viagensEvitadasLabel.text = LocaleFormatter.FormatGeneric("TRANSPORT_LINE_TRIPSAVED", new object[] { viagensSalvas }); if (daytimeChange != null && daytimeChange.completedOrFailed) { linearMap.redrawLine(); daytimeChange = null; } else { linearMap.updateBidings(); } //lines info int stopsCount = TLMLineUtils.GetStopsCount(lineID); if (lastStopsCount != stopsCount) { float totalSize = TLMLineUtils.GetLineLength(lineID); lineLenghtLabel.text = string.Format(Locale.Get("TLM_LENGHT_AND_STOPS"), totalSize, stopsCount); lastStopsCount = stopsCount; } //estatisticas novas veiculosLinhaLabel.text = LocaleFormatter.FormatGeneric("TRANSPORT_LINE_VEHICLECOUNT", new object[] { veiculosLinha }); uint prefix = 0; if (TLMConfigWarehouse.getCurrentConfigInt(TLMConfigWarehouse.getConfigIndexForTransportInfo(info) | TLMConfigWarehouse.ConfigIndex.PREFIX) != (int)ModoNomenclatura.Nenhum) { prefix = Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_lineNumber / 1000u; } float overallBudget = Singleton <EconomyManager> .instance.GetBudget(info.m_class) / 100f; float prefixMultiplier = TLMUtils.getExtensionFromConfigIndex(TLMCW.getConfigIndexForTransportInfo(info)).getBudgetMultiplierForHour(prefix, (int)Singleton <SimulationManager> .instance.m_currentDayTimeHour) / 100f; detailedStatsLabel.text = string.Format("{0:0%}", overallBudget * prefixMultiplier); detailedStatsLabel.tooltip = string.Format(Locale.Get("TLM_LINE_BUDGET_EXPLAIN"), TLMCW.getNameForTransportType(TLMCW.getConfigIndexForTransportInfo(info)), TLMUtils.getStringOptionsForPrefix((ModoNomenclatura)TLMConfigWarehouse.getCurrentConfigInt(TLMConfigWarehouse.getConfigIndexForTransportInfo(info) | TLMConfigWarehouse.ConfigIndex.PREFIX), true)[prefix + 1], overallBudget, prefixMultiplier, overallBudget * prefixMultiplier); //bool isZeroed = ((int)tl.m_flags & (int)TLMTransportLineFlags.ZERO_BUDGET_SETTED) > 0; //lineTime.isVisible = !isZeroed; //if (isZeroed) //{ // lineTimeTitle.localeID = ("TLM_LINE_DISABLED_NO_BUDGET"); // lineTimeTitle.tooltipLocaleID = ("TLM_LINE_DISABLED_NO_BUDGET_DESC"); //} //else //{ // lineTimeTitle.localeID = ("TRANSPORT_LINE_ACTIVITY"); // lineTimeTitle.tooltipLocaleID = (""); //} //generalDebugLabel.enabled = TransportLinesManagerMod.debugMode.value; //if (TransportLinesManagerMod.debugMode.value) //{ // string debugTxt = "!"; // var extraDatas = ExtraVehiclesStats.instance.getLineVehiclesData(lineID); // if (extraDatas.Count == 0) // { // debugTxt = "none"; // } // else // { // foreach (var item in extraDatas) // { // debugTxt += string.Format("BUS ID {0} - {1} Fill, {2} per lap ||", item.Key, item.Value.avgFill.ToString("0.00%"), string.Format("{0}d {1}h{2}m", item.Value.timeTakenLap.TotalDays, item.Value.timeTakenLap.Hours, item.Value.timeTakenLap.Minutes)); // } // } // generalDebugLabel.text = debugTxt; //} // //custos da linha // float costVehicles = 0; // ushort nextVehId = tl.m_vehicles; // while (nextVehId >0) { // costVehicles += Singleton<VehicleManager>.instance.m_vehicles.m_buffer [(int)nextVehId].Info.GetMaintenanceCost () ; // nextVehId = Singleton<VehicleManager>.instance.m_vehicles.m_buffer [(int)nextVehId].m_nextLineVehicle; // } // float costStops = 0; // int a = tl.m_stops; // for (int i = 0; i< stopsCount; i++) { // costStops += Singleton<NetManager>.instance.m_nodes.m_buffer [(int)tl.GetStop (i)].Info.GetMaintenanceCost () ; // } // custosLabel.text = String.Format (costsFormat, costVehicles, costStops, costVehicles + costStops); }