Ejemplo n.º 1
0
 public TreeViewController(MultiselectTreeView treeView)
 {
     this.treeView          = treeView;
     treeView.BeforeExpand += (s, e) =>
     {
         if (updating)
         {
             return;
         }
         e.Cancel = true;
         OnExpand?.Invoke(Map(e.Node));
     };
     treeView.BeforeCollapse += (s, e) =>
     {
         if (updating)
         {
             return;
         }
         e.Cancel = true;
         OnCollapse?.Invoke(Map(e.Node));
     };
     treeView.BeforeMultiSelect += (s, e) =>
     {
         if (updating)
         {
             return;
         }
         e.Cancel = true;
         OnSelect?.Invoke(e.Nodes.OfType <ViewNode>().Select(n => n.Node).ToArray());
     };
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Expands the pool by creating another object and adding it to the end
        /// </summary>
        /// <returns>Reference to the object that was created</returns>
        private void ExpandPool()
        {
            GameObject newGameobject = Object.Instantiate(Template);
            T          newPoolable   = newGameobject.GetComponent <T>();

            // Poolable Objects need a reference to the object pool irrelevant of type
            // this interface defines the return method
            newPoolable.ParentPool = this;

            newGameobject.transform.SetParent(PoolParent, false);

            if (AllowStartOnExpandedObjects)
            {
                DelayedAction.AfterFrame(() => newPoolable.InUse = false);
            }
            else
            {
                newPoolable.InUse = false;
            }

            Available.Push(newPoolable);
            Pool.Add(newPoolable);
            newPoolable.PoolExpanded();
            OnExpand?.Invoke(newPoolable);
        }
 /// <summary>
 /// Expand panel content
 /// </summary>
 protected void Expand()
 {
     if (OnExpand != null)
     {
         OnExpand.Invoke(this, EventArgs.Empty);
     }
     _animationState = AnimationState.Expanding;
     StartAnimation();
     _collapsingDivider.OnExpand();
     secondaryPanel.TabStop = true;
 }
Ejemplo n.º 4
0
        private void OnClick()
        {
            if (expanded)
            {
                animator.Play("Collapse");
            }
            else
            {
                animator.Play("Expand");
                OnExpand?.Invoke();
            }

            expanded = !expanded;
        }
Ejemplo n.º 5
0
    public void SetExpanded(bool expanded, bool force)
    {
        _expanded = expanded;
        var padding = LayoutGroup.padding;

        padding             = new RectOffset(padding.left, padding.right, padding.top, _expanded ? ExpandedPadding : FoldedPadding);
        LayoutGroup.padding = padding;
        foreach (var property in Properties)
        {
            property.SetActive(_expanded);
        }
        _targetFoldoutRotation = _expanded ? -90 : 0;
        if (force)
        {
            _foldoutRotation = _targetFoldoutRotation;
            FoldoutIcon.transform.localRotation = Quaternion.Euler(0, 0, _foldoutRotation);
        }
        OnExpand?.Invoke(_expanded);
    }
Ejemplo n.º 6
0
        protected virtual T ExpandPool()
        {
            var newItem = Instantiate();

            OnExpand?.Invoke(this, newItem);
            // If the new object wants to be able to return itself, give it a callback
            if (newItem is IPoolReturnable returnable)
            {
                returnable.PoolReturn = () => Return(newItem);
            }

            // Notify the object it has been returned to the pool
            try {
                if (newItem is IPoolNotifiable notifiable)
                {
                    notifiable.PoolInUse(false);
                }
                if (newItem is IPoolNotifiablePost notifiablePost)
                {
                    notifiablePost.PoolInUsePost(false);
                }
            } catch (Exception ex) {
                if (newItem is Object unityItem)
                {
                    Debug.LogError(ex, unityItem);
                }
                else
                {
                    Debug.LogError(ex);
                }
            }

            Available.Push(newItem);
            Pool.Add(newItem);
            return(newItem);
        }
Ejemplo n.º 7
0
 private void OnExpandTapped(object sender, EventArgs e)
 {
     GoToState("Expanded");
     OnExpand?.Invoke();
 }
Ejemplo n.º 8
0
 public void Expand()
 {
     OnExpand.Invoke();
     IsExpanded = true;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Expand panel content
 /// </summary>
 protected void Expand()
 {
     OnExpand?.Invoke(this, EventArgs.Empty);
     _collapsingDivider?.OnExpand();
 }
Ejemplo n.º 10
0
 private void OnExpandTapped(object sender, EventArgs args)
 {
     ToggleState("Expanded");
     OnExpand?.Invoke();
 }