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); } }
private static void ExchangeItem(ItemInventory fromIn, ItemInventory toIn, IInventoryUI fromUI, IInventoryUI toUI, ItemPosition ip, ItemPosition old, ISkillArgs args) { if (fromIn.CanExchange(old, ip) && fromIn.IsCanDrop(old, args)) { fromIn.ExchangeItemPosition(old, ip); HandleMoveAction(fromIn, toIn, fromUI, toUI, ip, args, true); HandleMoveAction(toIn, fromIn, toUI, fromUI, old, args, true); HandleMoveAction(fromIn, toIn, fromUI, toUI, ip, args, false); HandleMoveAction(toIn, fromIn, toUI, fromUI, old, args, false); if (fromIn == toIn) { fromUI.UpdateItem(args, fromIn, old); fromUI.UpdateItem(args, fromIn, ip); } else { fromUI.AddItem(args, fromIn, old); 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); } }