Пример #1
0
        private void FindAllPrefabs()
        {
            List <PrefabData> prefabDataList1 = new List <PrefabData>();
            List <PrefabData> prefabDataList2 = new List <PrefabData>();
            List <PrefabData> prefabDataList3 = new List <PrefabData>();
            List <PrefabData> prefabDataList4 = new List <PrefabData>();
            List <PrefabData> prefabDataList5 = new List <PrefabData>();
            List <PrefabData> prefabDataList6 = new List <PrefabData>();
            List <PrefabData> prefabDataList7 = new List <PrefabData>();

            for (int index = 0; index < PrefabCollection <VehicleInfo> .PrefabCount(); ++index)
            {
                VehicleInfo prefab = PrefabCollection <VehicleInfo> .GetPrefab((uint)index);

                if ((Object)prefab != (Object)null && !VehiclePrefabs.IsTrailer(prefab) && (prefab.m_class.m_service == ItemClass.Service.PublicTransport && prefab.m_class.m_level == ItemClass.Level.Level1))
                {
                    switch (prefab.m_class.m_subService)
                    {
                    case ItemClass.SubService.PublicTransportBus:
                        prefabDataList1.Add(new PrefabData(prefab));
                        continue;

                    case ItemClass.SubService.PublicTransportMetro:
                        prefabDataList2.Add(new PrefabData(prefab));
                        continue;

                    case ItemClass.SubService.PublicTransportTrain:
                        prefabDataList3.Add(new PrefabData(prefab));
                        continue;

                    case ItemClass.SubService.PublicTransportShip:
                        prefabDataList4.Add(new PrefabData(prefab));
                        continue;

                    case ItemClass.SubService.PublicTransportPlane:
                        prefabDataList5.Add(new PrefabData(prefab));
                        continue;

                    case ItemClass.SubService.PublicTransportTaxi:
                        prefabDataList6.Add(new PrefabData(prefab));
                        continue;

                    case ItemClass.SubService.PublicTransportTram:
                        prefabDataList7.Add(new PrefabData(prefab));
                        continue;

                    default:
                        continue;
                    }
                }
            }
            this._busPrefabData   = prefabDataList1.ToArray();
            this._metroPrefabData = prefabDataList2.ToArray();
            this._trainPrefabData = prefabDataList3.ToArray();
            this._shipPrefabData  = prefabDataList4.ToArray();
            this._planePrefabData = prefabDataList5.ToArray();
            this._taxiPrefabData  = prefabDataList6.ToArray();
            this._tramPrefabData  = prefabDataList7.ToArray();
        }
 public void OnLevelLoaded(LoadMode mode)
 {
     this._loadMode = mode;
     if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame)
     {
         return;
     }
     try
     {
         Utils.Log((object)"Begin init version: 3.8.10");
         ImprovedPublicTransportMod.Settings.LogSettings();
         this.ReleaseUnusedCitizenUnits();
         UIView objectOfType = UnityEngine.Object.FindObjectOfType <UIView>();
         if ((UnityEngine.Object)objectOfType != (UnityEngine.Object)null)
         {
             this._iptGameObject = new GameObject("IptGameObject");
             this._iptGameObject.transform.parent = objectOfType.transform;
             this._iptGameObject.AddComponent <VehicleEditor>();
             this._iptGameObject.AddComponent <PanelExtenderLine>();
             this._iptGameObject.AddComponent <PanelExtenderVehicle>();
             this._iptGameObject.AddComponent <PanelExtenderCityService>();
             this._iptGameObject.AddComponent <SimHelper>();
             this._iptGameObject.AddComponent <LineWatcher>();
             this._worldInfoPanel = new GameObject("PublicTransportStopWorldInfoPanel");
             this._worldInfoPanel.transform.parent = objectOfType.transform;
             this._worldInfoPanel.AddComponent <PublicTransportStopWorldInfoPanel>().Show();
             NetManagerMod.Init();
             VehicleManagerMod.Init();
             BusAIMod.Init();
             PassengerTrainAIMod.Init();
             PassengerShipAIMod.Init();
             PassengerPlaneAIMod.Init();
             TramAIMod.Init();
             BuildingWatcher.instance.Init();
             LineWatcher.instance.Init();
             TransportLineMod.Init();
             VehiclePrefabs.Init();
             SerializableDataExtension.instance.Loaded = true;
             LocaleModifier.Init();
             Utils.Log((object)"Loading done!");
         }
         else
         {
             Utils.LogError((object)"UIView not found, aborting!");
         }
     }
     catch (Exception ex)
     {
         Utils.LogError((object)("Error during initialization, IPT disables itself." + System.Environment.NewLine + "Please try again without any other mod." + System.Environment.NewLine + "Please upload your log file and post the link here if that didn't help:" + System.Environment.NewLine + "http://steamcommunity.com/workshop/filedetails/discussion/424106600/615086038663282271/" + System.Environment.NewLine + ex.Message + System.Environment.NewLine + (object)ex.InnerException + System.Environment.NewLine + ex.StackTrace));
         this.Deinit();
     }
 }
 private void Deinit()
 {
     TramAIMod.Deinit();
     PassengerTrainAIMod.Deinit();
     PassengerShipAIMod.Deinit();
     PassengerPlaneAIMod.Deinit();
     BusAIMod.Deinit();
     TransportLineMod.Deinit();
     BuildingWatcher.instance.Deinit();
     NetManagerMod.Deinit();
     VehicleManagerMod.Deinit();
     VehiclePrefabs.Deinit();
     SerializableDataExtension.instance.Loaded = false;
     LocaleModifier.Deinit();
     if ((UnityEngine.Object) this._iptGameObject != (UnityEngine.Object)null)
     {
         UnityEngine.Object.Destroy((UnityEngine.Object) this._iptGameObject);
     }
     if (!((UnityEngine.Object) this._worldInfoPanel != (UnityEngine.Object)null))
     {
         return;
     }
     UnityEngine.Object.Destroy((UnityEngine.Object) this._worldInfoPanel);
 }
Пример #4
0
 public static void Deinit()
 {
     VehiclePrefabs.instance = (VehiclePrefabs)null;
 }
Пример #5
0
 public static void Init()
 {
     VehiclePrefabs.instance = new VehiclePrefabs();
     VehiclePrefabs.instance.FindAllPrefabs();
 }