Fix inventory slot switch rubberbanding

This commit is contained in:
excitedneon 2017-05-17 01:44:28 +03:00
parent db475d8461
commit e2efe3a298
2 changed files with 4 additions and 2 deletions

View File

@ -182,11 +182,11 @@ namespace Cyber.Controls {
// Grab was released, drop item here
// Lerp things
ItemGridCellMeshes[GrabbedItemIndex].transform.position = ItemGridCells[CurrentIndex].position;
ItemGridCellMeshes[CurrentIndex].transform.position = ItemGridCells[GrabbedItemIndex].position;
Lerper.LerpTransformPosition(ItemGridCellMeshes[GrabbedItemIndex].transform, new Vector3(), 10f);
Lerper.LerpTransformPosition(ItemGridCellMeshes[CurrentIndex].transform, new Vector3(), 10f);
// Switch items
Inventory.Drive.SwitchSlots(GrabbedItemIndex, CurrentIndex);
Client.Send(PktType.InventoryAction, Inventory.ActionHandler.BuildSlotSwitch(GrabbedItemIndex, CurrentIndex));
// Reset grabbing

View File

@ -81,7 +81,9 @@ namespace Cyber.Items {
}
return false;
case InventoryAction.Switch:
Inventory.Drive.SwitchSlots(intList[0], intList[1]);
if (!Client.IsRunning() || Client.GetConnectedPlayer().Character != Character) {
Inventory.Drive.SwitchSlots(intList[0], intList[1]);
}
return true;
}
return false;