Exemple #1
0
        /// <summary>
        /// Stops the mod by deactivating all its parts.
        /// </summary>
        public void Stop()
        {
            if (!isEnabled)
            {
                return;
            }

            patcher.Revert();

            timeAdjustment.Disable();
            timeBar.CityEventClick -= CustomTimeBarCityEventClick;
            timeBar.Disable();
            eventManager.EventsChanged -= CityEventsChanged;
            SimulationHandler.NewDay   -= CityEventsChanged;

            CityEventsLoader.Instance.Clear();

            AwakeSleepSimulation.Uninstall();

            RealTimeStorage.CurrentLevelStorage.GameSaving -= GameSaving;

            ResidentAIPatch.RealTimeAI          = null;
            TouristAIPatch.RealTimeAI           = null;
            BuildingAIPatches.RealTimeAI        = null;
            SimulationHandler.EventManager      = null;
            SimulationHandler.DayTimeSimulation = null;
            SimulationHandler.TimeAdjustment    = null;
            SimulationHandler.WeatherInfo       = null;
            SimulationHandler.Buildings         = null;
            SimulationHandler.CitizenProcessor  = null;

            isEnabled = false;
        }
Exemple #2
0
        /// <summary>
        /// Stops the mod by deactivating all its parts.
        /// </summary>
        public void Stop()
        {
            if (!isEnabled)
            {
                return;
            }

            Log.Info("The 'Real Time' mod reverts method patches.");
            patcher.Revert();

            ResidentAIPatch.RealTimeAI          = null;
            TouristAIPatch.RealTimeAI           = null;
            BuildingAIPatch.RealTimeAI          = null;
            BuildingAIPatch.WeatherInfo         = null;
            TransferManagerPatch.RealTimeAI     = null;
            SimulationHandler.EventManager      = null;
            SimulationHandler.DayTimeSimulation = null;
            SimulationHandler.TimeAdjustment    = null;
            SimulationHandler.WeatherInfo       = null;
            SimulationHandler.Buildings         = null;
            SimulationHandler.CitizenProcessor  = null;
            SimulationHandler.Statistics?.Close();
            SimulationHandler.Statistics = null;
            ParkPatch.SpareTimeBehavior  = null;
            OutsideConnectionAIPatch.SpareTimeBehavior = null;
            CitizenManagerPatch.NewCitizenBehavior     = null;

            vanillaEvents.Revert();

            timeAdjustment.Disable();
            timeBar.CityEventClick -= CustomTimeBarCityEventClick;
            timeBar.Disable();
            eventManager.EventsChanged -= CityEventsChanged;
            SimulationHandler.NewDay   -= CityEventsChanged;

            CityEventsLoader.Instance.Clear();

            AwakeSleepSimulation.Uninstall();

            StorageBase.CurrentLevelStorage.GameSaving -= GameSaving;

            WorldInfoPanelPatch.CitizenInfoPanel?.Disable();
            WorldInfoPanelPatch.CitizenInfoPanel = null;

            WorldInfoPanelPatch.VehicleInfoPanel?.Disable();
            WorldInfoPanelPatch.VehicleInfoPanel = null;

            WorldInfoPanelPatch.CampusWorldInfoPanel?.Disable();
            WorldInfoPanelPatch.CampusWorldInfoPanel = null;

            isEnabled = false;
        }
Exemple #3
0
        public void Stop()
        {
            if (!isEnabled)
            {
                return;
            }

            timeAdjustment.Disable();
            timeBar.CityEventClick -= CustomTimeBarCityEventClick;
            timeBar.Disable();
            eventManager.EventsChanged -= CityEventsChanged;
            SimulationHandler.NewDay   -= CityEventsChanged;

            CityEventsLoader.Istance.Clear();

            RealTimeStorage.Instance.GameSaving -= GameSaving;

            ResidentAIHook.RealTimeAI           = null;
            TouristAIHook.RealTimeAI            = null;
            PrivateBuildingAIHook.RealTimeAI    = null;
            SimulationHandler.EventManager      = null;
            SimulationHandler.DayTimeSimulation = null;
            SimulationHandler.CommercialAI      = null;

            try
            {
                Redirector.RevertRedirections();
                Log.Info($"Successfully reverted all method redirections.");
            }
            catch (Exception ex)
            {
                Log.Error("Failed to revert method redirections: " + ex.Message);
            }

            isEnabled = false;
        }