public override void OnLevelUnloading()
        {
            if (!HarmonyHelper.IsHarmonyInstalled)
            {
                return;
            }
            if (_loadMode != LoadMode.LoadGame && _loadMode != LoadMode.NewGame &&
                _loadMode != LoadMode.NewGameFromScenario)
            {
                return;
            }

            XYZBuildingAIPatch.Undo();
            CargoTruckAIChangeVehicleTypePatch.Undo();
            PanelExtenderCityServicePatch.Undo();
            GetVehicleInfoPatch.Undo();
            GetSelectedVehiclePatch.Undo();
            CreateVehiclePatch.Undo();

            VehiclePrefabs.Deinit();

            if (!(_gameObject != null))
            {
                return;
            }
            Object.Destroy(_gameObject);
        }
        public override void OnLevelLoaded(LoadMode mode)
        {
            if (!HarmonyHelper.IsHarmonyInstalled)
            {
                return;
            }
            _loadMode = mode;
            if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame && _loadMode != LoadMode.NewGameFromScenario)
            {
                return;
            }

            var objectOfType = Object.FindObjectOfType <UIView>();

            if (objectOfType != null)
            {
                _gameObject = new GameObject("PanelExtenderCityService")
                {
                    transform =
                    {
                        parent = objectOfType.transform
                    }
                };
                _gameObject.AddComponent <PanelExtenderCityService>();
            }

            VehiclePrefabs.Init();

            PanelExtenderCityServicePatch.Apply(); //needed for reverse redirect
            XYZBuildingAIPatch.Apply();
            CargoTruckAIChangeVehicleTypePatch.Apply();
            GetVehicleInfoPatch.Apply();
            GetSelectedVehiclePatch.Apply();
            CreateVehiclePatch.Apply();

            SimulationManager.instance.AddAction(SerializableDataExtension.ValidateBuildingData);
        }