/// <summary>
 /// 刷新子服务里程碑
 /// </summary>
 /// <param name="subService"></param>
 /// <param name="milestoneInfo"></param>
 private void RefreshSubServiceMilestones(ItemClass.SubService subService, MilestoneInfo milestoneInfo)
 {
     if (milestoneInfo.GetLevel() < Singleton <UnlockManager> .instance.m_properties.m_SubServiceMilestones[(int)subService].GetLevel())
     {
         Singleton <UnlockManager> .instance.m_properties.m_SubServiceMilestones[(int)subService] = milestoneInfo;
     }
 }
 /// <summary>
 /// 刷新服务里程碑
 /// </summary>
 /// <param name="name"></param>
 /// <param name="milestoneInfo"></param>
 /// <param name="config"></param>
 /// <param name="inGroup"></param>
 private void RefreshServiceMilestones(string name, MilestoneInfo milestoneInfo, ModConfigModel config = null, bool inGroup = false)
 {
     if (config != null && config.ServiceExistsFeatures.Contains(name))
     {
         RefreshFeatureMilestones(name, milestoneInfo);
     }
     else if (EnumHelper.TryToEnumData(name, out PositionData <ItemClass.Service> serviceEnum))
     {
         if (milestoneInfo.GetLevel() < Singleton <UnlockManager> .instance.m_properties.m_ServiceMilestones[(int)serviceEnum.enumValue].GetLevel())
         {
             Singleton <UnlockManager> .instance.m_properties.m_ServiceMilestones[(int)serviceEnum.enumValue] = milestoneInfo;
             switch (name)
             {
             case "Monuments":
                 milestonesManager.UnlockMilestone("Statue of Industry Requirements");
                 milestonesManager.UnlockMilestone("Statue of Wealth Requirements");
                 milestonesManager.UnlockMilestone("Lazaret Plaza Requirements");
                 milestonesManager.UnlockMilestone("Statue of Shopping Requirements");
                 milestonesManager.UnlockMilestone("Plaza of the Dead Requirements");
                 if (managers.application.SupportsExpansion(Expansion.NaturalDisasters))
                 {
                     milestonesManager.UnlockMilestone("Meteor Park Requirements");
                 }
                 if (managers.application.SupportsExpansion(Expansion.GreenCities))
                 {
                     milestonesManager.UnlockMilestone("Bird And Bee Haven Requirements");
                 }
                 break;
             }
         }
     }
 }
        /// <summary>
        /// 刷新政策里程碑
        /// </summary>
        /// <param name="name"></param>
        /// <param name="milestoneInfo"></param>
        private void RefreshPolicyMilestones(string name, MilestoneInfo milestoneInfo)
        {
            if (EnumHelper.TryToEnumData(name, out PositionData <DistrictPolicies.Policies> policyEnum))
            {
                RefreshFeatureMilestones(UnlockManager.Feature.Policies.ToString(), milestoneInfo);
                if (EnumHelper.TryToEnumData(policyEnum.GetCategory(), out PositionData <DistrictPolicies.Types> policyTypeEnum))
                {
                    if (milestoneInfo.GetLevel() < Singleton <UnlockManager> .instance.m_properties.m_PolicyTypeMilestones[(int)policyTypeEnum.enumValue].GetLevel())
                    {
                        Singleton <UnlockManager> .instance.m_properties.m_PolicyTypeMilestones[(int)policyTypeEnum.enumValue] = milestoneInfo;
                    }
                }
                var i = (int)(policyEnum.enumValue & (DistrictPolicies.Policies) 31);
                switch (policyEnum.GetCategory())
                {
                case "Services":
                    if (milestoneInfo.GetLevel() < Singleton <UnlockManager> .instance.m_properties.m_ServicePolicyMilestones[i].GetLevel())
                    {
                        Singleton <UnlockManager> .instance.m_properties.m_ServicePolicyMilestones[i] = milestoneInfo;
                    }
                    break;

                case "Taxation":
                    if (milestoneInfo.GetLevel() < Singleton <UnlockManager> .instance.m_properties.m_TaxationPolicyMilestones[i].GetLevel())
                    {
                        Singleton <UnlockManager> .instance.m_properties.m_TaxationPolicyMilestones[i] = milestoneInfo;
                    }
                    break;

                case "CityPlanning":
                    if (milestoneInfo.GetLevel() < Singleton <UnlockManager> .instance.m_properties.m_CityPlanningPolicyMilestones[i].GetLevel())
                    {
                        Singleton <UnlockManager> .instance.m_properties.m_CityPlanningPolicyMilestones[i] = milestoneInfo;
                    }
                    break;
                }
            }
        }
        /// <summary>
        /// 刷新建筑里程碑
        /// </summary>
        /// <param name="name">建筑名称</param>
        /// <param name="milestoneInfo">新的里程碑进度</param>
        /// <param name="config">配置信息</param>
        /// <param name="inGroup">是否在组</param>
        private void RefreshBuildingMilestone(string name, MilestoneInfo milestoneInfo, ModConfigModel config, bool inGroup = false)
        {
            if (config.BuildingExistsRoads.Contains(name) || config.BuildingContainedRoads.Contains(name))
            {
                RefreshRoadMilestone(name, milestoneInfo, config);
            }
            else if (config.BuildingGroups.TryGetValue(name, out List <string> buildingGroup) && !inGroup)
            {
                foreach (string buildingName in buildingGroup)
                {
                    RefreshBuildingMilestone(buildingName, milestoneInfo, config, true);
                }
            }
            else if (PrefabCollection <BuildingInfo> .LoadedExists(name))
            {
                BuildingInfo building = PrefabCollection <BuildingInfo> .FindLoaded(name);

                if (milestoneInfo.GetLevel() < building.GetUnlockMilestone().GetLevel())
                {
                    building.m_UnlockMilestone = milestoneInfo;
                }
                RefreshRelatedMilestone(name, building.category, building.m_class.m_service, building.m_class.m_subService, milestoneInfo);
            }
        }
        /// <summary>
        /// 刷新道路里程碑
        /// </summary>
        /// <param name="name">道路名称</param>
        /// <param name="milestoneInfo">新的里程碑进度</param>
        /// <param name="config">配置信息</param>
        /// <param name="inGroup">是否在组</param>
        private void RefreshRoadMilestone(string name, MilestoneInfo milestoneInfo, ModConfigModel config, bool inGroup = false)
        {
            if (config.RoadExistsBuildings.Contains(name))
            {
                RefreshBuildingMilestone(name, milestoneInfo, config);
            }
            else if (config.RoadGroups.TryGetValue(name, out List <string> roadGroup) && !inGroup)
            {
                foreach (string roadName in roadGroup)
                {
                    RefreshRoadMilestone(roadName, milestoneInfo, config, true);
                }
            }
            else if (PrefabCollection <NetInfo> .LoadedExists(name))
            {
                NetInfo net = PrefabCollection <NetInfo> .FindLoaded(name);

                if (milestoneInfo.GetLevel() < net.GetUnlockMilestone().GetLevel())
                {
                    net.m_UnlockMilestone = milestoneInfo;
                }
                RefreshRelatedMilestone(name, net.category, net.m_class.m_service, net.m_class.m_subService, net.m_UnlockMilestone);
            }
        }
        /// <summary>
        /// 刷新功能里程碑
        /// </summary>
        /// <param name="name"></param>
        /// <param name="milestoneInfo"></param>
        /// <param name="config"></param>
        /// <param name="inGroup"></param>
        private void RefreshFeatureMilestones(string name, MilestoneInfo milestoneInfo, ModConfigModel config = null, bool inGroup = false)
        {
            if (config != null && config.FeatureGroups.TryGetValue(name, out List <string> featureGroup) && !inGroup)
            {
                foreach (string item in featureGroup)
                {
                    RefreshFeatureMilestones(item, milestoneInfo, config, true);
                }
            }
            else if (EnumHelper.TryToEnumData(name, out PositionData <UnlockManager.Feature> featureEnum))
            {
                if (milestoneInfo.GetLevel() < Singleton <UnlockManager> .instance.m_properties.m_FeatureMilestones[(int)featureEnum.enumValue].GetLevel())
                {
                    Singleton <UnlockManager> .instance.m_properties.m_FeatureMilestones[(int)featureEnum.enumValue] = milestoneInfo;
                    switch (name)
                    {
                    case "MonumentLevel2":
                        milestonesManager.UnlockMilestone("Fountain of LifeDeath Requirements");
                        milestonesManager.UnlockMilestone("Friendly Neighborhood Requirements");
                        milestonesManager.UnlockMilestone("Transport Tower Requirements");
                        milestonesManager.UnlockMilestone("Trash Mall Requirements");
                        milestonesManager.UnlockMilestone("Posh Mall Requirements");
                        if (managers.application.SupportsExpansion(Expansion.NaturalDisasters))
                        {
                            milestonesManager.UnlockMilestone("Disaster Memorial Requirements");
                        }
                        if (managers.application.SupportsExpansion(Expansion.GreenCities))
                        {
                            milestonesManager.UnlockMilestone("Climate Research Station Requirements");
                        }
                        if (managers.application.SupportsExpansion(Expansion.Parks))
                        {
                            milestonesManager.UnlockMilestone("Clock Tower Requirements");
                        }
                        break;

                    case "MonumentLevel3":
                        milestonesManager.UnlockMilestone("Colossal Offices Requirements");
                        milestonesManager.UnlockMilestone("Official Park Requirements");
                        milestonesManager.UnlockMilestone("CourtHouse Requirements");
                        milestonesManager.UnlockMilestone("Grand Mall Requirements");
                        milestonesManager.UnlockMilestone("Cityhall Requirements");
                        if (managers.application.SupportsExpansion(Expansion.NaturalDisasters))
                        {
                            milestonesManager.UnlockMilestone("Helicopter Park Requirements");
                        }
                        if (managers.application.SupportsExpansion(Expansion.Parks))
                        {
                            milestonesManager.UnlockMilestone("Old Market Street Requirements");
                        }
                        break;

                    case "MonumentLevel4":
                        milestonesManager.UnlockMilestone("Business Park Requirements");
                        milestonesManager.UnlockMilestone("Library Requirements");
                        milestonesManager.UnlockMilestone("Observatory Requirements");
                        milestonesManager.UnlockMilestone("Opera House Requirements");
                        milestonesManager.UnlockMilestone("Oppression Office Requirements");
                        if (managers.application.SupportsExpansion(Expansion.NaturalDisasters))
                        {
                            milestonesManager.UnlockMilestone("Pyramid Of Safety Requirements");
                        }
                        if (managers.application.SupportsExpansion(Expansion.GreenCities))
                        {
                            milestonesManager.UnlockMilestone("Floating Gardens Requirements");
                        }
                        if (managers.application.SupportsExpansion(Expansion.Parks))
                        {
                            milestonesManager.UnlockMilestone("Sea Fortress Requirements");
                        }
                        break;

                    case "MonumentLevel5":
                        milestonesManager.UnlockMilestone("ScienceCenter Requirements");
                        milestonesManager.UnlockMilestone("Servicing Services Requirements");
                        milestonesManager.UnlockMilestone("SeaWorld Requirements");
                        milestonesManager.UnlockMilestone("Expocenter Requirements");
                        milestonesManager.UnlockMilestone("High Interest Tower Requirements");
                        milestonesManager.UnlockMilestone("Academic Library Prerequisites");
                        milestonesManager.UnlockMilestone("Aviation Club Prerequisites");
                        if (managers.application.SupportsExpansion(Expansion.NaturalDisasters))
                        {
                            milestonesManager.UnlockMilestone("Sphinx Of Scenarios Requirements");
                        }
                        if (managers.application.SupportsExpansion(Expansion.GreenCities))
                        {
                            milestonesManager.UnlockMilestone("Ziggurat Garden Requirements");
                        }
                        if (managers.application.SupportsExpansion(Expansion.Parks))
                        {
                            milestonesManager.UnlockMilestone("Observation Tower Requirements");
                        }
                        break;

                    case "MonumentLevel6":
                        milestonesManager.UnlockMilestone("Cathedral of Plentitude Requirements");
                        milestonesManager.UnlockMilestone("Stadium Requirements");
                        milestonesManager.UnlockMilestone("Modern Art Museum Requirements");
                        milestonesManager.UnlockMilestone("SeaAndSky Scraper Requirements");
                        milestonesManager.UnlockMilestone("Theater of Wonders Requirements");
                        if (managers.application.SupportsExpansion(Expansion.NaturalDisasters))
                        {
                            milestonesManager.UnlockMilestone("Unicorn Park Requirements");
                        }
                        if (managers.application.SupportsExpansion(Expansion.GreenCities))
                        {
                            milestonesManager.UnlockMilestone("Central Park Requirements");
                        }
                        if (managers.application.SupportsExpansion(Expansion.Parks))
                        {
                            milestonesManager.UnlockMilestone("Statue Of Colossalus Requirements");
                        }
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// 刷新相关的里程碑(服务、子服务、功能等)
        /// </summary>
        /// <param name="name"></param>
        /// <param name="category"></param>
        /// <param name="service"></param>
        /// <param name="subService"></param>
        /// <param name="milestoneInfo"></param>
        private void RefreshRelatedMilestone(string name, string category, ItemClass.Service service, ItemClass.SubService subService, MilestoneInfo milestoneInfo)
        {
            switch (category)
            {
            case "LandscapingPaths":
            case "LandscapingWaterStructures":
                RefreshFeatureMilestones(UnlockManager.Feature.Landscaping.ToString(), milestoneInfo);
                break;

            case "IndustryFishing":
                RefreshServiceMilestones(ItemClass.Service.Garbage.ToString(), milestoneInfo);
                RefreshFeatureMilestones(UnlockManager.Feature.Fishing.ToString(), milestoneInfo);
                break;

            case "IndustryWarehouses":
                RefreshServiceMilestones(ItemClass.Service.Garbage.ToString(), milestoneInfo);
                RefreshFeatureMilestones(UnlockManager.Feature.IndustryAreas.ToString(), milestoneInfo);
                break;

            case "MonumentFootball":
                RefreshFeatureMilestones(UnlockManager.Feature.Football.ToString(), milestoneInfo);
                break;

            case "MonumentConcerts":
                RefreshFeatureMilestones(UnlockManager.Feature.Concerts.ToString(), milestoneInfo);
                break;

            case "RoadsIntersection":
                BuildingInfo building = PrefabCollection <BuildingInfo> .FindLoaded(name);

                IntersectionAI intersectionAI = building.m_buildingAI as IntersectionAI;
                if (milestoneInfo.GetLevel() < intersectionAI.GetUnlockMilestone().GetLevel())
                {
                    SetPrivateVariable(intersectionAI, "m_cachedUnlockMilestone", milestoneInfo);
                }
                break;

            case "FireDepartmentDisaster":
                RefreshServiceMilestones(ItemClass.Service.FireDepartment.ToString(), milestoneInfo);
                RefreshFeatureMilestones(UnlockManager.Feature.DisasterResponse.ToString(), milestoneInfo);
                break;

            case "PublicTransportShip":
                RefreshFeatureMilestones(UnlockManager.Feature.Ferry.ToString(), milestoneInfo);
                break;

            case "PublicTransportPlane":
                if (name.Contains("Blimp"))
                {
                    RefreshFeatureMilestones(UnlockManager.Feature.Blimp.ToString(), milestoneInfo);
                }
                else if (name.Contains("Helicopter"))
                {
                    RefreshFeatureMilestones(UnlockManager.Feature.Helicopter.ToString(), milestoneInfo);
                }
                break;

            case "PublicTransportTrolleybus":
                RefreshFeatureMilestones(UnlockManager.Feature.Trolleybus.ToString(), milestoneInfo);
                break;

            case "BeautificationExpansion1":
                RefreshFeatureMilestones(UnlockManager.Feature.ParkAreas.ToString(), milestoneInfo);
                break;
            }
            RefreshServiceMilestones(service.ToString(), milestoneInfo);
            RefreshSubServiceMilestones(subService, milestoneInfo);
        }