示例#1
0
 /// <summary>
 /// Picks up an item.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="amount">Optional, defaults to null. If null, and the item amount is greater than 1, a 'pick up how many' gump will appear?</param>
 private void PickUpItem(Item item, int x, int y, int? amount = null)
 {
     // hold 'shift' to pick up an entire stack.
     // if in a bag and is a quantity, then show the 'lift amount' prompt, else just lift it outright.
     if (!m_Input.IsShiftDown && !amount.HasValue && !(item is Corpse) && item.Amount > 1)
     {
         SplitItemStackGump gump = new SplitItemStackGump(item, new Point(x, y));
         m_UserInterface.AddControl(gump, m_Input.MousePosition.X - 80, m_Input.MousePosition.Y - 40);
         m_UserInterface.AttemptDragControl(gump, m_Input.MousePosition, true);
     }
     else
     {
         PickupItemWithoutAmountCheck(item, x, y, amount.HasValue ? amount.Value : item.Amount);
     }
 }
示例#2
0
 /// <summary>
 /// Picks up an item. For stacks, picks up entire stack if shift is down or picking up from a corpse.
 /// Otherwise, shows "pick up how many?" gump unless amountToPickUp param is set or amount is 1. 
 /// </summary>
 void PickUpItem(Item item, int x, int y, int? amountToPickUp = null)
 {
     if (!m_Input.IsShiftDown && !amountToPickUp.HasValue && !(item is Corpse) && item.Amount > 1)
     {
         SplitItemStackGump gump = new SplitItemStackGump(item, new Point(x, y));
         m_UserInterface.AddControl(gump, m_Input.MousePosition.X - 80, m_Input.MousePosition.Y - 40);
         m_UserInterface.AttemptDragControl(gump, m_Input.MousePosition, true);
     }
     else
     {
         PickupItemWithoutAmountCheck(item, x, y, amountToPickUp.HasValue ? amountToPickUp.Value : item.Amount);
     }
 }