public CargoTransaction(IHasCargo subject, CargoTransactionTypes type) { _cargoHolder = subject; CargoHolderID = subject.Id; TransactionType = type; ResultCompletionSource = new TaskCompletionSource <CargoResult>(); ResultTask = ResultCompletionSource.Task; }
/// <summary> /// Leave cargoObject null to chain to a previous transaction in a sequence. /// </summary> /// <param name="recipient"></param> /// <param name="cargoObject"></param> /// <param name="suspendBoundsChecking"></param> public TransactionAddStatefulCargo(IHasCargo recipient, StatefulCargo cargoObject, bool suspendBoundsChecking) : base(recipient, CargoTransactionTypes.AddStatefulCargo) { if (cargoObject != null) { CargoType = cargoObject.CargoType; } CargoObject = cargoObject; }
/// <summary> /// Set cargoID to null if transaction applies to first cargo found in IHasCargo object /// </summary> /// <param name="objectID"></param> /// <param name="cargoType"></param> /// <param name="cargoID"></param> /// <param name="transferToNextTransaction">If true, and this transaction occurs as part of a SequentialTransaction, and the next transaction is of type AddStatefulCargo, then the cargo object removed by this transaction will serve as the Cargo added in the subsequent AddStatefulCargoTransaction</param> public TransactionRemoveStatefulCargo(IHasCargo donor, StatefulCargoTypes cargoType, int?cargoID, bool transferToNextTransaction = false) : base(donor, CargoTransactionTypes.RemoveStatefulCargo) { CargoType = cargoType; CargoID = cargoID; TransferToNextTransaction = transferToNextTransaction; }
public TransactionRemoveStatelessCargo(IHasCargo donor, StatelessCargoTypes cargoType, float amount) : base(donor, CargoTransactionTypes.RemoveStatelessCargo) { CargoType = cargoType; Quantity = amount; }
public TransactionAddStatelessCargo(IHasCargo recipient, StatelessCargoTypes cargoType, float amount, bool suspendBoundsChecking) : base(recipient, CargoTransactionTypes.AddStatelessCargo) { CargoType = cargoType; Quantity = amount; }