Ejemplo n.º 1
0
    void Start()
    {
        _parent = GetComponentInParent <SlidingPanelsGroup>();
        primary.bookmark.onClick     += () => _parent.OpenOneCloseRest(this);
        primary.bookmark.onBeginDrag += () =>
        {
            if (!primary.IsOpen)
            {
                _parent.OpenOneCloseRest(this);
            }
        };

        GameManager.OnNextFrame += () =>
        {
            var ind    = transform.GetSiblingIndex();
            var offset = SlidingPanelBookmark.GetHeightPositionByIndex(ind, transform);
            primary.bookmark.transform.position   = new Vector3(primary.bookmark.transform.position.x, offset);
            secondary.bookmark.transform.position = new Vector3(secondary.bookmark.transform.position.x, offset);
        };

        if (open)
        {
            primary.Open();
            secondary.Open();
        }
        else
        {
            primary.Close();
            secondary.Close();
        }
    }
Ejemplo n.º 2
0
    void Reposition()
    {
        transform.SetAsFirstSibling();
        var ind = Roots.Count;

        _position = ind;
        var offset = SlidingPanelBookmark.GetHeightPositionByIndex(ind, transform);

        transform.position = new Vector3(transform.position.x, offset);
    }