Example #1
0
 private static void MoveItem(int countX, int countY, ItemInventory fromIn, ItemInventory toIn, IInventoryUI fromUI, IInventoryUI toUI, ItemPosition ip, ItemPosition old, ISkillArgs args)
 {
     if (fromIn.CanMoveTo(ip, toIn, countX, countY))
     {
         fromIn.ChangePosition(ip, toIn, countX, countY);
         HandleMoveAction(fromIn, toIn, fromUI, toUI, ip, args);
         if (fromIn == toIn)
         {
             fromUI.UpdateItem(args, fromIn, ip);
         }
         else
         {
             fromUI.DeleteItem(args, fromIn, ip);
             toUI.AddItem(args, toIn, ip);
         }
     }
     else
     {
         fromIn.ChangePosition(ip, fromIn, ip.GetX(), ip.GetY());
         if (fromUI.CanNotMoveAction != null)
         {
             fromUI.CanNotMoveAction.Act(args);
         }
         fromUI.UpdateItem(args, fromIn, ip);
     }
 }