public ItemIconPickUpImplementor CreateIIPUImplementor(int transferableQuantity, int itemQuantity, int pickUpStepQuantity, out IItemIcon ii, out IItemIconTransactionManager iiTAM, out IPickUpSystemUIElementFactory uieFactory) { IItemIcon thisII = Substitute.For <IItemIcon>(); thisII.GetUIImage().Returns(Substitute.For <IUIImage>()); IItemTemplate itemTemp = Substitute.For <IItemTemplate>(); itemTemp.GetPickUpStepQuantity().Returns(pickUpStepQuantity); // thisII.GetItemTemplate().Returns(itemTemp); IUIItem item = Substitute.For <IUIItem>(); item.GetItemTemplate().Returns(itemTemp); thisII.GetUIItem().Returns(item); thisII.GetTransferableQuantity().Returns(transferableQuantity); thisII.GetItemQuantity().Returns(itemQuantity); thisII.GetIconGroup().Returns(Substitute.For <IIconGroup>()); IItemIconTransactionManager thisIITAM = Substitute.For <IItemIconTransactionManager>(); IPickUpSystemUIElementFactory thisUIEFactory = Substitute.For <IPickUpSystemUIElementFactory>(); ItemIconPickUpImplementor implementor = new ItemIconPickUpImplementor(thisIITAM, thisUIEFactory); implementor.SetItemIcon(thisII); ii = thisII; iiTAM = thisIITAM; uieFactory = thisUIEFactory; return(implementor); }
void IncrementPickUpQuantityBy(int increQuantity) { IItemIcon pickedII = thisIITAM.GetPickedII(); pickedII.IncreaseBy(increQuantity, doesIncrement: true); thisItemIcon.DecreaseBy(increQuantity, doesIncrement: true, removesEmpty: false); int newPickedUpQuantity = pickedII.GetItemQuantity(); thisItemIcon.UpdateTransferableQuantity(newPickedUpQuantity); }
public void RemoveItem(IUIItem item, bool doesIncrement, bool removesEmpty) { if (item != null) { IItemIcon thisII = GetItemIconFromItem(item); if (thisII != null) { thisII.DecreaseBy(thisII.GetItemQuantity(), doesIncrement, removesEmpty); } } }