示例#1
0
        protected override void OnLoad(ConfigNode configNode)
        {
            base.OnLoad(configNode);

            foreach (ConfigNode child in configNode.GetNodes("WAYPOINT"))
            {
                // Read all the waypoint data
                WaypointData wpData = new WaypointData();
                wpData.type = child.GetValue("type");
                wpData.waypoint.celestialName = child.GetValue("celestialName");
                wpData.waypoint.name          = child.GetValue("name");
                wpData.waypoint.id            = child.GetValue("icon");
                wpData.waypoint.latitude      = Convert.ToDouble(child.GetValue("latitude"));
                wpData.waypoint.longitude     = Convert.ToDouble(child.GetValue("longitude"));
                wpData.waypoint.altitude      = Convert.ToDouble(child.GetValue("altitude"));
                wpData.waypoint.index         = Convert.ToInt32(child.GetValue("index"));

                // Set contract data
                wpData.SetContract(contract);

                // Create additional waypoint details
                AddWayPoint(wpData.waypoint);

                // Add to the global list
                waypoints.Add(wpData);
            }
        }
示例#2
0
        protected override void OnLoad(ConfigNode configNode)
        {
            base.OnLoad(configNode);

            foreach (ConfigNode child in configNode.GetNodes("WAYPOINT"))
            {
                // Read all the waypoint data
                WaypointData wpData = new WaypointData();
                wpData.type      = child.GetValue("type");
                wpData.parameter = ConfigNodeUtil.ParseValue <string>(child, "parameter", "");
                wpData.waypoint.celestialName = child.GetValue("celestialName");
                wpData.waypoint.name          = child.GetValue("name");
                wpData.waypoint.id            = child.GetValue("icon");
                wpData.waypoint.latitude      = Convert.ToDouble(child.GetValue("latitude"));
                wpData.waypoint.longitude     = Convert.ToDouble(child.GetValue("longitude"));
                wpData.waypoint.altitude      = Convert.ToDouble(child.GetValue("altitude"));
                wpData.waypoint.index         = Convert.ToInt32(child.GetValue("index"));
                wpData.hidden = ConfigNodeUtil.ParseValue <bool?>(child, "hidden", (bool?)false).Value;

                // Set contract data
                wpData.SetContract(contract);

                // Create additional waypoint details
                if (!wpData.hidden && (string.IsNullOrEmpty(wpData.parameter) || contract.AllParameters.
                                       Where(p => p.ID == wpData.parameter && p.State == ParameterState.Complete).Any()))
                {
                    AddWayPoint(wpData.waypoint);
                }

                // Add to the global list
                waypoints.Add(wpData);
            }
        }
示例#3
0
        protected override void OnLoad(ConfigNode configNode)
        {
            base.OnLoad(configNode);

            foreach (ConfigNode child in configNode.GetNodes("WAYPOINT"))
            {
                // Read all the waypoint data
                WaypointData wpData = new WaypointData();
                wpData.type      = child.GetValue("type");
                wpData.parameter = ConfigNodeUtil.ParseValue <List <string> >(child, "parameter", new List <string>());
                wpData.names     = ConfigNodeUtil.ParseValue <List <string> >(child, "names", new List <string>());
                wpData.waypoint.celestialName = child.GetValue("celestialName");
                wpData.waypoint.name          = child.GetValue("name");
                wpData.waypoint.id            = child.GetValue("icon");
                wpData.waypoint.latitude      = Convert.ToDouble(child.GetValue("latitude"));
                wpData.waypoint.longitude     = Convert.ToDouble(child.GetValue("longitude"));
                wpData.waypoint.altitude      = Convert.ToDouble(child.GetValue("altitude"));
                wpData.waypoint.index         = Convert.ToInt32(child.GetValue("index"));
                wpData.waypoint.visible       = !(ConfigNodeUtil.ParseValue <bool?>(child, "hidden", (bool?)false).Value);
                wpData.waypoint.isClustered   = ConfigNodeUtil.ParseValue <bool?>(child, "clustered", (bool?)false).Value;

                string pqsCityName = ConfigNodeUtil.ParseValue <string>(child, "pqsCity", null);
                if (pqsCityName != null)
                {
                    CelestialBody body = FlightGlobals.Bodies.Where(b => b.name == wpData.waypoint.celestialName).First();
                    wpData.pqsCity   = body.GetComponentsInChildren <PQSCity>(true).Where(pqs => pqs.name == pqsCityName).First();
                    wpData.pqsOffset = ConfigNodeUtil.ParseValue <Vector3d>(child, "pqsOffset");
                }

                wpData.randomAltitude = ConfigNodeUtil.ParseValue <bool?>(child, "randomAltitude", (bool?)false).Value;
                wpData.underwater     = ConfigNodeUtil.ParseValue <bool?>(child, "underwater", (bool?)false).Value;

                // Set contract data
                wpData.SetContract(contract);

                // Create additional waypoint details
                string paramID = wpData.parameter.FirstOrDefault();
                if (wpData.waypoint.visible && (!wpData.parameter.Any() || contract.AllParameters.
                                                Where(p => p.ID == paramID && p.State == ParameterState.Complete).Any()))
                {
                    AddWayPoint(wpData);
                }

                // Add to the global list
                waypoints.Add(wpData);
            }
        }
        protected override void OnLoad(ConfigNode configNode)
        {
            base.OnLoad(configNode);

            foreach (ConfigNode child in configNode.GetNodes("WAYPOINT"))
            {
                // Read all the waypoint data
                WaypointData wpData = new WaypointData();
                wpData.type = child.GetValue("type");
                wpData.parameter = ConfigNodeUtil.ParseValue<string>(child, "parameter", "");
                wpData.waypoint.celestialName = child.GetValue("celestialName");
                wpData.waypoint.name = child.GetValue("name");
                wpData.waypoint.id = child.GetValue("icon");
                wpData.waypoint.latitude = Convert.ToDouble(child.GetValue("latitude"));
                wpData.waypoint.longitude = Convert.ToDouble(child.GetValue("longitude"));
                wpData.waypoint.altitude = Convert.ToDouble(child.GetValue("altitude"));
                wpData.waypoint.index = Convert.ToInt32(child.GetValue("index"));
                wpData.waypoint.visible = !(ConfigNodeUtil.ParseValue<bool?>(child, "hidden", (bool?)false).Value);

                // Set contract data
                wpData.SetContract(contract);

                // Create additional waypoint details
                if (wpData.waypoint.visible && (string.IsNullOrEmpty(wpData.parameter) || contract.AllParameters.
                    Where(p => p.ID == wpData.parameter && p.State == ParameterState.Complete).Any()))
                {
                    AddWayPoint(wpData.waypoint);
                }

                // Add to the global list
                waypoints.Add(wpData);
            }
        }
        protected override void OnLoad(ConfigNode configNode)
        {
            base.OnLoad(configNode);

            foreach (ConfigNode child in configNode.GetNodes("WAYPOINT"))
            {
                // Read all the waypoint data
                WaypointData wpData = new WaypointData();
                wpData.type = child.GetValue("type");
                wpData.parameter = ConfigNodeUtil.ParseValue<List<string>>(child, "parameter", new List<string>());
                wpData.names = ConfigNodeUtil.ParseValue<List<string>>(child, "names", new List<string>());
                wpData.waypoint.celestialName = child.GetValue("celestialName");
                wpData.waypoint.name = child.GetValue("name");
                wpData.waypoint.id = child.GetValue("icon");
                wpData.waypoint.latitude = Convert.ToDouble(child.GetValue("latitude"));
                wpData.waypoint.longitude = Convert.ToDouble(child.GetValue("longitude"));
                wpData.waypoint.altitude = Convert.ToDouble(child.GetValue("altitude"));
                wpData.waypoint.index = Convert.ToInt32(child.GetValue("index"));
                wpData.waypoint.visible = !(ConfigNodeUtil.ParseValue<bool?>(child, "hidden", (bool?)false).Value);
                wpData.waypoint.isClustered = ConfigNodeUtil.ParseValue<bool?>(child, "clustered", (bool?)false).Value;

                string pqsCityName = ConfigNodeUtil.ParseValue<string>(child, "pqsCity", null);
                if (pqsCityName != null)
                {
                    CelestialBody body = FlightGlobals.Bodies.Where(b => b.name == wpData.waypoint.celestialName).First();
                    wpData.pqsCity = body.GetComponentsInChildren<PQSCity>(true).Where(pqs => pqs.name == pqsCityName).First();
                    wpData.pqsOffset = ConfigNodeUtil.ParseValue<Vector3d>(child, "pqsOffset");
                }

                wpData.randomAltitude = ConfigNodeUtil.ParseValue<bool?>(child, "randomAltitude", (bool?)false).Value;
                wpData.underwater = ConfigNodeUtil.ParseValue<bool?>(child, "underwater", (bool?)false).Value;

                // Set contract data
                wpData.SetContract(contract);

                // Create additional waypoint details
                string paramID = wpData.parameter.FirstOrDefault();
                if (wpData.waypoint.visible && (!wpData.parameter.Any() || contract.AllParameters.
                    Where(p => p.ID == paramID && p.State == ParameterState.Complete).Any()))
                {
                    AddWayPoint(wpData);
                }

                // Add to the global list
                waypoints.Add(wpData);
            }
        }
        protected override void OnLoad(ConfigNode configNode)
        {
            base.OnLoad(configNode);

            foreach (ConfigNode child in configNode.GetNodes("WAYPOINT"))
            {
                // Read all the waypoint data
                WaypointData wpData = new WaypointData();
                wpData.type = child.GetValue("type");
                wpData.parameter = ConfigNodeUtil.ParseValue<List<string>>(child, "parameter", new List<string>());
                wpData.waypoint.celestialName = child.GetValue("celestialName");
                wpData.waypoint.name = child.GetValue("name");
                wpData.waypoint.id = child.GetValue("icon");
                wpData.waypoint.latitude = Convert.ToDouble(child.GetValue("latitude"));
                wpData.waypoint.longitude = Convert.ToDouble(child.GetValue("longitude"));
                wpData.waypoint.altitude = Convert.ToDouble(child.GetValue("altitude"));
                wpData.waypoint.index = Convert.ToInt32(child.GetValue("index"));
                wpData.waypoint.visible = !(ConfigNodeUtil.ParseValue<bool?>(child, "hidden", (bool?)false).Value);
                wpData.waypoint.isClustered = ConfigNodeUtil.ParseValue<bool?>(child, "clustered", (bool?)false).Value;

                // Workaround for buggy stuff saved by older versions
                if (wpData.parameter.Any() && wpData.parameter.First().StartsWith("System.Collections.Generic.List"))
                {
                    wpData.parameter.Clear();
                }

                // Set contract data
                wpData.SetContract(contract);

                // Create additional waypoint details
                string paramID = wpData.parameter.FirstOrDefault();
                if (wpData.waypoint.visible && (!wpData.parameter.Any() || contract.AllParameters.
                    Where(p => p.ID == paramID && p.State == ParameterState.Complete).Any()))
                {
                    AddWayPoint(wpData.waypoint);
                }

                // Add to the global list
                waypoints.Add(wpData);
            }
        }