Exemple #1
0
        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);
                        }
                    }
                }
            }
        }
Exemple #2
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);
 }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
        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();
            }
        }
        private void updateUI(bool syncFromInput = false)
        {
            TransportSystemDefinition tsd = TransportSystemDefinition.from(transportTool.m_prefab);

            TLMLineUtils.GetNamingRulesFromTSD(out ModoNomenclatura prefixo, out Separador sep, out ModoNomenclatura sufixo, out ModoNomenclatura nonPrefix, out bool zeros, out bool invertPrefixSuffix, tsd);

            if (syncFromInput)
            {
                String value      = "0" + lineNumberTxtBox.text;
                int    valPrefixo = linePrefixDropDown.selectedIndex;

                ushort num = ushort.Parse(value);
                if (prefixo != ModoNomenclatura.Nenhum)
                {
                    num = (ushort)(valPrefixo * 1000 + (num % 1000));
                }
                if (nextLineNumber + 1 != num)
                {
                    nextLineNumber = (ushort)(num - 1);
                }
            }


            var   configIdx = tsd.toConfigIndex();
            Color color;

            if (TLMConfigWarehouse.getCurrentConfigBool(TLMConfigWarehouse.ConfigIndex.AUTO_COLOR_ENABLED))
            {
                color = TLMUtils.CalculateAutoColor((ushort)(nextLineNumber + 1), TLMConfigWarehouse.getConfigIndexForTransportInfo(transportTool.m_prefab), true);
            }
            else
            {
                color = TLMConfigWarehouse.getColorForTransportType(configIdx);
            }

            lineNumberTxtBox.color      = color;
            lineFormat.color            = color;
            lineFormat.backgroundSprite = TLMLineUtils.GetIconForIndex(configIdx);
            lineNumber.text             = TLMUtils.getString(prefixo, sep, sufixo, nonPrefix, (nextLineNumber + 1) & 0xFFFF, zeros, invertPrefixSuffix);
            lineNumber.textColor        = TLMUtils.contrastColor(color);
            int txtLen = lineNumber.text.Length;

            switch (txtLen)
            {
            case 1:
                lineNumber.textScale = 4;
                break;

            case 2:
                lineNumber.textScale = 3;
                break;

            case 3:
                lineNumber.textScale = 2.25f;
                break;

            case 4:
                lineNumber.textScale = 1.75f;
                break;

            case 5:
                lineNumber.textScale = 1.5f;
                break;

            case 6:
                lineNumber.textScale = 1.35f;
                break;

            case 7:
                lineNumber.textScale = 1.2f;
                break;

            case 8:
                lineNumber.textScale = 1.1f;
                break;

            default:
                lineNumber.textScale = 1f;
                break;
            }
        }
        private void createToolbox()
        {
            TLMUtils.createUIElement(out mainContainer, m_controller.TransformLinearMap);
            mainContainer.absolutePosition = new Vector3(2f, TLMController.instance.uiView.fixedHeight - 300f);
            mainContainer.name             = "TLMLineCreationToolbox";
            mainContainer.height           = 190;
            mainContainer.width            = 180;
            mainContainer.backgroundSprite = "MenuPanel2";
            mainContainer.relativePosition = new Vector3(320f, 57f);

            uiHelper = new UIHelperExtension(mainContainer);

            TLMUtils.createUIElement(out UILabel title, mainContainer.transform);
            title.autoSize          = false;
            title.width             = mainContainer.width;
            title.height            = 30;
            title.color             = new Color(1, 0, 0, 1);
            title.pivot             = UIPivotPoint.MiddleLeft;
            title.textAlignment     = UIHorizontalAlignment.Center;
            title.verticalAlignment = UIVerticalAlignment.Middle;
            title.name             = "Title";
            title.relativePosition = new Vector3(0, 5);
            title.atlas            = TLMController.taLineNumber;
            title.localeID         = "TLM_PREFIX_SELECTOR_WIN_TITLE";
            TLMUtils.createDragHandle(title, mainContainer);


            GameObject lpddgo = GameObject.Instantiate(UITemplateManager.GetAsGameObject(UIHelperExtension.kDropdownTemplate).GetComponent <UIPanel>().Find <UIDropDown>("Dropdown").gameObject, mainContainer.transform);

            linePrefixDropDown                            = lpddgo.GetComponent <UIDropDown>();
            linePrefixDropDown.isLocalized                = false;
            linePrefixDropDown.autoSize                   = false;
            linePrefixDropDown.horizontalAlignment        = UIHorizontalAlignment.Center;
            linePrefixDropDown.text                       = "";
            linePrefixDropDown.width                      = 75;
            linePrefixDropDown.height                     = 30;
            linePrefixDropDown.name                       = "LinePrefixDropDown";
            linePrefixDropDown.textScale                  = 1.6f;
            linePrefixDropDown.itemHeight                 = 35;
            linePrefixDropDown.itemPadding                = new RectOffset(2, 2, 2, 2);
            linePrefixDropDown.textFieldPadding           = new RectOffset(2, 2, 2, 2);
            linePrefixDropDown.eventSelectedIndexChanged += setNextLinePrefix;
            linePrefixDropDown.relativePosition           = new Vector3(5f, 45f);
            linePrefixDropDown.normalBgSprite             = "OptionsDropboxListbox";
            linePrefixDropDown.horizontalAlignment        = UIHorizontalAlignment.Center;

            TLMUtils.createUIElement(out lineNumberTxtBox, mainContainer.transform);
            lineNumberTxtBox.autoSize            = false;
            lineNumberTxtBox.relativePosition    = new Vector3(85f, 45f);
            lineNumberTxtBox.horizontalAlignment = UIHorizontalAlignment.Center;
            lineNumberTxtBox.text           = "";
            lineNumberTxtBox.width          = 90;
            lineNumberTxtBox.height         = 30;
            lineNumberTxtBox.name           = "LineNumberLabel";
            lineNumberTxtBox.normalBgSprite = "EmptySprite";
            lineNumberTxtBox.textScale      = 1.6f;
            lineNumberTxtBox.padding        = new RectOffset(0, 0, 0, 0);
            lineNumberTxtBox.color          = new Color(0, 0, 0, 1);
            TLMUtils.uiTextFieldDefaults(lineNumberTxtBox);
            lineNumberTxtBox.numericalOnly   = true;
            lineNumberTxtBox.maxLength       = 4;
            lineNumberTxtBox.eventLostFocus += setNextLineNumber;;
            lineNumberTxtBox.zOrder          = 10;
            lineNumberTxtBox.text            = "0";

            TLMUtils.createUIElement(out lineFormat, mainContainer.transform);
            lineFormat.autoSize          = false;
            lineFormat.width             = 80;
            lineFormat.height            = 80;
            lineFormat.color             = new Color(1, 0, 0, 1);
            lineFormat.pivot             = UIPivotPoint.MiddleLeft;
            lineFormat.textAlignment     = UIHorizontalAlignment.Center;
            lineFormat.verticalAlignment = UIVerticalAlignment.Middle;
            lineFormat.name             = "LineFormat";
            lineFormat.relativePosition = new Vector3(55f, 80f);
            lineFormat.atlas            = TLMController.taLineNumber;
            TLMUtils.createDragHandle(lineFormat, mainContainer);

            TLMUtils.createUIElement(out lineNumber, lineFormat.transform);
            lineNumber.autoSize          = false;
            lineNumber.width             = lineFormat.width;
            lineNumber.pivot             = UIPivotPoint.MiddleCenter;
            lineNumber.name              = "LineNumber";
            lineNumber.width             = 80;
            lineNumber.height            = 80;
            lineNumber.relativePosition  = new Vector3(-0.5f, 0.5f);
            lineNumber.autoHeight        = false;
            lineNumber.textAlignment     = UIHorizontalAlignment.Center;
            lineNumber.verticalAlignment = UIVerticalAlignment.Middle;

            prefixIncrementChk = uiHelper.AddCheckboxLocale("TLM_AUTOINCREMENT_PREFIX", false, delegate(bool value)
            {
                if (TLMSingleton.debugMode)
                {
                    TLMUtils.doLog("Type = " + TLMConfigWarehouse.getConfigIndexForTransportInfo(transportTool.m_prefab) + "|prop=" + (TLMConfigWarehouse.getConfigIndexForTransportInfo(transportTool.m_prefab) | TLMConfigWarehouse.ConfigIndex.PREFIX_INCREMENT) + "|valToSet = " + value);
                }
                TLMConfigWarehouse.setCurrentConfigBool(TLMConfigWarehouse.getConfigIndexForTransportInfo(transportTool.m_prefab) | TLMConfigWarehouse.ConfigIndex.PREFIX_INCREMENT, value);
            });
            prefixIncrementChk.relativePosition = new Vector3(5f, 162.5f);
        }
        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);
            }
        }
Exemple #9
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);
            }
        }