//interface of IPointerDownHandler
 public void OnPointerDown(PointerEventData data)
 {
     if (data.button == PointerEventData.InputButton.Left)
     {
         if (clickManager.DoubleClick())
         {
             GetComponent <ItemHandleOnGUI>().DoubleClick();
         }
         ///https://docs.unity3d.com/ScriptReference/RectTransformUtility.ScreenPointToLocalPointInRectangle.html
         //RectTransformUtility.ScreenPointToLocalPointInRectangle(itemObjRectTransform, data.position, data.pressEventCamera, out pointerOffset);
         oldSlot = transform.parent.gameObject;
     }
     if (UpdateInventoryList != null)
     {
         UpdateInventoryList();
     }
 }
Exemplo n.º 2
0
    //Picke Upable Object. When we double click on the object in the scene.
    private void OnMouseDown()
    {
        if (!clickManager.DoubleClick())
        {
            return;
        }

        if (!isInit)
        {
            FetchItemInfo();
        }

        //Find Player and Players inventory
        TargetLE    lplayer   = FindObjectOfType <TargetLE>();
        LEInventory inventory = lplayer.transform.GetComponentInChildren <LEInventory>();

        inventory.AddItem(item);
        transform.parent.parent = inventory.transform;
        transform.parent.gameObject.SetActive(false);
        CursorManager.GetInstance().setMouse();
    }