﻿using ICities;

namespace EnhancedZoomContinued
{
    public class ModLoad : LoadingExtensionBase
    {

        public EnhancedZoom ct3;

        public static bool cameraAdditionsModActive()
        {
            foreach (var plugin in ColossalFramework.Plugins.PluginManager.instance.GetPluginsInfo())
            {
                if (plugin.isEnabled)
                {
                    if (plugin.name.Equals("406297458"))
                    {

                        return true;
                    }
                }
            }
            return false;
        }

        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            EnhancedZoom.config = Configuration.Deserialize(EnhancedZoom.configPath);
            if (EnhancedZoom.config == null)
            {
                EnhancedZoom.config = new Configuration();
            }
            EnhancedZoom.SaveConfig();
        }

        public override void OnLevelLoaded(LoadMode mode)
        {
            EnhancedZoom.Initialize(mode);
            EnhancedZoom.cameraAdditionsModActive = cameraAdditionsModActive();

        }

        public override void OnLevelUnloading()
        {
            EnhancedZoom.Deinitialize();
        }
    }
}
