private void SetToLoadEverything() { for (int i = 0; i < this.transferables.Count; i++) { TransferableUtility.Transfer(this.transferables[i].things, this.transferables[i].CountToTransfer, delegate(Thing splitPiece, IThingHolder originalThing) { this.ship.GetDirectlyHeldThings().TryAdd(splitPiece, true); }); } this.CountToTransferChanged(); }
private bool DebugTryLoadInstantly() { for (int i = 0; i < this.transferables.Count; i++) { TransferableUtility.Transfer(this.transferables[i].things, this.transferables[i].countToTransfer, delegate(Thing splitPiece, Thing originalThing) { this.ship.GetInnerContainer().TryAdd(splitPiece, true); }); } return(true); }
private bool DebugTryLoadInstantly() { for (int i = 0; i < this.transferables.Count; i++) { TransferableUtility.Transfer(this.transferables[i].things, this.transferables[i].CountToTransfer, delegate(Thing splitPiece, IThingHolder originalThing) { this.ship.GetDirectlyHeldThings().TryAdd(splitPiece, true); }); } return(true); }
private bool DebugTryLoadInstantly() { this.CreateAndAssignNewTransportersGroup(); int i; for (i = 0; i < this.transferables.Count; i++) { TransferableUtility.Transfer(this.transferables[i].things, this.transferables[i].CountToTransfer, delegate(Thing splitPiece, IThingHolder originalThing) { this.transporters[i % this.transporters.Count].GetDirectlyHeldThings().TryAdd(splitPiece, true); }); } return(true); }
public void BottomButtons(Rect rect) { Rect rect2 = new Rect(rect.width / 2f - BottomButtonSize.x / 2f, rect.height - 55f - 17f, BottomButtonSize.x, BottomButtonSize.y); if (Widgets.ButtonText(rect2, "AcceptButton".Translate(), true, true, true)) { List <TransferableOneWay> cargoToTransfer = transferables.Where(t => t.CountToTransfer > 0).ToList(); vehicle.cargoToLoad = cargoToTransfer; vehicle.Map.GetCachedMapComponent <VehicleReservationManager>().RegisterLister(vehicle, ReservationType.LoadVehicle); Close(true); } if (Widgets.ButtonText(new Rect(rect2.x - 10f - BottomButtonSize.x, rect2.y, BottomButtonSize.x, BottomButtonSize.y), "ResetButton".Translate(), true, true, true)) { SoundDefOf.Tick_Low.PlayOneShotOnCamera(null); CalculateAndRecacheTransferables(); } if (Widgets.ButtonText(new Rect(rect2.xMax + 10f, rect2.y, BottomButtonSize.x, BottomButtonSize.y), "CancelButton".Translate(), true, true, true)) { Close(true); } if (Prefs.DevMode) { float width = 200f; float num = BottomButtonSize.y / 2f; if (Widgets.ButtonText(new Rect(0f, rect.height - 55f - 17f, width, num), "Dev: Pack Instantly", true, true, true)) { SoundDefOf.Tick_High.PlayOneShotOnCamera(null); for (int i = 0; i < transferables.Count; i++) { List <Thing> things = transferables[i].things; int countToTransfer = transferables[i].CountToTransfer; Action <Thing, IThingHolder> transferred = null; if (transferred is null) { transferred = delegate(Thing thing, IThingHolder originalHolder) { vehicle.inventory.innerContainer.TryAdd(thing, true); }; } TransferableUtility.Transfer(things, countToTransfer, transferred); } Close(false); } if (Widgets.ButtonText(new Rect(0f, rect.height - 55f - 17f + num, width, num), "Dev: Select everything", true, true, true)) { SoundDefOf.Tick_High.PlayOneShotOnCamera(null); SetToSendEverything(); } } }