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()); }; }
/// <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; }
private void OnClick() { if (expanded) { animator.Play("Collapse"); } else { animator.Play("Expand"); OnExpand?.Invoke(); } expanded = !expanded; }
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); }
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); }
private void OnExpandTapped(object sender, EventArgs e) { GoToState("Expanded"); OnExpand?.Invoke(); }
public void Expand() { OnExpand.Invoke(); IsExpanded = true; }
/// <summary> /// Expand panel content /// </summary> protected void Expand() { OnExpand?.Invoke(this, EventArgs.Empty); _collapsingDivider?.OnExpand(); }
private void OnExpandTapped(object sender, EventArgs args) { ToggleState("Expanded"); OnExpand?.Invoke(); }