private void SetResourceItems()
        {
            bool visibleResources = false;

            for (int i = 0; i < selectedPart.Resources.list.Count; ++i)
            {
                if (selectedPart.Resources.list[i].hideFlow == false)
                {
                    visibleResources = true;
                    break;
                }
            }
            if (visibleResources)
            {
                infoItems.Add(PartInfoItem.Create("Resources"));
                for (int i = 0; i < selectedPart.Resources.list.Count; ++i)
                {
                    partResource = selectedPart.Resources.list[i];

                    if (partResource.hideFlow == false)
                    {
                        infoItems.Add(partResource.GetDensity() > 0
                            ? PartInfoItem.Create("\t" + partResource.info.name, "(" + partResource.GetMass().ToMass() + ") " + partResource.amount.ToString("F1"))
                            : PartInfoItem.Create("\t" + partResource.info.name, partResource.amount.ToString("F1")));
                    }
                }
            }
        }
        private void SetResourceItems()
        {
            bool visibleResources = false;
            for (int i = 0; i < selectedPart.Resources.dict.Count; ++i)
            {
                if (selectedPart.Resources.dict.At(i).hideFlow == false)
                {
                    visibleResources = true;
                    break;
                }
            }
            if (visibleResources)
            {
                infoItems.Add(PartInfoItem.Create("Resources"));
                for (int i = 0; i < selectedPart.Resources.dict.Count; ++i)
                {
                    partResource = selectedPart.Resources.dict.At(i);

                    if (partResource.hideFlow == false)
                    {
                        infoItems.Add(partResource.GetDensity() > 0
                            ? PartInfoItem.Create("\t" + partResource.info.name, "(" + partResource.GetMass().ToMass() + ") " + partResource.amount.ToString("F1"))
                            : PartInfoItem.Create("\t" + partResource.info.name, partResource.amount.ToString("F1")));
                    }
                }
            }
        }
Example #3
0
 /// <summary>
 ///     Gets the mass of the resource.
 /// </summary>
 public static double GetMass(this PartResource resource)
 {
     return(resource.amount * resource.GetDensity());
 }
 /// <summary>
 /// Gets the mass of the resource.
 /// </summary>
 public static double GetMass(this PartResource value)
 {
     return(value.amount * value.GetDensity());
 }