Example #1
0
        private static void LoadFacilities(ConfigNode facilityNodes)
        {
            foreach (StaticInstance instance in StaticDatabase.allStaticInstances)
            {
                if (!instance.hasFacilities || instance.myFacilities.Count == 0)
                {
                    continue;
                }

                if (!facilityNodes.HasNode(CareerUtils.KeyFromString(instance.RadialPosition.ToString())))
                {
                    Log.UserWarning("No entry foud in savegame: " + instance.gameObject.name);
                    continue;
                }

                ConfigNode instanceNode = facilityNodes.GetNode(CareerUtils.KeyFromString(instance.RadialPosition.ToString()));
                foreach (var facNode in instanceNode.GetNodes())
                {
                    int index = int.Parse(facNode.GetValue("Index"));
                    if (instance.myFacilities[index].FacilityType == facNode.name)
                    {
                        //Log.Normal("Load State: " + instance.pqsCity.name + " : "  + facNode.name);
                        instance.myFacilities[index].LoadCareerConfig(facNode);
                    }
                    else
                    {
                        Log.UserError("Facility Index Missmatch in fac: " + instance.gameObject.name);
                    }
                }
            }
        }
Example #2
0
        internal static void SaveLaunchsites(ConfigNode launchSiteNode)
        {
            string name = null;

            foreach (LaunchSite site in LaunchSiteManager.AllLaunchSites)
            {
                name = CareerUtils.LSKeyFromName(site.LaunchSiteName);
                ConfigNode lsNode = launchSiteNode.AddNode(name);
                site.SaveCareerConfig(lsNode);
            }
        }
Example #3
0
 /// <summary>
 /// Loads the state of the LauchSites
 /// </summary>
 internal static void LoadLaunchSites(ConfigNode launchSiteNodes)
 {
     foreach (LaunchSite site in LaunchSiteManager.AllLaunchSites)
     {
         ConfigNode lsNode;
         if (launchSiteNodes.HasNode(CareerUtils.LSKeyFromName(site.LaunchSiteName)))
         {
             lsNode = launchSiteNodes.GetNode(CareerUtils.LSKeyFromName(site.LaunchSiteName));
             site.LoadCareerConfig(lsNode);
         }
     }
 }
Example #4
0
        internal static void SaveLaunchsites(ConfigNode launchSiteNode)
        {
            string name = null;

            foreach (KKLaunchSite site in LaunchSiteManager.allLaunchSites)
            {
                //Log.Normal("Saving LS: " + site.LaunchSiteName + " " + site.isOpen);
                name = CareerUtils.LSKeyFromName(site.LaunchSiteName);
                ConfigNode lsNode = launchSiteNode.AddNode(name);
                LaunchSiteParser.SaveCareerConfig(site, lsNode);
            }
        }
Example #5
0
 /// <summary>
 /// Loads the state of the LauchSites
 /// </summary>
 internal static void LoadLaunchSitesLegacy(ConfigNode launchSiteNodes)
 {
     foreach (KKLaunchSite site in LaunchSiteManager.allLaunchSites)
     {
         //Log.Normal("Loading LS: " + site.LaunchSiteName + " " + site.isOpen);
         ConfigNode lsNode;
         if (launchSiteNodes.HasNode(CareerUtils.LSKeyFromName(site.LaunchSiteName)))
         {
             lsNode = launchSiteNodes.GetNode(CareerUtils.LSKeyFromName(site.LaunchSiteName));
             LaunchSiteParser.LoadCareerConfig(site, lsNode);
         }
         //Log.Normal("Loading LS: " + site.LaunchSiteName + " " + site.isOpen);
     }
 }
Example #6
0
        /// <summary>
        /// saves the facility settings to the cfg file
        /// </summary>
        internal static void SaveFacilities(ConfigNode facilityNodes)
        {
            foreach (StaticInstance instance in StaticDatabase.GetAllStatics())
            {
                if (!instance.hasFacilities)
                {
                    continue;
                }

                ConfigNode instanceNode = facilityNodes.AddNode(CareerUtils.KeyFromString(instance.RadialPosition.ToString()));
                instanceNode.SetValue("FacilityName", instance.gameObject.name, true);
                instanceNode.SetValue("FacilityType", instance.facilityType.ToString(), true);

                for (int i = 0; i < instance.myFacilities.Count; i++)
                {
                    ConfigNode facnode = instanceNode.AddNode(instance.myFacilities[i].FacilityType);
                    facnode.SetValue("Index", i, true);
                    instance.myFacilities[i].SaveCareerConfig(facnode);
                }
            }
        }