void StopDragging() { if (interactionObj.destination != null && interactionObj.destination.onDestination) { if (!interactionObj.destination.active && interactionObj.destination.pairObj.name.Equals(interactionObj.name)) { interactionObj.transform.position = interactionObj.destination.snapPosition; interactionObj.transform.rotation = interactionObj.destination.snapRot; dragger.StopDrag(interactionObj.rb); interactionObj.DragAction(); interactionObj.destination.WaitForCompletionStart(); interactionObj.destination = null; } else { dragger.StartPositionReset(interactionObj); } } else if (dragger.onSurface) { dragger.StopDrag(interactionObj.rb); } else if (!dragger.onSurface && !dragger.onDestination) { dragger.StartPositionReset(interactionObj); } isDragging = false; }
protected virtual void StopDrag() { if (DragController == null) { return; } DragController.StopDrag(); this.dragController = null; this.DataGrid.ReleaseMouseCapture(); }
private void Update() { // if (!splitController.splitInProgress && !itemActionsUI.dropInProgress) // { // if (itemActionsUI.menuActive) // { // if (Input.GetMouseButtonDown(0)) // { // if (!ItemActionsHit()) // { // itemActionsUI.Close(); // DeselectInventorySlot(); // } // } // // if (Input.GetMouseButtonDown(1)) // { // if (!ItemActionsHit()) // { // var slotHit = GetSlotHit(); // if (slotHit && slotHit.itemInside) // { // if (slotHit != selectedInventorySlot) // { // SelectInventorySlot(slotHit); // itemActionsUI.OpenActionsFor(slotHit); // } // } // else // { // itemActionsUI.Close(); // DeselectInventorySlot(); // } // } // } // } // else // { if (Input.GetMouseButtonDown(0)) { var slotHit = GetSlotHit(); if (slotHit && slotHit.itemInside) { SelectInventorySlot(slotHit); dragTime = Time.time + TIME_HOLD_TO_DRAG; } else { dragTime = float.MaxValue; } } else { if (Input.GetMouseButton(0)) { if (Time.time >= dragTime) { if (dragController.draggedInventorySlot) { dragController.OnDrag(); } else { // itemActionsUI.Close(); dragController.BeginDrag(selectedInventorySlot); } } } else if (Input.GetMouseButtonUp(0)) { if (dragController.draggedInventorySlot) { var newSlot = dragController.OnEndDrag(); if (newSlot) { SelectInventorySlot(newSlot); } } } } if (Input.GetMouseButtonDown(1)) { if (dragController.draggedInventorySlot) { dragController.StopDrag(); dragTime = float.MaxValue; } else { var slotHit = GetSlotHit(); if (slotHit && slotHit.itemInside) { SelectInventorySlot(slotHit); // itemActionsUI.OpenActionsFor(slotHit); } } } // } // } }