/// <summary>
    /// Stop Drag when the screen block is clicked in dragging mode.
    /// </summary>
    /// <param name="eventData"></param>
    private void OnScreenBlockClicked(PointerEventData eventData)
    {
        StopDrag();

        List <RaycastResult> results = new List <RaycastResult>();

        EventSystem.current.RaycastAll(eventData, results);

        DropMe dropMe = null;

        foreach (var result in results)
        {
            dropMe = result.gameObject.GetComponent <DropMe>();
            if (dropMe != null)
            {
                break;
            }
        }

        if (dropMe != null && dropMe.AllowDropped(this))
        {
            // Allow to be dropped: place the item to the new parent
            transform.SetParent(dropMe.transform);

            actionDragFinished.RaiseEvent(true);
        }
        else
        {
            // Don't allow to be dropped: place the item to the parent before
            transform.SetParent(parentBeforeDrag);

            actionDragFinished.RaiseEvent(false);
        }
    }
Exemple #2
0
 public void OnHintButtonClicked()
 {
     actionHintClicked.RaiseEvent();
 }
 public void OnPointerClick(PointerEventData eventData)
 {
     actionBlockClicked.RaiseEvent(eventData);
 }