예제 #1
0
 private void loadLinesConfig()
 {
     if (cached_list == null)
     {
         cached_list = getValueFromString(TLMConfigWarehouse.getCurrentConfigString(TLMConfigWarehouse.ConfigIndex.VEHICLE_LINE));
     }
 }
예제 #2
0
        public void load()
        {
            if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
            {
                TLMUtils.doLog("TLMStopsExtension.load()");
            }
            var file = TLMConfigWarehouse.getCurrentConfigString(CONFIG).Split(COMMA.ToCharArray());

            cached_list = new Dictionary <uint, Dictionary <Property, string> >();
            if (file.Length > 0)
            {
                if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
                {
                    TLMUtils.doLog("TLMStopsExtension.load(): file.Length > 0");
                }
                foreach (string s in file)
                {
                    uint key   = getIndexFromStringArray(s);
                    var  value = TLMUtils.getValueFromStringArray <Property>(s, SEPARATOR, SUBCOMMA, SUBSEPARATOR);
                    cached_list[key] = value;
                }
                if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
                {
                    TLMUtils.doLog("TLMStopsExtension.load(): dic done");
                }
                cached_list.Remove(0);
            }
        }
예제 #3
0
 private static Dictionary <ushort, List <uint> > getConfigForTransportType(TransportSystemDefinition tsd)
 {
     if (!cached_lists.ContainsKey(tsd))
     {
         string depotList = TLMConfigWarehouse.getCurrentConfigString(TLMConfigWarehouse.getConfigDepotPrefix(tsd));
         if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
         {
             TLMUtils.doLog("getConfigForTransportType STRING FOR {0}: {1}", tsd.ToString(), depotList);
         }
         cached_lists[tsd] = getDictionaryFromConfigString(depotList, tsd);
     }
     return(cached_lists[tsd]);
 }
예제 #4
0
        public static string getPrefixTextNaming(this TLMConfigWarehouse.ConfigIndex idx)
        {
            switch (idx)
            {
            case TLMConfigWarehouse.ConfigIndex.RESIDENTIAL_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.COMMERCIAL_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.INDUSTRIAL_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.NATURAL_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.UNUSED2_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.CITIZEN_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.TOURISM_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.OFFICE_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.ROAD_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.ELECTRICITY_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.WATER_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.BEAUTIFICATION_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.GARBAGE_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.HEALTHCARE_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.POLICEDEPARTMENT_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.EDUCATION_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.MONUMENT_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.FIREDEPARTMENT_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.DISASTER_SERVICE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.DISTRICT_NAME_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.ADDRESS_NAME_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.PARKAREA_NAME_CONFIG:
                return(TLMConfigWarehouse.getCurrentConfigString(TLMConfigWarehouse.ConfigIndex.AUTO_NAMING_REF_TEXT | idx));

            case TLMConfigWarehouse.ConfigIndex.PLANE_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.BUS_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.METRO_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.TRAIN_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.TRAM_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.SHIP_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.BLIMP_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.FERRY_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.CABLE_CAR_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.MONORAIL_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.TAXI_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.BALLOON_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.TOUR_BUS_CONFIG:
            case TLMConfigWarehouse.ConfigIndex.TOUR_PED_CONFIG:
                return(TLMConfigWarehouse.getCurrentConfigString(TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_AUTO_NAMING_REF_TEXT | idx));

            default:
                return("");
            }
        }
예제 #5
0
        public Dictionary <uint, Dictionary <T, string> > LoadConfig(TLMConfigWarehouse.ConfigIndex idx, bool global = false)
        {
            var result = new Dictionary <uint, Dictionary <T, string> >();

            if (TLMSingleton.instance != null && TLMSingleton.debugMode)
            {
                TLMUtils.doLog("{0} load()", idx);
            }
            string[] itemListLvl1;
            if (global && !AllowGlobal)
            {
                throw new Exception("CONFIGURAÇÂO NÃO GLOBAL TENTOU SER CARREGADA COMO GLOBAL: " + typeof(U));
            }
            if (global)
            {
                itemListLvl1 = TLMConfigWarehouse.getConfig().getString(idx).Split(ItSepLvl1.ToCharArray());
            }
            else
            {
                itemListLvl1 = TLMConfigWarehouse.getCurrentConfigString(idx).Split(ItSepLvl1.ToCharArray());
            }

            if (itemListLvl1.Length > 0)
            {
                if (TLMSingleton.instance != null && TLMSingleton.debugMode)
                {
                    TLMUtils.doLog("{0} load(): file.Length > 0", idx);
                }
                foreach (string s in itemListLvl1)
                {
                    uint key   = GetIndexFromStringArray(s);
                    var  value = GetValueFromStringArray(s);
                    result[key] = value;
                }
                if (TLMSingleton.instance != null && TLMSingleton.debugMode)
                {
                    TLMUtils.doLog("{0} load(): dic done", idx);
                }
                result.Remove(~0u);
            }
            return(result);
        }
예제 #6
0
        private void loadAuxiliarVars(bool global, bool force = false)
        {
            if ((global && cached_prefixConfigListGlobal == null) || (!global && cached_prefixConfigListNonGlobal == null) || force)
            {
                if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
                {
                    TLMUtils.doLog("loadAuxiliarVars: IN!");
                }
                string[] file;
                if (global)
                {
                    if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
                    {
                        TLMUtils.doLog("loadAuxiliarVars: IF!");
                    }
                    file = TLMConfigWarehouse.getConfig(TLMConfigWarehouse.GLOBAL_CONFIG_INDEX, TLMConfigWarehouse.GLOBAL_CONFIG_INDEX).getString(configKeyForAssets).Split(PREFIX_COMMA.ToCharArray());
                }
                else
                {
                    if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
                    {
                        TLMUtils.doLog("loadAuxiliarVars: ELSE!");
                    }
                    file = TLMConfigWarehouse.getCurrentConfigString(configKeyForAssets).Split(PREFIX_COMMA.ToCharArray());
                }
                cached_prefixConfigList = new Dictionary <uint, Dictionary <PrefixConfigIndex, string> >();
                if (file.Length > 0)
                {
                    if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
                    {
                        TLMUtils.doLog("loadAuxiliarVars: file.Length > 0");
                    }
                    foreach (string s in file)
                    {
                        uint key   = getIndexFromStringArray(s);
                        var  value = getValueFromStringArray(s);
                        cached_prefixConfigList[key] = value;
                    }
                    if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
                    {
                        TLMUtils.doLog("loadAuxiliarVars: dic done");
                    }
                    cached_prefixConfigList.Remove(0xFFFFFFFF);
                }
                else
                {
                    if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
                    {
                        TLMUtils.doLog("loadAuxiliarVars: file.Length == 0");
                    }
                    cached_prefixConfigList = new Dictionary <uint, Dictionary <PrefixConfigIndex, string> >();
                }
                basicAssetsList = new List <string>();

                if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
                {
                    TLMUtils.doLog("loadAuxiliarVars: pre prefab read");
                }
                for (uint num = 0u; (ulong)num < (ulong)((long)PrefabCollection <VehicleInfo> .PrefabCount()); num += 1u)
                {
                    VehicleInfo prefab = PrefabCollection <VehicleInfo> .GetPrefab(num);

                    if (!(prefab == null) && definition.isFromSystem(prefab) && !isTrailer(prefab))
                    {
                        basicAssetsList.Add(prefab.name);
                    }
                }
                if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
                {
                    TLMUtils.doLog("loadAuxiliarVars: pre models Check");
                }
                foreach (uint prefix in cached_prefixConfigList.Keys)
                {
                    if (cached_prefixConfigList[prefix].ContainsKey(PrefixConfigIndex.MODELS))
                    {
                        var temp = cached_prefixConfigList[prefix][PrefixConfigIndex.MODELS].Split(PROPERTY_VALUE_COMMA.ToCharArray()).ToList();
                        for (int i = 0; i < temp.Count; i++)
                        {
                            string assetId = temp[i];
                            if (PrefabCollection <VehicleInfo> .FindLoaded(assetId) == null)
                            {
                                temp.RemoveAt(i);
                                i--;
                            }
                        }
                        cached_prefixConfigList[prefix][PrefixConfigIndex.MODELS] = string.Join(PROPERTY_VALUE_COMMA, temp.ToArray());
                    }
                }
                if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode)
                {
                    TLMUtils.doLog("loadAuxiliarVars: pos models Check");
                }
                saveSubcategoryList(global);
            }
        }