protected void SelectSlot(BaseItemSlot slot) { if (slot != null) { DeselectSlot(currentlySelectedSlot); currentlySelectedSlot = slot; slot.Select(); } }
protected virtual void OnPointerUp(BaseItemSlot slot, PointerEventData pointerData) { if (!enableOnPointerUp) { return; } DeselectSlot(currentlySelectedSlot); SelectSlot(slot); }
public void OnPointerDown(PointerEventData eventData) { BaseItemSlot slotUnderMouse = eventData.pointerCurrentRaycast.gameObject.GetComponent <BaseItemSlot>(); if (slotUnderMouse == null) { if (currentlySelectedSlot != null) { currentlySelectedSlot.Deselect(); } } }
protected virtual void OnDrag(BaseItemSlot slot, PointerEventData pointerData) { if (!enableOnDrag) { return; } if (pointerSlot != null) { pointerSlot.transform.position = Input.mousePosition; } }
protected virtual void OnPointerEnter(BaseItemSlot slot, PointerEventData pointerData) { if (!enableOnPointerEnter) { return; } if (toolTip != null && enableTooltip) { toolTip.UpdateToolTip(slot.ItemInSlot); } slot.SetHovered(); }
/// <summary> /// Updates the pointer item with the data from the slot passed in as a parameter. /// </summary> /// <param name="slot"></param> protected virtual void UpdatePointerItem(BaseItemSlot slot) { if (slot == null) { pointerSlot.ClearSlot(); TogglePointer(false); return; } if (slot.ContainsItem) { pointerSlot.UpdateSlot(slot.ItemInSlot); TogglePointer(true); } }
protected virtual void OnPointerExit(BaseItemSlot slot, PointerEventData pointerData) { if (!enableOnPointerExit) { return; } if (toolTip != null && enableTooltip) { toolTip.UpdateToolTip(null); } if (slot == currentlySelectedSlot) { SelectSlot(slot); return; } DeselectSlot(slot); }
protected virtual void OnPointerDown(BaseItemSlot slot, PointerEventData pointerData) { if (!enableOnPointerDown) { return; } if (!slot.ContainsItem) { return; } if (slot == null) { if (currentlySelectedSlot != null) { currentlySelectedSlot.Deselect(); } } SelectSlot(slot); }
protected virtual void SwapItemsInSlot(BaseItemSlot fromSlot, BaseItemSlot toSlot) { }
protected virtual void OnRightClick(BaseItemSlot slot, PointerEventData pointerData) { slot.OnSlotRightClicked(pointerData); }