public static ListValue PartsToList(IEnumerable <global::Part> parts, SharedObjects shared)
        {
            //We need to walk the part tree for this, not just the list. So we start with the vessel.
            Vessel vessel   = parts.First().vessel;
            var    elements = new Dictionary <uint, ElementValue>();

            Queue <ElementPair> queue = InitQueue(vessel, elements, shared);

            //Runs the queue over the part tree
            WorkQueue(queue, elements, shared);

            return(ListValue.CreateList(elements.Values.ToList()));
        }
示例#2
0
        public static ListValue <AggregateResourceValue> FromVessel(Vessel vessel, SharedObjects shared)
        {
            var resources = ProspectResources(vessel.parts, shared);

            return(ListValue <AggregateResourceValue> .CreateList(resources.Values));
        }
        private ListValue <PartValue> GetParts()
        {
            var parts = PartValueFactory.Construct(resources.Select(r => r.part), shared);

            return(ListValue <PartValue> .CreateList(parts));
        }