示例#1
0
        private void EndCompress()
        {
            Part prefab = this.queue[this.queue.Count - 1].apart.partPrefab;

            this.dtime  = 0f;
            this.isBusy = false;
            this.queue.RemoveAt(this.queue.Count - 1);
            System.Collections.Generic.List <ModuleKISInventory> invs = MBToolbox.GetInventories(base.vessel);
            if (invs.Count == 0)
            {
                ScreenMessages.PostScreenMessage("No inventories found!", 2f, ScreenMessageStyle.UPPER_CENTER);
            }
            else
            {
                foreach (ModuleKISInventory inv in invs)
                {
                    if (inv.part.name == base.part.name)
                    {
                        if (inv.isFull() || inv.GetContentVolume() + 1000f > inv.maxVolume)
                        {
                            break;
                        }
                        inv.AddItem(prefab, 1f, -1);
                        return;
                    }
                }
                foreach (ModuleKISInventory inv2 in invs)
                {
                    if (!inv2.isFull() || inv2.GetContentVolume() + 1000f <= inv2.maxVolume)
                    {
                        inv2.AddItem(prefab, 1f, -1);
                        return;
                    }
                }
                ScreenMessages.PostScreenMessage("No free inventories found!", 2f, ScreenMessageStyle.UPPER_CENTER);
            }
        }