public static void removeAllUnwantedVehicles() { for (ushort lineId = 1; lineId < Singleton <TransportManager> .instance.m_lines.m_size; lineId++) { if ((Singleton <TransportManager> .instance.m_lines.m_buffer[lineId].m_flags & TransportLine.Flags.Created) != TransportLine.Flags.None) { if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("removeAllUnwantedVehicles: line #{0}", lineId); } TransportLine tl = Singleton <TransportManager> .instance.m_lines.m_buffer[lineId]; uint prefix = 0; if (TLMConfigWarehouse.getCurrentConfigInt(TLMConfigWarehouse.getConfigIndexForTransportInfo(tl.Info) | TLMConfigWarehouse.ConfigIndex.PREFIX) != (int)ModoNomenclatura.Nenhum) { prefix = tl.m_lineNumber / 1000u; } VehicleManager instance3 = Singleton <VehicleManager> .instance; VehicleInfo info = instance3.m_vehicles.m_buffer[Singleton <TransportManager> .instance.m_lines.m_buffer[lineId].GetVehicle(0)].Info; if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("removeAllUnwantedVehicles: pre model list; type = {0}", info.GetAI()); } var def = TransportSystemDefinition.from(info); if (def == default(TransportSystemDefinition)) { if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("NULL TSysDef! {0}+{1}+{2}", info.GetAI().GetType(), info.m_class.m_subService, info.m_vehicleType); } continue; } var modelList = BasicTransportExtensionSingleton.instance(def).getAssetListForPrefix(prefix); if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("removeAllUnwantedVehicles: models found: {0}", modelList == null ? "?!?" : modelList.Count.ToString()); } if (modelList.Count > 0) { Dictionary <ushort, VehicleInfo> vehiclesToRemove = new Dictionary <ushort, VehicleInfo>(); for (int i = 0; i < tl.CountVehicles(lineId); i++) { var vehicle = tl.GetVehicle(i); if (vehicle != 0) { VehicleInfo info2 = instance3.m_vehicles.m_buffer[(int)vehicle].Info; if (!modelList.Contains(info2.name)) { vehiclesToRemove[vehicle] = info2; } } } foreach (var item in vehiclesToRemove) { item.Value.m_vehicleAI.SetTransportLine(item.Key, ref instance3.m_vehicles.m_buffer[item.Key], 0); } } } } }
private void updateSliders() { if (TLMSingleton.isIPTLoaded) { m_lineBudgetSlidersTitle.parent.isVisible = false; return; } TLMConfigWarehouse.ConfigIndex transportType = tsd.toConfigIndex(); ModoNomenclatura mnPrefixo = (ModoNomenclatura)TLMConfigWarehouse.getCurrentConfigInt(TLMConfigWarehouse.ConfigIndex.PREFIX | transportType); uint[] multipliers; IBudgetableExtension bte; uint idx; var tsdRef = tsd; idx = (uint)SelectedPrefix; bte = TLMLineUtils.getExtensionFromTransportSystemDefinition(ref tsdRef); multipliers = bte.GetBudgetsMultiplier(idx); m_lineBudgetSlidersTitle.text = string.Format(Locale.Get("TLM_BUDGET_MULTIPLIER_TITLE_PREFIX"), idx > 0 ? TLMUtils.getStringFromNumber(TLMUtils.getStringOptionsForPrefix(mnPrefixo), (int)idx + 1) : Locale.Get("TLM_UNPREFIXED"), TLMConfigWarehouse.getNameForTransportType(tsdRef.toConfigIndex())); bool budgetPerHourEnabled = multipliers.Length == 8; m_disableBudgetPerHour.isVisible = budgetPerHourEnabled; m_enableBudgetPerHour.isVisible = !budgetPerHourEnabled && tsdRef.hasVehicles(); for (int i = 0; i < m_budgetSliders.Length; i++) { UILabel budgetSliderLabel = m_budgetSliders[i].transform.parent.GetComponentInChildren <UILabel>(); if (i == 0) { if (multipliers.Length == 1) { budgetSliderLabel.prefix = Locale.Get("TLM_BUDGET_MULTIPLIER_PERIOD_LABEL_ALL"); } else { budgetSliderLabel.prefix = Locale.Get("TLM_BUDGET_MULTIPLIER_PERIOD_LABEL", 0); } } else { m_budgetSliders[i].isEnabled = budgetPerHourEnabled; m_budgetSliders[i].parent.isVisible = budgetPerHourEnabled; } if (i < multipliers.Length) { m_budgetSliders[i].value = multipliers[i] / 100f; } } }
private void loadPrefixes(int sel) { if (sel == 0) { m_prefixSelection.isVisible = false; m_prefixSelection.selectedIndex = 0; m_StripAsteriskTab.tabPages.enabled = false; return; } m_prefixSelection.isVisible = true; m_StripAsteriskTab.tabPages.enabled = false; TLMConfigWarehouse.ConfigIndex transportIndex = getConfigIndexFromDropDownSelection(sel); m_defaultAssets.itemsList = getBasicAssetListFromDropDownSelection(m_systemTypeDropDown.selectedIndex); m_defaultAssets.root.color = TLMConfigWarehouse.getColorForTransportType(transportIndex); var m = (ModoNomenclatura)TLMConfigWarehouse.getCurrentConfigInt(transportIndex | TLMConfigWarehouse.ConfigIndex.PREFIX); m_prefixSelection.items = TLMUtils.getStringOptionsForPrefix(m, true, transportIndex); m_prefixSelection.selectedIndex = 0; }
private static VehicleInfo doModelDraw(TransportLine t) { if (TLMConfigWarehouse.getCurrentConfigInt(TLMConfigWarehouse.getConfigIndexForTransportInfo(t.Info) | TLMConfigWarehouse.ConfigIndex.PREFIX) != (int)ModoNomenclatura.Nenhum) { uint prefix = t.m_lineNumber / 1000u; var def = TransportSystemDefinition.from(t.Info.m_class.m_subService, t.Info.m_vehicleType); if (def == default(TransportSystemDefinition)) { if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("NULL TSysDef! {0}+{1}", t.Info.m_class.m_subService, t.Info.m_vehicleType); } return(null); } BasicTransportExtension extension = TLMUtils.getExtensionFromTransportSystemDefinition(def); var randomInfo = extension.getRandomModel(prefix); return(randomInfo); } return(null); }
public void RefreshData(bool updateColors, bool updateVisibility) { if (this.m_LineOperation == null || this.m_LineOperation.completedOrFailed) { TLMLineUtils.getLineActive(ref Singleton <TransportManager> .instance.m_lines.m_buffer[m_LineID], out bool dayActive, out bool nightActive); bool zeroed; unchecked { zeroed = (Singleton <TransportManager> .instance.m_lines.m_buffer[m_LineID].m_flags & (TransportLine.Flags)TLMTransportLineFlags.ZERO_BUDGET_CURRENT) != 0; } if (!dayActive || !nightActive || zeroed) { m_LineColor.normalBgSprite = zeroed ? "NoBudgetIcon" : dayActive ? "DayIcon" : nightActive ? "NightIcon" : "DisabledIcon"; } else { m_LineColor.normalBgSprite = ""; } this.m_DayLine.isChecked = (dayActive && !nightActive); this.m_NightLine.isChecked = (nightActive && !dayActive); this.m_DayNightLine.isChecked = (dayActive && nightActive); this.m_DisabledLine.isChecked = (!dayActive && !nightActive); m_DisabledLine.relativePosition = new Vector3(730, 8); } else { m_LineColor.normalBgSprite = "DisabledIcon"; } this.m_LineName.text = Singleton <TransportManager> .instance.GetLineName(this.m_LineID); m_LineNumber = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_lineNumber; this.m_LineStops.text = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].CountStops(this.m_LineID).ToString("N0"); this.m_LineVehicles.text = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].CountVehicles(this.m_LineID).ToString("N0"); uint prefix = 0; var tsd = Singleton <T> .instance.GetTSD(); if (TLMConfigWarehouse.getCurrentConfigInt(tsd.toConfigIndex() | TLMConfigWarehouse.ConfigIndex.PREFIX) != (int)ModoNomenclatura.Nenhum) { prefix = Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_lineNumber / 1000u; } int averageCount = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_passengers.m_residentPassengers.m_averageCount; int averageCount2 = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_passengers.m_touristPassengers.m_averageCount; this.m_LinePassengers.text = (averageCount + averageCount2).ToString("N0"); this.m_LinePassengers.tooltip = string.Format("{0}", LocaleFormatter.FormatGeneric("TRANSPORT_LINE_PASSENGERS", new object[] { averageCount, averageCount2 })); TLMLineUtils.setLineNumberCircleOnRef(lineID, m_LineNumberFormatted, 0.8f); m_LineColor.normalFgSprite = TLMLineUtils.getIconForLine(lineID); this.m_PassengerCount = averageCount + averageCount2; this.m_lineIncompleteWarning.isVisible = ((Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_flags & TransportLine.Flags.Complete) == TransportLine.Flags.None); if (updateColors) { this.m_LineColor.selectedColor = Singleton <TransportManager> .instance.GetLineColor(this.m_LineID); } if (updateVisibility) { this.m_LineIsVisible.isChecked = ((Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_flags & TransportLine.Flags.Hidden) == TransportLine.Flags.None); } if (tsd.hasVehicles()) { TransportInfo info = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].Info; float overallBudget = Singleton <EconomyManager> .instance.GetBudget(info.m_class) / 100f; string vehTooltip = string.Format("{0} {1}", this.m_LineVehicles.text, Locale.Get("PUBLICTRANSPORT_VEHICLES")); this.m_LineVehicles.tooltip = vehTooltip; if (!TLMTransportLineExtension.instance.IsUsingCustomConfig(this.lineID) || !TLMTransportLineExtension.instance.IsUsingAbsoluteVehicleCount(this.lineID)) { this.m_lineBudgetLabel.text = string.Format("{0:0%}", TLMLineUtils.getEffectiveBugdet(lineID));//585+1/7 = frames/week m_lineBudgetLabel.tooltip = string.Format(Locale.Get("TLM_LINE_BUDGET_EXPLAIN_2"), TLMConfigWarehouse.getNameForTransportType(tsd.toConfigIndex()), overallBudget, Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_budget / 100f, TLMLineUtils.getEffectiveBugdet(lineID)); m_lineBudgetLabel.relativePosition = new Vector3(m_LineVehicles.relativePosition.x, 19, 0); m_lineBudgetLabel.isVisible = true; } else { m_lineBudgetLabel.isVisible = false; } bool tlmPerHour = TLMLineUtils.isPerHourBudget(m_LineID); m_DayLine.isVisible = !tlmPerHour; m_DayNightLine.isVisible = !tlmPerHour; m_NightLine.isVisible = !tlmPerHour; m_DisabledLine.isVisible = !tlmPerHour; m_perHourBudgetInfo.isVisible = tlmPerHour; m_perHourBudgetInfo.relativePosition = new Vector3(615, 2); } else { m_DayLine.isVisible = true; m_DayNightLine.isVisible = true; m_NightLine.isVisible = true; m_DisabledLine.isVisible = true; } }
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); }
private void BindParentChanges() { m_lineInfo.EventOnLineChanged += (lineId) => { TLMUtils.doLog("EventOnLineChanged"); m_isLoading = true; bool isCustomLine = TLMTransportLineExtension.instance.GetUseCustomConfig(lineId); TransportSystemDefinition tsd = TransportSystemDefinition.from(lineId); TLMUtils.doLog("tsd = {0}", tsd); if (m_lastDef != tsd) { foreach (var i in m_checkboxes.Keys) { UnityEngine.Object.Destroy(m_checkboxes[i].gameObject); } m_defaultAssets = tsd.GetTransportExtension().GetAllBasicAssets(0); m_checkboxes = new Dictionary <string, UICheckBox>(); TLMUtils.doLog("m_defaultAssets Size = {0} ({1})", m_defaultAssets?.Count, string.Join(",", m_defaultAssets.Keys?.ToArray() ?? new string[0])); foreach (var i in m_defaultAssets.Keys) { var checkbox = (UICheckBox)m_uiHelper.AddCheckbox(m_defaultAssets[i], false, (x) => { ushort lineIdx = m_lineInfo.CurrentSelectedId; if (m_isLoading) { return; } if (x) { if (TLMTransportLineExtension.instance.GetUseCustomConfig(lineIdx)) { TLMTransportLineExtension.instance.AddAsset(lineIdx, i); } else { tsd.GetTransportExtension().AddAsset(TLMLineUtils.getPrefix(lineIdx), i); } } else { if (TLMTransportLineExtension.instance.GetUseCustomConfig(lineIdx)) { TLMTransportLineExtension.instance.RemoveAsset(lineIdx, i); } else { tsd.GetTransportExtension().RemoveAsset(TLMLineUtils.getPrefix(lineIdx), i); } } }); CreateModelCheckBox(i, checkbox); checkbox.label.tooltip = checkbox.label.text; checkbox.label.textScale = 0.9f; checkbox.label.transform.localScale = new Vector3(Math.Min((m_mainPanel.width - 50) / checkbox.label.width, 1), 1); m_checkboxes[i] = checkbox; } } m_lastDef = tsd; List <string> selectedAssets; if (isCustomLine) { selectedAssets = TLMTransportLineExtension.instance.GetAssetList(lineId); } else { selectedAssets = tsd.GetTransportExtension().GetAssetList(TLMLineUtils.getPrefix(lineId)); } TLMUtils.doLog("selectedAssets Size = {0} ({1})", selectedAssets?.Count, string.Join(",", selectedAssets?.ToArray() ?? new string[0])); foreach (var i in m_checkboxes.Keys) { m_checkboxes[i].isChecked = selectedAssets.Contains(i); } if (isCustomLine) { m_title.text = string.Format(Locale.Get("TLM_ASSET_SELECT_WINDOW_TITLE"), TLMLineUtils.getLineStringId(lineId), TLMConfigWarehouse.getNameForTransportType(tsd.toConfigIndex())); } else { TLMConfigWarehouse.ConfigIndex transportType = tsd.toConfigIndex(); ModoNomenclatura mnPrefixo = (ModoNomenclatura)TLMConfigWarehouse.getCurrentConfigInt(TLMConfigWarehouse.ConfigIndex.PREFIX | transportType); var prefix = TLMLineUtils.getPrefix(lineId); m_title.text = string.Format(Locale.Get("TLM_ASSET_SELECT_WINDOW_TITLE_PREFIX"), prefix > 0 ? TLMUtils.getStringFromNumber(TLMUtils.getStringOptionsForPrefix(mnPrefixo), (int)prefix + 1) : Locale.Get("TLM_UNPREFIXED"), TLMConfigWarehouse.getNameForTransportType(tsd.toConfigIndex())); } m_isLoading = false; m_previewPanel.isVisible = false; }; }
private void BindParentChanges() { TLMTabControllerPrefixList <T> .eventOnPrefixChange += (prefix) => { TLMUtils.doLog("EventOnLineChanged"); TransportSystemDefinition tsd = Singleton <T> .instance.GetTSD(); if (!tsd.hasVehicles()) { m_mainPanel.isVisible = false; return; } m_isLoading = true; TLMUtils.doLog("tsd = {0}", tsd); if (!loaded) { foreach (var i in m_checkboxes.Keys) { UnityEngine.Object.Destroy(m_checkboxes[i].gameObject); } m_defaultAssets = tsd.GetTransportExtension().GetAllBasicAssets(0); m_checkboxes = new Dictionary <string, UICheckBox>(); TLMUtils.doLog("m_defaultAssets Size = {0} ({1})", m_defaultAssets?.Count, string.Join(",", m_defaultAssets.Keys?.ToArray() ?? new string[0])); foreach (var i in m_defaultAssets.Keys) { var checkbox = (UICheckBox)m_uiHelper.AddCheckbox(m_defaultAssets[i], false, (x) => { if (!m_isLoading) { ushort lineIdx = (ushort)m_parent.SelectedPrefix; if (lineIdx > 100) { return; } if (x) { tsd.GetTransportExtension().AddAsset(TLMLineUtils.getPrefix(lineIdx), i); } else { tsd.GetTransportExtension().RemoveAsset(TLMLineUtils.getPrefix(lineIdx), i); } } }); CreateModelCheckBox(i, checkbox); checkbox.label.tooltip = checkbox.label.text; checkbox.label.textScale = 0.9f; checkbox.label.transform.localScale = new Vector3(Math.Min((m_mainPanel.width - 50) / checkbox.label.width, 1), 1); m_checkboxes[i] = checkbox; } } loaded = true; List <string> selectedAssets; selectedAssets = tsd.GetTransportExtension().GetAssetList((uint)prefix); TLMUtils.doLog("selectedAssets Size = {0} ({1})", selectedAssets?.Count, string.Join(",", selectedAssets?.ToArray() ?? new string[0])); foreach (var i in m_checkboxes.Keys) { m_checkboxes[i].isChecked = selectedAssets.Contains(i); } TLMConfigWarehouse.ConfigIndex transportType = tsd.toConfigIndex(); ModoNomenclatura mnPrefixo = (ModoNomenclatura)TLMConfigWarehouse.getCurrentConfigInt(TLMConfigWarehouse.ConfigIndex.PREFIX | transportType); m_title.text = string.Format(Locale.Get("TLM_ASSET_SELECT_WINDOW_TITLE_PREFIX"), prefix > 0 ? TLMUtils.getStringFromNumber(TLMUtils.getStringOptionsForPrefix(mnPrefixo), (int)prefix + 1) : Locale.Get("TLM_UNPREFIXED"), TLMConfigWarehouse.getNameForTransportType(tsd.toConfigIndex())); m_isLoading = false; }; TLMTabControllerPrefixList <T> .eventOnColorChange += (Color x) => m_lastColor = x; }
public void StartTransfer(ushort buildingID, ref Building data, TransferManager.TransferReason reason, TransferManager.TransferOffer offer) { if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("START TRANSFER!!!!!!!!"); } DepotAI ai = ((DepotAI)data.Info.GetAI()); TransportInfo m_transportInfo = ((DepotAI)data.Info.GetAI()).m_transportInfo; BuildingInfo m_info = ((DepotAI)data.Info.GetAI()).m_info; if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("m_info {0} | m_transportInfo {1} | Line: {2}", m_info.name, m_transportInfo.name, offer.TransportLine); } if (reason == m_transportInfo.m_vehicleReason) { VehicleInfo randomVehicleInfo = null; var tsd = TransportSystemDefinition.from(ai.m_transportInfo.m_class.m_subService, ai.m_transportInfo.m_vehicleType); if (offer.TransportLine != 0) { TransportLine tl = Singleton <TransportManager> .instance.m_lines.m_buffer[offer.TransportLine]; TransportInfo.TransportType t = tl.Info.m_transportType; randomVehicleInfo = doModelDraw(tl); if (TLMConfigWarehouse.getCurrentConfigInt(TLMConfigWarehouse.getConfigIndexForTransportInfo(tl.Info) | TLMConfigWarehouse.ConfigIndex.PREFIX) != (int)ModoNomenclatura.Nenhum) { setRandomBuildingByPrefix(tsd, tl.m_lineNumber / 1000u, ref buildingID); } else { setRandomBuildingByPrefix(tsd, 0, ref buildingID); } } else { setRandomBuildingByPrefix(tsd, 65, ref buildingID); } if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("randomVehicleInfo"); } if (randomVehicleInfo == null) { randomVehicleInfo = Singleton <VehicleManager> .instance.GetRandomVehicleInfo(ref Singleton <SimulationManager> .instance.m_randomizer, m_info.m_class.m_service, m_info.m_class.m_subService, m_info.m_class.m_level); } if (randomVehicleInfo != null) { if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("randomVehicleInfo != null"); } Array16 <Vehicle> vehicles = Singleton <VehicleManager> .instance.m_vehicles; Vector3 position; Vector3 vector; this.CalculateSpawnPosition(buildingID, ref Singleton <BuildingManager> .instance.m_buildings.m_buffer[buildingID], ref Singleton <SimulationManager> .instance.m_randomizer, randomVehicleInfo, out position, out vector); ushort num; if (Singleton <VehicleManager> .instance.CreateVehicle(out num, ref Singleton <SimulationManager> .instance.m_randomizer, randomVehicleInfo, position, reason, false, true)) { if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("CreatedVehicle!!!"); } randomVehicleInfo.m_vehicleAI.SetSource(num, ref vehicles.m_buffer[(int)num], buildingID); randomVehicleInfo.m_vehicleAI.StartTransfer(num, ref vehicles.m_buffer[(int)num], reason, offer); } } } else { if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("nor StartTransferCommonBuildingAI"); } StartTransferCommonBuildingAI(buildingID, ref data, reason, offer); } }
public void SimulationStep(ushort lineID) { if (!m_initialized) { m_initialized = true; for (int i = 0; i < Singleton <TransportManager> .instance.m_lines.m_buffer.Length; i++) { m_flagsLastState[i] = Singleton <TransportManager> .instance.m_lines.m_buffer[i].m_flags; } } var flagsChanged = (m_flagsLastState[lineID] ^ Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags); m_flagsLastState[lineID] = Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags; if ((flagsChanged & TransportLine.Flags.Complete) != TransportLine.Flags.None) { if (TLMConfigWarehouse.getCurrentConfigBool(TLMConfigWarehouse.ConfigIndex.AUTO_COLOR_ENABLED)) { TLMController.instance.AutoColor(lineID); } if (TLMConfigWarehouse.getCurrentConfigBool(TLMConfigWarehouse.ConfigIndex.AUTO_NAME_ENABLED)) { TLMUtils.setLineName(lineID, TLMUtils.calculateAutoName(lineID)); } } if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("LTLMTransportLine SimulationStep!"); } TransportInfo info = Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].Info; TLMCW.ConfigIndex lineType = TLMCW.getDefinitionForLine(lineID).toConfigIndex(); float defaultCostPerPassengerCapacity = TLMCW.getCostPerPassengerCapacityLine(lineType); if (Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].Complete) { int vehicleCount = 0; int installedCapacity = 0; if (Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_vehicles != 0) { VehicleManager instance = Singleton <VehicleManager> .instance; ushort nextId = Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_vehicles; int loopCount = 0; while (nextId != 0) { ushort nextLineVehicle = instance.m_vehicles.m_buffer[(int)nextId].m_nextLineVehicle; vehicleCount++; installedCapacity += TLMLineUtils.getVehicleCapacity(nextId); nextId = nextLineVehicle; if (++loopCount > 16384) { CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace); break; } } } 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 budgetMultiplierPrefix = TLMUtils.getExtensionFromConfigIndex(TLMCW.getConfigIndexForTransportInfo(info)).getBudgetMultiplierForHour(prefix, (int)Singleton <SimulationManager> .instance.m_currentDayTimeHour) / 100f; var flagToCheck = (TransportLine.Flags.DisabledNight | TransportLine.Flags.DisabledDay); if (budgetMultiplierPrefix == 0 && (Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags & flagToCheck) == TransportLine.Flags.None) { int flagsToAdd = (int)(TransportLine.Flags.DisabledDay | TransportLine.Flags.DisabledNight) | (int)(TLMTransportLineFlags.ZERO_BUDGET_SETTED); if ((Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags & (TransportLine.Flags)TLMTransportLineFlags.ZERO_BUDGET_SETTED) == TransportLine.Flags.None) { if ((Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags & TransportLine.Flags.DisabledDay) == TransportLine.Flags.None) { flagsToAdd |= (int)TLMTransportLineFlags.ZERO_BUDGET_DAY; } if ((Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags & TransportLine.Flags.DisabledNight) == TransportLine.Flags.None) { flagsToAdd |= (int)TLMTransportLineFlags.ZERO_BUDGET_NIGHT; } } Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags |= (TransportLine.Flags)flagsToAdd; } else if ((budgetMultiplierPrefix > 0 && (Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags & (TransportLine.Flags)(TLMTransportLineFlags.ZERO_BUDGET_SETTED)) != TransportLine.Flags.None)) { bool actDay = (Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags & (TransportLine.Flags)TLMTransportLineFlags.ZERO_BUDGET_DAY) != TransportLine.Flags.None; bool actNight = (Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags & (TransportLine.Flags)TLMTransportLineFlags.ZERO_BUDGET_NIGHT) != TransportLine.Flags.None; Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags &= (TransportLine.Flags) ~(TLMTransportLineFlags.ZERO_BUDGET_DAY | TLMTransportLineFlags.ZERO_BUDGET_NIGHT | TLMTransportLineFlags.ZERO_BUDGET_SETTED); TLMLineUtils.setLineActive(ref Singleton <TransportManager> .instance.m_lines.m_buffer[lineID], actDay, actNight); } bool active; if (Singleton <SimulationManager> .instance.m_isNightTime) { active = ((Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags & TransportLine.Flags.DisabledNight) == TransportLine.Flags.None); } else { active = ((Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags & TransportLine.Flags.DisabledDay) == TransportLine.Flags.None); } uint steps = 0u; float distance = 0f; bool broken = false; if (Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_stops != 0) { NetManager instance2 = Singleton <NetManager> .instance; ushort stops = Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_stops; ushort nextStop = stops; int count = 0; while (nextStop != 0) { ushort num8 = 0; if (active) { NetNode[] expr_10A_cp_0 = instance2.m_nodes.m_buffer; ushort expr_10A_cp_1 = nextStop; expr_10A_cp_0[(int)expr_10A_cp_1].m_flags = (expr_10A_cp_0[(int)expr_10A_cp_1].m_flags & ~NetNode.Flags.Disabled); } else { NetNode[] expr_130_cp_0 = instance2.m_nodes.m_buffer; ushort expr_130_cp_1 = nextStop; expr_130_cp_0[(int)expr_130_cp_1].m_flags = (expr_130_cp_0[(int)expr_130_cp_1].m_flags | NetNode.Flags.Disabled); } for (int i = 0; i < 8; i++) { ushort segment = instance2.m_nodes.m_buffer[(int)nextStop].GetSegment(i); if (segment != 0 && instance2.m_segments.m_buffer[(int)segment].m_startNode == nextStop) { distance += instance2.m_segments.m_buffer[(int)segment].m_averageLength; num8 = instance2.m_segments.m_buffer[(int)segment].m_endNode; if ((instance2.m_segments.m_buffer[(int)segment].m_flags & NetSegment.Flags.PathLength) == NetSegment.Flags.None) { broken = true; } break; } } steps += 1u; nextStop = num8; if (nextStop == stops) { break; } if (++count >= 32768) { CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace); break; } } } float lineCost = vehicleCount * info.m_maintenanceCostPerVehicle / 100;// * defaultCostPerPassengerCapacity; if (lineCost != 0) { Singleton <EconomyManager> .instance.FetchResource(EconomyManager.Resource.Maintenance, m_linesCost.m_buffer[lineID], info.m_class); } int budget = Singleton <EconomyManager> .instance.GetBudget(info.m_class); int necessaryVehicles; if (!active) { necessaryVehicles = 0; } else { necessaryVehicles = TLMVehiclesLineManager.instance[lineID]; if (necessaryVehicles == 0) { if (broken) { necessaryVehicles = vehicleCount; } else { necessaryVehicles = Mathf.CeilToInt(budget * budgetMultiplierPrefix * distance / (info.m_defaultVehicleDistance * 100f)); } } } if (steps != 0u && vehicleCount < necessaryVehicles) { TransferManager.TransferReason vehicleReason = info.m_vehicleReason; int index = Singleton <SimulationManager> .instance.m_randomizer.Int32(steps); ushort stop = Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].GetStop(index); if (vehicleReason != TransferManager.TransferReason.None && stop != 0) { TransferManager.TransferOffer offer = default(TransferManager.TransferOffer); offer.Priority = necessaryVehicles - vehicleCount + 1; offer.TransportLine = lineID; offer.Position = Singleton <NetManager> .instance.m_nodes.m_buffer[stop].m_position; offer.Amount = 1; offer.Active = false; Singleton <TransferManager> .instance.AddIncomingOffer(vehicleReason, offer); } } else if (vehicleCount > necessaryVehicles) { int index2 = Singleton <SimulationManager> .instance.m_randomizer.Int32((uint)vehicleCount); ushort vehicle = Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].GetVehicle(index2); if (vehicle != 0) { VehicleManager instance3 = Singleton <VehicleManager> .instance; VehicleInfo info2 = instance3.m_vehicles.m_buffer[(int)vehicle].Info; info2.m_vehicleAI.SetTransportLine(vehicle, ref instance3.m_vehicles.m_buffer[(int)vehicle], 0); } } } if ((Singleton <SimulationManager> .instance.m_currentFrameIndex & 4095u) >= 3840u) { Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_passengers.Update(); Singleton <TransportManager> .instance.m_passengers[(int)info.m_transportType].Add(ref Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_passengers); Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_passengers.Reset(); } }
public void RefreshData(bool colors, bool visible) { if (Singleton <TransportManager> .exists) { bool isRowVisible; if (this.m_LineOperation == null || this.m_LineOperation.completedOrFailed) { //this.m_DayLine.isVisible = (!isZeroed); //this.m_NightLine.isVisible = (!isZeroed); //this.m_DayNightLine.isVisible = (!isZeroed); //this.m_DisabledLine.isVisible = (!isZeroed); //this.m_noBudgetWarn.isVisible = (isZeroed); bool isZeroed; bool dayActive; bool nightActive; TLMLineUtils.getLineActive(ref Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID], out dayActive, out nightActive, out isZeroed); if (!isZeroed) { if (!dayActive || !nightActive) { m_LineColor.normalBgSprite = dayActive ? "DayIcon" : nightActive ? "NightIcon" : "DisabledIcon"; } else { m_LineColor.normalBgSprite = ""; } } else { m_LineColor.normalBgSprite = "NoBudgetIcon"; //m_noBudgetWarn.relativePosition = new Vector3(615, 2); } this.m_DayLine.isChecked = (dayActive && !nightActive); this.m_NightLine.isChecked = (nightActive && !dayActive); this.m_DayNightLine.isChecked = (dayActive && nightActive); this.m_DisabledLine.isChecked = (!dayActive && !nightActive); m_DisabledLine.relativePosition = new Vector3(730, 8); isRowVisible = TLMPublicTransportDetailPanel.instance.isActivityVisible(dayActive, nightActive) && TLMPublicTransportDetailPanel.instance.isOnCurrentPrefixFilter(m_LineNumber); } else { m_LineColor.normalBgSprite = "DisabledIcon"; isRowVisible = TLMPublicTransportDetailPanel.instance.isActivityVisible(false, false) && TLMPublicTransportDetailPanel.instance.isOnCurrentPrefixFilter(m_LineNumber); } if (!isRowVisible) { GetComponent <UIComponent>().isVisible = false; return; } GetComponent <UIComponent>().isVisible = true; this.m_LineName.text = Singleton <TransportManager> .instance.GetLineName(this.m_LineID); m_LineNumber = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_lineNumber; this.m_LineStops.text = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].CountStops(this.m_LineID).ToString("N0"); this.m_LineVehicles.text = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].CountVehicles(this.m_LineID).ToString("N0"); uint prefix = 0; TransportInfo info = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].Info; 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; this.m_budgetEffective.text = string.Format("{0:0%}", overallBudget * prefixMultiplier);//585+1/7 = frames/week string vehTooltip = string.Format("{0} {1}", this.m_LineVehicles.text, Locale.Get("PUBLICTRANSPORT_VEHICLES")); this.m_LineVehicles.tooltip = vehTooltip; int averageCount = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_passengers.m_residentPassengers.m_averageCount; int averageCount2 = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_passengers.m_touristPassengers.m_averageCount; this.m_LinePassengers.text = (averageCount + averageCount2).ToString("N0"); // this.m_LineEarnings.text = string.Format("~₡ {0:0.00}", (averageCount + averageCount2) / 50f); // m_LineEarnings.relativePosition = m_LinePassengers.relativePosition + new Vector3(0, 20, 0); this.m_LinePassengers.tooltip = string.Format("{0}", LocaleFormatter.FormatGeneric("TRANSPORT_LINE_PASSENGERS", new object[] { averageCount, averageCount2 })); ModoNomenclatura prefixMode; Separador sep; ModoNomenclatura suffix; ModoNomenclatura nonPrefix; bool zerosEsquerda; bool invertPrefixSuffix; string bgSprite; TLMLineUtils.getLineNamingParameters(lineID, out prefixMode, out sep, out suffix, out nonPrefix, out zerosEsquerda, out invertPrefixSuffix, out bgSprite); TLMLineUtils.setLineNumberCircleOnRef(lineNumber, prefixMode, sep, suffix, nonPrefix, zerosEsquerda, m_LineNumberFormatted, invertPrefixSuffix, 0.8f); m_LineColor.normalFgSprite = bgSprite; m_budgetEffective.tooltip = string.Format(Locale.Get("TLM_LINE_BUDGET_EXPLAIN"), TLMCW.getNameForTransportType(TLMCW.getConfigIndexForTransportInfo(info)), TLMUtils.getStringOptionsForPrefix(prefixMode, true)[prefix + 1], overallBudget, prefixMultiplier, overallBudget * prefixMultiplier); this.m_PassengerCount = averageCount + averageCount2; if (colors) { this.m_LineColor.selectedColor = Singleton <TransportManager> .instance.GetLineColor(this.m_LineID); } if (visible) { this.m_LineIsVisible.isChecked = ((Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_flags & TransportLine.Flags.Hidden) == TransportLine.Flags.None); } m_budgetEffective.relativePosition = new Vector3(m_LineVehicles.relativePosition.x, 19, 0); } }
public void RefreshData(bool colors, bool visible) { if (Singleton <TransportManager> .exists) { bool isRowVisible; if (this.m_LineOperation == null || this.m_LineOperation.completedOrFailed) { //this.m_DayLine.isVisible = (!isZeroed); //this.m_NightLine.isVisible = (!isZeroed); //this.m_DayNightLine.isVisible = (!isZeroed); //this.m_DisabledLine.isVisible = (!isZeroed); //this.m_noBudgetWarn.isVisible = (isZeroed); TLMLineUtils.getLineActive(ref Singleton <TransportManager> .instance.m_lines.m_buffer[m_LineID], out bool dayActive, out bool nightActive); bool zeroed; unchecked { zeroed = (Singleton <TransportManager> .instance.m_lines.m_buffer[m_LineID].m_flags & (TransportLine.Flags)TLMTransportLineFlags.ZERO_BUDGET_CURRENT) != 0; } if (!dayActive || !nightActive || zeroed) { m_LineColor.normalBgSprite = zeroed ? "NoBudgetIcon" : dayActive ? "DayIcon" : nightActive ? "NightIcon" : "DisabledIcon"; } else { m_LineColor.normalBgSprite = ""; } this.m_DayLine.isChecked = (dayActive && !nightActive); this.m_NightLine.isChecked = (nightActive && !dayActive); this.m_DayNightLine.isChecked = (dayActive && nightActive); this.m_DisabledLine.isChecked = (!dayActive && !nightActive); m_DisabledLine.relativePosition = new Vector3(730, 8); isRowVisible = TLMPublicTransportDetailPanel.instance.isActivityVisible(dayActive, nightActive) && TLMPublicTransportDetailPanel.instance.isOnCurrentPrefixFilter(m_LineNumber); } else { m_LineColor.normalBgSprite = "DisabledIcon"; isRowVisible = TLMPublicTransportDetailPanel.instance.isActivityVisible(false, false) && TLMPublicTransportDetailPanel.instance.isOnCurrentPrefixFilter(m_LineNumber); } if (!isRowVisible) { GetComponent <UIComponent>().isVisible = false; return; } GetComponent <UIComponent>().isVisible = true; this.m_LineName.text = Singleton <TransportManager> .instance.GetLineName(this.m_LineID); m_LineNumber = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_lineNumber; this.m_LineStops.text = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].CountStops(this.m_LineID).ToString("N0"); this.m_LineVehicles.text = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].CountVehicles(this.m_LineID).ToString("N0"); uint prefix = 0; TransportInfo info = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].Info; 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; this.m_lineBudgetLabel.text = string.Format("{0:0%}", TLMLineUtils.getEffectiveBugdet(lineID));//585+1/7 = frames/week string vehTooltip = string.Format("{0} {1}", this.m_LineVehicles.text, Locale.Get("PUBLICTRANSPORT_VEHICLES")); this.m_LineVehicles.tooltip = vehTooltip; int averageCount = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_passengers.m_residentPassengers.m_averageCount; int averageCount2 = (int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_passengers.m_touristPassengers.m_averageCount; this.m_LinePassengers.text = (averageCount + averageCount2).ToString("N0"); // this.m_LineEarnings.text = string.Format("~₡ {0:0.00}", (averageCount + averageCount2) / 50f); // m_LineEarnings.relativePosition = m_LinePassengers.relativePosition + new Vector3(0, 20, 0); this.m_LinePassengers.tooltip = string.Format("{0}", LocaleFormatter.FormatGeneric("TRANSPORT_LINE_PASSENGERS", new object[] { averageCount, averageCount2 })); TLMLineUtils.setLineNumberCircleOnRef(lineID, m_LineNumberFormatted, 0.8f); m_LineColor.normalFgSprite = TLMLineUtils.getIconForLine(lineID); m_lineBudgetLabel.tooltip = string.Format(Locale.Get("TLM_LINE_BUDGET_EXPLAIN_2"), TLMCW.getNameForTransportType(TLMCW.getConfigIndexForTransportInfo(info)), overallBudget, Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_budget / 100f, TLMLineUtils.getEffectiveBugdet(lineID)); this.m_PassengerCount = averageCount + averageCount2; this.m_lineIncompleteWarning.isVisible = ((Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_flags & TransportLine.Flags.Complete) == TransportLine.Flags.None); if (colors) { this.m_LineColor.selectedColor = Singleton <TransportManager> .instance.GetLineColor(this.m_LineID); } if (visible) { this.m_LineIsVisible.isChecked = ((Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_flags & TransportLine.Flags.Hidden) == TransportLine.Flags.None); } m_lineBudgetLabel.relativePosition = new Vector3(m_LineVehicles.relativePosition.x, 19, 0); bool tlmPerHour = TLMLineUtils.isPerHourBudget(m_LineID); m_DayLine.isVisible = !tlmPerHour; m_DayNightLine.isVisible = !tlmPerHour; m_NightLine.isVisible = !tlmPerHour; m_DisabledLine.isVisible = !tlmPerHour; m_perHourBudgetInfo.isVisible = tlmPerHour; m_perHourBudgetInfo.relativePosition = new Vector3(615, 2); } }