onPartResourcesChanged() private method

private onPartResourcesChanged ( ) : void
return void
コード例 #1
0
        public static void updateResourceVolume(Part part)
        {
            SSTULog.debug("Part volume changed...");
            SSTUVolumeContainer vc = part.GetComponent <SSTUVolumeContainer>();

            if (vc != null)
            {
                vc.recalcVolume();
                SSTUResourceBoiloff rb = part.GetComponent <SSTUResourceBoiloff>();
                if (rb != null)
                {
                    rb.onPartResourcesChanged();
                }
            }
            else
            {
                IContainerVolumeContributor[] contributors = part.FindModulesImplementing <IContainerVolumeContributor>().ToArray();
                ContainerContribution[]       cts;
                int   len         = contributors.Length;
                float totalVolume = 0;
                for (int i = 0; i < len; i++)
                {
                    cts = contributors[i].getContainerContributions();
                    int len2 = cts.Length;
                    for (int k = 0; k < len2; k++)
                    {
                        totalVolume += cts[k].containerVolume;
                    }
                }
                realFuelsVolumeUpdate(part, totalVolume);
            }
        }
コード例 #2
0
        /// <summary>
        /// Update the resources for the part from the resources in the currently configured containers
        /// </summary>
        private void updateTankResources()
        {
            SSTUResourceList list = new SSTUResourceList();
            int len = containers.Length;

            for (int i = 0; i < len; i++)
            {
                containers[i].getResources(list);
            }
            list.setResourcesToPart(part, inflationMultiplier, HighLogic.LoadedSceneIsFlight);
            updateMassAndCost();
            SSTUStockInterop.fireEditorUpdate();
            SSTUModInterop.onContainerUpdated(this);
            SSTUResourceBoiloff rb = part.GetComponent <SSTUResourceBoiloff>();

            if (rb != null)
            {
                rb.onPartResourcesChanged();
            }
        }