Ejemplo n.º 1
0
    public void OnDrop(PointerEventData eventData)
    {
        Debug.Log("OnDrop to " + gameObject.name);
        draggable d = eventData.pointerDrag.GetComponent <draggable>();

        if (d != null)
        {
            d.parentToReturnTo = this.transform;
        }
    }
Ejemplo n.º 2
0
    public void OnDrop(PointerEventData eventData)
    {
        Debug.Log(eventData.pointerDrag.name + " was dropped on " + gameObject.name);

        draggable d = eventData.pointerDrag.GetComponent <draggable> ();

        if (d != null)
        {
            d.oringalParent        = this.transform;
            d.transform.localScale = this.transform.localScale;
        }
    }
Ejemplo n.º 3
0
    public void OnPointerExit(PointerEventData eventData)
    {
        if (eventData.pointerDrag == null)
        {
            return;
        }

        draggable d = eventData.pointerDrag.GetComponent <draggable>();

        if (d != null && d.placeholderParent == this.transform)
        {
            d.placeholderParent = d.parentToReturnTo;
        }
    }
Ejemplo n.º 4
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        if (eventData.pointerDrag == null)
        {
            return;
        }

        draggable d = eventData.pointerDrag.GetComponent <draggable> ();

        if (d != null)            // && (typeOfItem == d.typeOfItem || typeOfItem==draggable.Slot.INVENTORY )
        {
            d.placeholderParent = this.transform;
        }
    }
Ejemplo n.º 5
0
    public void OnDrop(PointerEventData eventData)
    {
        draggable d = eventData.pointerDrag.GetComponent <draggable>();

        if (d != null)
        {
            if (typeOfItem == d.typeOfItem)
            {
                //d.parentToReturnTo = this.transform;
                d.newObj.AddComponent <draggable>();
                d.newObj.transform.SetParent(this.transform, false);
            }
        }
    }
Ejemplo n.º 6
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        //Debug.Log("OnPointerEnter");
        if (eventData.pointerDrag == null)
        {
            return;
        }

        draggable d = eventData.pointerDrag.GetComponent <draggable>();

        if (d != null)
        {
            d.placeholderParent = this.transform;
        }
    }
Ejemplo n.º 7
0
    public void OnDrop(PointerEventData eventData)
    {
        //OnDrop cmd triggers before the OnEndDrag does
        //Debug.Log("OnDrop to " + gameObject.name);
        Debug.Log(eventData.pointerDrag.name + " was dropped " + gameObject.name);

        draggable d = eventData.pointerDrag.GetComponent <draggable>();

        if (d != null)
        {
            //if(typeOfItem == d.typeOfItem  || typeOfItem == draggable.Slot.INVENTORY)
            //{
            d.parentToReturnTo = this.transform;
            //}
        }
    }
Ejemplo n.º 8
0
    //public draggable.Slot typeOfItem = draggable.Slot.INVENTORY;

    public void OnDrop(PointerEventData eventData)
    {
        //Debug.Log (eventData.pointerDrag + " OnDrop to " + gameObject.name);
        draggable d = eventData.pointerDrag.GetComponent <draggable> ();

        if (d != null && d.tag == gameObject.tag)            // && (typeOfItem == d.typeOfItem || typeOfItem==draggable.Slot.INVENTORY )
        {
            d.parentToReturnTo = this.transform;
            if (gameObject.name == "DropZone")
            {
                d.changeSlot(draggable.Slot.REST);
                Image img = d.GetComponent <Image> ();
                img.color = Color.red;
                GameController gamer = gc.GetComponent <GameController>();
                gamer.DisabledZaphires(eventData.pointerDrag);
            }
        }
    }