Example #1
0
    /// <summary>
    /// A method for handling the start of drag events.
    /// </summary>
    public void OnBeginDrag()
    {
        beingDragged = true;

        if (anchor == UIAnchors.Bottom || anchor == UIAnchors.Top)
        {
            dragOffsetX = Input.mousePosition.x - buttonTransform.anchoredPosition.x;
            dragOffsetY = Input.mousePosition.y - buttonTransform.anchoredPosition.y;
        }
        else if (anchor == UIAnchors.Right || anchor == UIAnchors.Left)
        {
            dragOffsetX = Help.BlankButtonRect.rect.width / 2;
            dragOffsetY = Help.BlankButtonRect.rect.height / 2;
        }

        Help.BlankButton.transform.SetParent(parentObject.transform, false);
        Help.BlankButton.SetActive(true);

        if (menuScript != null)
        {
            menuScript.HideMenu();
        }
    }