Esempio n. 1
0
        internal void Load(ConfigNode node)
        {
            Utils.Log("Kerbal Database: Loading...");
            Kerbals.Clear();
            Utils.Log("Kerbal Database: Loading from persistence");
            ConfigNode mNode = node.GetNode(RadioactivitySettings.pluginConfigNodeName);

            ConfigNode[] kNodes = mNode.GetNodes(RadioactivitySettings.kerbalConfigNodeName);
            foreach (ConfigNode kNode in kNodes)
            {
                if (kNode.HasValue("KerbalName"))
                {
                    string idx = kNode.GetValue("KerbalName");
                    Utils.Log(String.Format("Kerbal Database: Loading kerbal {0}", idx));
                    RadioactivityKerbal kerbal = new RadioactivityKerbal(idx);
                    kerbal.Load(kNode, idx);
                    Kerbals[idx] = kerbal;
                }
            }
            Utils.Log("Kerbal Database: Loading from roster");
            var crewList = HighLogic.CurrentGame.CrewRoster.Crew.Concat(HighLogic.CurrentGame.CrewRoster.Applicants).Concat(HighLogic.CurrentGame.CrewRoster.Tourist).Concat(HighLogic.CurrentGame.CrewRoster.Unowned).ToList();

            foreach (ProtoCrewMember crew in crewList)
            {
                if (!Kerbals.ContainsKey(crew.name))
                {
                    Utils.Log(String.Format("Kerbal Database: Loading kerbal {0}", crew.name));
                    RadioactivityKerbal kerbal = new RadioactivityKerbal(crew.name);
                    kerbal.Load(crew);
                    Kerbals[crew.name] = kerbal;
                }
            }
            Utils.Log(String.Format("Kerbal Database: Loaded {0} Kerbals", Kerbals.Count));
            Utils.Log("Kerbal Database: Loading Complete!");
        }
Esempio n. 2
0
 public void RemoveKerbal(RadioactivityKerbal k)
 {
     Kerbals.Remove(k.Name);
     Utils.Log(String.Format("Kerbal Database: {0} removed from database", k.Name));
 }