Esempio n. 1
0
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);

            if (Settings == null)
            {
                Settings = new CrewHandlerSettings();
                foreach (ConfigNode stg in GameDatabase.Instance.GetConfigNodes("CREWHANDLERSETTINGS"))
                {
                    Settings.Load(stg);
                }
            }

            KerbalRetireTimes.Clear();
            ConfigNode n = node.GetNode("RETIRETIMES");

            if (n != null)
            {
                foreach (ConfigNode.Value v in n.values)
                {
                    KerbalRetireTimes[v.name] = double.Parse(v.value);
                }
            }

            KerbalRetireIncreases.Clear();
            n = node.GetNode("RETIREINCREASES");
            if (n != null)
            {
                foreach (ConfigNode.Value v in n.values)
                {
                    KerbalRetireIncreases[v.name] = double.Parse(v.value);
                }
            }

            _retirees.Clear();
            n = node.GetNode("RETIREES");
            if (n != null)
            {
                foreach (ConfigNode.Value v in n.values)
                {
                    _retirees.Add(v.value);
                }
            }

            _expireTimes.Clear();
            n = node.GetNode("EXPIRATIONS");
            if (n != null)
            {
                foreach (ConfigNode eN in n.nodes)
                {
                    _expireTimes.Add(new TrainingExpiration(eN));
                }
            }

            ConfigNode FSData = node.GetNode("FlightSchoolData");

            if (FSData != null)
            {
                //load all the active courses
                ActiveCourses.Clear();
                foreach (ConfigNode courseNode in FSData.GetNodes("ACTIVE_COURSE"))
                {
                    try
                    {
                        ActiveCourses.Add(new ActiveCourse(courseNode));
                    }
                    catch (Exception ex)
                    {
                        Debug.LogException(ex);
                    }
                }
            }

            TrainingDatabase.EnsureInitialized();
            GenerateOfferedCourses();
            KACWrapper.InitKACWrapper();
        }
Esempio n. 2
0
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            if (Config == null)
            {
                Config = new LRTRHomeWorldParameters();
                foreach (ConfigNode stg in GameDatabase.Instance.GetConfigNodes("HOMEWORLDPARAMETERS"))
                {
                    Config.Load(stg);
                }
            }

            if (Settings == null)
            {
                Settings = new CrewHandlerSettings();
                foreach (ConfigNode stg in GameDatabase.Instance.GetConfigNodes("CREWHANDLERSETTINGS"))
                {
                    Settings.Load(stg);
                }
                Settings.retireIncreaseCap = Settings.retireIncreaseCap * Config.hoursPerDay * Config.daysPerYear * 3600;
            }

            KerbalRetireTimes.Clear();
            ConfigNode n = node.GetNode("RETIRETIMES");

            if (n != null)
            {
                _isFirstLoad = false;
                foreach (ConfigNode.Value v in n.values)
                {
                    KerbalRetireTimes[v.name] = double.Parse(v.value);
                }
            }

            KerbalRetireIncreases.Clear();
            n = node.GetNode("RETIREINCREASES");
            if (n != null)
            {
                foreach (ConfigNode.Value v in n.values)
                {
                    KerbalRetireIncreases[v.name] = double.Parse(v.value);
                }
            }

            _retirees.Clear();
            n = node.GetNode("RETIREES");
            if (n != null)
            {
                foreach (ConfigNode.Value v in n.values)
                {
                    _retirees.Add(v.value);
                }
            }

            _expireTimes.Clear();
            n = node.GetNode("EXPIRATIONS");
            if (n != null)
            {
                foreach (ConfigNode eN in n.nodes)
                {
                    _expireTimes.Add(new TrainingExpiration(eN));
                }
            }

            ConfigNode FSData = node.GetNode("FlightSchoolData");

            if (FSData != null)
            {
                //load all the active courses
                ActiveCourses.Clear();
                foreach (ConfigNode courseNode in FSData.GetNodes("ACTIVE_COURSE"))
                {
                    try
                    {
                        ActiveCourses.Add(new ActiveCourse(courseNode));
                    }
                    catch (Exception ex)
                    {
                        Debug.LogException(ex);
                    }
                }
            }

            TrainingDatabase.EnsureInitialized();
            KACWrapper.InitKACWrapper();
        }