Exemple #1
0
        private void CalculateAndRecacheTransferables()
        {
            this.transferables = new List <TransferableOneWay>();
            this.AddPawnsToTransferables();
            this.AddItemsToTransferables();
            IEnumerable <TransferableOneWay> enumerable = null;
            string text             = null;
            string destinationLabel = null;
            string text2            = "FormCaravanColonyThingCountTip".Translate();
            bool   flag             = true;
            IgnorePawnsInventoryMode ignorePawnInventoryMass = IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload;
            bool         flag2 = true;
            Func <float> availableMassGetter = () => this.MassCapacity - this.MassUsage;
            int          tile = this.map.Tile;

            this.pawnsTransfer = new TransferableOneWayWidget(enumerable, text, destinationLabel, text2, flag, ignorePawnInventoryMass, flag2, availableMassGetter, 0f, false, tile, true, true, true, false, true, false, false);
            CaravanUIUtility.AddPawnsSections(this.pawnsTransfer, this.transferables);
            enumerable = from x in this.transferables
                         where x.ThingDef.category != ThingCategory.Pawn
                         select x;

            text2                   = null;
            destinationLabel        = null;
            text                    = "FormCaravanColonyThingCountTip".Translate();
            flag2                   = true;
            ignorePawnInventoryMass = IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload;
            flag                    = true;
            availableMassGetter     = (() => this.MassCapacity - this.MassUsage);
            tile                    = this.map.Tile;
            this.itemsTransfer      = new TransferableOneWayWidget(enumerable, text2, destinationLabel, text, flag2, ignorePawnInventoryMass, flag, availableMassGetter, 0f, false, tile, true, false, false, true, false, true, false);
            this.CountToTransferChanged();
        }
Exemple #2
0
        private void CalculateAndRecacheTransferables()
        {
            transferables = new List <TransferableOneWay>();
            AddPawnsToTransferables();
            AddItemsToTransferables();
            IEnumerable <TransferableOneWay> enumerable = null;
            string sourceLabel      = null;
            string destinationLabel = null;
            string sourceCountDesc  = "FormCaravanColonyThingCountTip".Translate();
            bool   drawMass         = true;
            IgnorePawnsInventoryMode ignorePawnInventoryMass = IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload;
            bool         includePawnsMassInMassUsage         = true;
            Func <float> availableMassGetter = () => MassCapacity - MassUsage;
            int          tile = map.Tile;

            pawnsTransfer = new TransferableOneWayWidget(enumerable, sourceLabel, destinationLabel, sourceCountDesc, drawMass, ignorePawnInventoryMass, includePawnsMassInMassUsage, availableMassGetter, 0f, ignoreSpawnedCorpseGearAndInventoryMass: false, tile, drawMarketValue: true, drawEquippedWeapon: true, drawNutritionEatenPerDay: true, drawItemNutrition: false, drawForagedFoodPerDay: true);
            CaravanUIUtility.AddPawnsSections(pawnsTransfer, transferables);
            enumerable = from x in transferables
                         where x.ThingDef.category != ThingCategory.Pawn
                         select x;

            sourceCountDesc             = null;
            destinationLabel            = null;
            sourceLabel                 = "FormCaravanColonyThingCountTip".Translate();
            includePawnsMassInMassUsage = true;
            ignorePawnInventoryMass     = IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload;
            drawMass            = true;
            availableMassGetter = (() => MassCapacity - MassUsage);
            tile          = map.Tile;
            itemsTransfer = new TransferableOneWayWidget(enumerable, sourceCountDesc, destinationLabel, sourceLabel, includePawnsMassInMassUsage, ignorePawnInventoryMass, drawMass, availableMassGetter, 0f, ignoreSpawnedCorpseGearAndInventoryMass: false, tile, drawMarketValue: true, drawEquippedWeapon: false, drawNutritionEatenPerDay: false, drawItemNutrition: true, drawForagedFoodPerDay: false, drawDaysUntilRot: true);
            CountToTransferChanged();
        }
 public static void CreateCaravanTransferableWidgets(List <TransferableOneWay> transferables, out TransferableOneWayWidget pawnsTransfer, out TransferableOneWayWidget itemsTransfer, string sourceLabel, string destLabel, string thingCountTip, IgnorePawnsInventoryMode ignorePawnInventoryMass, Func <float> availableMassGetter, bool ignoreCorpsesGearAndInventoryMass, int drawDaysUntilRotForTile)
 {
     pawnsTransfer = new TransferableOneWayWidget(null, sourceLabel, destLabel, thingCountTip, true, ignorePawnInventoryMass, false, availableMassGetter, 24f, ignoreCorpsesGearAndInventoryMass, true, -1);
     CaravanUIUtility.AddPawnsSections(pawnsTransfer, transferables);
     itemsTransfer = new TransferableOneWayWidget(from x in transferables
                                                  where x.ThingDef.category != ThingCategory.Pawn
                                                  select x, sourceLabel, destLabel, thingCountTip, true, ignorePawnInventoryMass, false, availableMassGetter, 24f, ignoreCorpsesGearAndInventoryMass, true, drawDaysUntilRotForTile);
 }
 private void CalculateAndRecacheTransferables()
 {
     this.transferables = new List <TransferableOneWay>();
     this.AddPawnsToTransferables();
     this.AddItemsToTransferables();
     this.pawnsTransfer = new TransferableOneWayWidget(null, Faction.OfPlayer.Name, this.TransportersLabelCap, "FormCaravanColonyThingCountTip".Translate(), true, IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload, true, () => this.MassCapacity - this.MassUsage, 24f, false, true, -1);
     CaravanUIUtility.AddPawnsSections(this.pawnsTransfer, this.transferables);
     this.itemsTransfer = new TransferableOneWayWidget(from x in this.transferables
                                                       where x.ThingDef.category != ThingCategory.Pawn
                                                       select x, Faction.OfPlayer.Name, this.TransportersLabelCap, "FormCaravanColonyThingCountTip".Translate(), true, IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload, true, () => this.MassCapacity - this.MassUsage, 24f, false, true, this.map.Tile);
     this.CountToTransferChanged();
 }
        public static void AddPawnsSections(TransferableOneWayWidget widget, List <TransferableOneWay> transferables)
        {
            IEnumerable <TransferableOneWay> source = from x in transferables
                                                      where x.ThingDef.category == ThingCategory.Pawn
                                                      select x;

            widget.AddSection("ColonistsSection".Translate(), from x in source
                              where ((Pawn)x.AnyThing).IsFreeColonist
                              select x);
            widget.AddSection("PrisonersSection".Translate(), from x in source
                              where ((Pawn)x.AnyThing).IsPrisoner
                              select x);
            widget.AddSection("AnimalsSection".Translate(), from x in source
                              where ((Pawn)x.AnyThing).RaceProps.Animal
                              select x);
        }
 private void CalculateAndRecacheTransferables()
 {
     transferables = new List <TransferableOneWay>();
     AddPawnsToTransferables();
     AddItemsToTransferables();
     if (CanChangeAssignedThingsAfterStarting && LoadingInProgressOrReadyToLaunch)
     {
         for (int i = 0; i < transporters.Count; i++)
         {
             for (int j = 0; j < transporters[i].innerContainer.Count; j++)
             {
                 AddToTransferables(transporters[i].innerContainer[j]);
             }
         }
         foreach (Thing item in TransporterUtility.ThingsBeingHauledTo(transporters, map))
         {
             AddToTransferables(item);
         }
     }
     pawnsTransfer = new TransferableOneWayWidget(null, null, null, "FormCaravanColonyThingCountTip".Translate(), drawMass: true, IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload, includePawnsMassInMassUsage: true, () => MassCapacity - MassUsage, 0f, ignoreSpawnedCorpseGearAndInventoryMass: false, map.Tile, drawMarketValue: true, drawEquippedWeapon: true, drawNutritionEatenPerDay: true, drawItemNutrition: false, drawForagedFoodPerDay: true);
     CaravanUIUtility.AddPawnsSections(pawnsTransfer, transferables);
     itemsTransfer = new TransferableOneWayWidget(transferables.Where((TransferableOneWay x) => x.ThingDef.category != ThingCategory.Pawn), null, null, "FormCaravanColonyThingCountTip".Translate(), drawMass: true, IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload, includePawnsMassInMassUsage: true, () => MassCapacity - MassUsage, 0f, ignoreSpawnedCorpseGearAndInventoryMass: false, map.Tile, drawMarketValue: true, drawEquippedWeapon: false, drawNutritionEatenPerDay: false, drawItemNutrition: true, drawForagedFoodPerDay: false, drawDaysUntilRot: true);
     CountToTransferChanged();
 }