コード例 #1
0
ファイル: VolumeContainerGUI.cs プロジェクト: zxzxn3/SSTULabs
        public static void openGUI(SSTUVolumeContainer container, ContainerDefinition[] modContainers)
        {
            containerIndex = 0;
            module         = container;
            int len = modContainers.Length;
            List <ContainerDefinition> availContainers = new List <ContainerDefinition>();

            for (int i = 0; i < len; i++)
            {
                if (modContainers[i].guiAvailable)// && modContainers[i].rawVolume > 0)
                {
                    availContainers.Add(modContainers[i]);
                }
            }
            containers = availContainers.ToArray();
            id         = module.GetInstanceID();
            statId     = id + 1;
            len        = containers.Length;
            //if nothing is available to adjust, do not open the window
            if (len <= 0)
            {
                closeGUI();
                return;
            }
            resourceEntries = new VolumeRatioEntry[len][];
            string[] names;
            PartResourceDefinition def;

            for (int i = 0; i < len; i++)
            {
                names = containers[i].getResourceNames();
                int len2 = names.Length;
                resourceEntries[i] = new VolumeRatioEntry[len2];
                for (int k = 0; k < len2; k++)
                {
                    def = PartResourceLibrary.Instance.GetDefinition(names[k]);
                    resourceEntries[i][k] = new VolumeRatioEntry(containers[i], names[k], def.displayName, containers[i].getResourceUnitRatio(names[k]));
                }
            }
        }
コード例 #2
0
 public static void openGUI(SSTUVolumeContainer container, ContainerDefinition[] modContainers)
 {
     containerIndex = 0;
     module = container;
     int len = modContainers.Length;
     List<ContainerDefinition> availContainers = new List<ContainerDefinition>();
     for (int i = 0; i < len; i++)
     {
         if (modContainers[i].guiAvailable && modContainers[i].containerPercent > 0)
         {
             availContainers.Add(modContainers[i]);
         }
     }
     containers = availContainers.ToArray();
     id = module.GetInstanceID();
     statId = id + 1;
     len = containers.Length;
     if (len <= 0)
     {
         closeGUI();
         return;
     }
     resourceEntries = new VolumeRatioEntry[len][];
     string[] names;
     PartResourceDefinition def;
     for (int i = 0; i < len; i++)
     {
         names = containers[i].getResourceNames();
         int len2 = names.Length;
         resourceEntries[i] = new VolumeRatioEntry[len2];
         for (int k = 0; k < len2; k++)
         {
             def = PartResourceLibrary.Instance.GetDefinition(names[k]);
             resourceEntries[i][k] = new VolumeRatioEntry(containers[i], names[k], def.title, containers[i].getResourceUnitRatio(names[k]));
         }
     }
 }
コード例 #3
0
        public static void openGUI(SSTUVolumeContainer container, ContainerDefinition[] modContainers)
        {
            containerIndex = 0;
            module         = container;
            int len = modContainers.Length;
            List <ContainerDefinition> availContainers = new List <ContainerDefinition>();

            for (int i = 0; i < len; i++)
            {
                if (modContainers[i].guiAvailable && modContainers[i].containerPercent > 0)
                {
                    availContainers.Add(modContainers[i]);
                }
            }
            containers = availContainers.ToArray();
            id         = module.GetInstanceID();
            statId     = id + 1;
            len        = containers.Length;
            if (len <= 0)
            {
                closeGUI();
                return;
            }
            resourceEntries = new VolumeRatioEntry[len][];
            string[] names;
            for (int i = 0; i < len; i++)
            {
                names = containers[i].getResourceNames();
                int len2 = names.Length;
                resourceEntries[i] = new VolumeRatioEntry[len2];
                for (int k = 0; k < len2; k++)
                {
                    resourceEntries[i][k] = new VolumeRatioEntry(containers[i], names[k], containers[i].getResourceUnitRatio(names[k]));
                }
            }
        }