Ejemplo n.º 1
0
        protected override void OnParameterLoad(ConfigNode node)
        {
            try
            {
                base.OnParameterLoad(node);
                index = Convert.ToInt32(node.GetValue("index"));
                count = Convert.ToInt32(node.GetValue("count"));

                // Legacy support from Contract Configurator 1.8.3
                if (node.HasValue("passenger"))
                {
                    passengers = ConfigNodeUtil.ParseValue <List <string> >(node, "passenger", new List <string>()).Select(
                        name => new Kerbal(name)
                        ).ToList();
                }
                else
                {
                    foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL"))
                    {
                        passengers.Add(Kerbal.Load(kerbalNode));
                    }
                }

                CreateDelegates();
            }
            finally
            {
                ParameterDelegate <Vessel> .OnDelegateContainerLoad(node);
            }
        }
Ejemplo n.º 2
0
        protected override void OnParameterLoad(ConfigNode node)
        {
            try
            {
                base.OnParameterLoad(node);
                trait         = ConfigNodeUtil.ParseValue <string>(node, "trait", (string)null);
                minExperience = Convert.ToInt32(node.GetValue("minExperience"));
                maxExperience = Convert.ToInt32(node.GetValue("maxExperience"));
                minCrew       = Convert.ToInt32(node.GetValue("minCrew"));
                maxCrew       = Convert.ToInt32(node.GetValue("maxCrew"));

                foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL"))
                {
                    kerbals.Add(Kerbal.Load(kerbalNode));
                }
                foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL_EXCLUDE"))
                {
                    excludeKerbals.Add(Kerbal.Load(kerbalNode));
                }

                CreateDelegates();
            }
            finally
            {
                ParameterDelegate <Vessel> .OnDelegateContainerLoad(node);
            }
        }
Ejemplo n.º 3
0
        protected override void OnLoad(ConfigNode configNode)
        {
            base.OnLoad(configNode);

            foreach (ConfigNode child in configNode.GetNodes("KERBAL_DETAIL"))
            {
                // Read all the orbit data
                KerbalData kd = new KerbalData();
                kd.body        = ConfigNodeUtil.ParseValue <CelestialBody>(child, "body");
                kd.latitude    = ConfigNodeUtil.ParseValue <double>(child, "lat");
                kd.longitude   = ConfigNodeUtil.ParseValue <double>(child, "lon");
                kd.altitude    = ConfigNodeUtil.ParseValue <double?>(child, "alt", (double?)null);
                kd.landed      = ConfigNodeUtil.ParseValue <bool>(child, "landed");
                kd.owned       = ConfigNodeUtil.ParseValue <bool>(child, "owned");
                kd.addToRoster = ConfigNodeUtil.ParseValue <bool>(child, "addToRoster");

                if (child.HasNode("ORBIT"))
                {
                    kd.orbit = new OrbitSnapshot(child.GetNode("ORBIT")).Load();
                }

                // Load the kerbal
                kd.kerbal = Kerbal.Load(child);
                kerbals.Add(kd);
            }
        }
        protected override void OnParameterLoad(ConfigNode node)
        {
            try
            {
                count = ConfigNodeUtil.ParseValue <int>(node, "count");
                index = ConfigNodeUtil.ParseValue <int>(node, "index");

                foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL"))
                {
                    // Legacy support for Contract Configurator 1.8.3
                    if (kerbalNode.HasValue("kerbal"))
                    {
                        kerbalNode.AddValue("name", kerbalNode.GetValue("kerbal"));
                    }

                    kerbals.Add(Kerbal.Load(kerbalNode));
                    recovered[kerbals.Last().name] = ConfigNodeUtil.ParseValue <bool>(kerbalNode, "recovered");
                }

                CreateDelegates();
            }
            finally
            {
                ParameterDelegate <string> .OnDelegateContainerLoad(node);
            }
        }
Ejemplo n.º 5
0
        protected override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);

            foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL"))
            {
                kerbals.Add(Kerbal.Load(kerbalNode));
            }
        }
        protected override void OnParameterLoad(ConfigNode node)
        {
            try
            {
                countMax         = ConfigNodeUtil.ParseValue <int>(node, "countMax");
                count            = ConfigNodeUtil.ParseValue <int>(node, "count");
                vesselIdentifier = ConfigNodeUtil.ParseValue <VesselIdentifier>(node, "vesselIdentifier", (VesselIdentifier)null);

                foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL"))
                {
                    kerbals.Add(Kerbal.Load(kerbalNode));
                }

                CreateDelegates();
            }
            finally
            {
                ParameterDelegate <ProtoCrewMember> .OnDelegateContainerLoad(node);
            }
        }
Ejemplo n.º 7
0
        protected override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            count            = Convert.ToInt32(node.GetValue("count"));
            removePassengers = ConfigNodeUtil.ParseValue <bool?>(node, "removePassengers", null) ?? true;

            // Legacy support from Contract Configurator 1.8.3
            if (node.HasValue("potentialPassenger"))
            {
                List <string>              passengerNames = ConfigNodeUtil.ParseValue <List <string> >(node, "potentialPassenger", new List <string>());
                ProtoCrewMember.Gender     gender         = ConfigNodeUtil.ParseValue <ProtoCrewMember.Gender>(node, "gender", Kerbal.RandomGender());
                ProtoCrewMember.KerbalType kerbalType     = ConfigNodeUtil.ParseValue <ProtoCrewMember.KerbalType>(node, "kerbalType", ProtoCrewMember.KerbalType.Tourist);
                string experienceTrait = ConfigNodeUtil.ParseValue <string>(node, "experienceTrait", Kerbal.RandomExperienceTrait());

                kerbals = passengerNames.Select(name => new Kerbal(gender, name, experienceTrait)).ToList();

                foreach (Kerbal kerbal in kerbals)
                {
                    kerbal.kerbalType = kerbalType;
                }
            }
            else
            {
                foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL"))
                {
                    kerbals.Add(Kerbal.Load(kerbalNode));
                }
            }

            foreach (ConfigNode child in node.GetNodes("PASSENGER_DATA"))
            {
                ProtoCrewMember crew   = ConfigNodeUtil.ParseValue <ProtoCrewMember>(child, "passenger");
                bool            loaded = ConfigNodeUtil.ParseValue <bool>(child, "loaded");

                if (crew != null)
                {
                    passengers[crew] = loaded;
                }
            }
        }
        protected override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            count            = Convert.ToInt32(node.GetValue("count"));
            removePassengers = ConfigNodeUtil.ParseValue <bool?>(node, "removePassengers", null) ?? true;

            foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL"))
            {
                kerbals.Add(Kerbal.Load(kerbalNode));
            }

            foreach (ConfigNode child in node.GetNodes("PASSENGER_DATA"))
            {
                ProtoCrewMember crew   = ConfigNodeUtil.ParseValue <ProtoCrewMember>(child, "passenger");
                bool            loaded = ConfigNodeUtil.ParseValue <bool>(child, "loaded");

                if (crew != null)
                {
                    passengers[crew] = loaded;
                }
            }
        }