/// <summary> /// Changes the node's Parent. This will automatically handle moving the widget /// into the new space and handling references such as `.Parent` and children. /// </summary> public virtual CogaNode SetParent(CogaNode parent) { if (Parent != null) { Parent.Children.Remove(this); Parent.OnChildRemoved?.Invoke(Parent, this); Parent.SetChildrenDirty(); Parent.SetDirty(); OnActiveChange = null; } Parent = parent; Parent.OnActiveChange += (node) => { OnActiveChange?.Invoke(this); }; Parent.SetChildrenDirty(); if (!Parent.Children.Contains(this)) { Parent.Children.Add(this); } if (Parent.Manager != null) { PropagateManager(this, Parent.Manager); } return(this); }
public override void InitFinish() { TypeName.Color = Color.white; TypeDesc.Color = Color.white; NodeIDText.Color = Color.white; //TypeName.Font = EditorTreeConfigHelper.Instance.Config.NodeForm; TypeName.FontSize = EditorTreeConfigHelper.Instance.Config.FontSize; //TypeDesc.Font = EditorTreeConfigHelper.Instance.Config.NodeForm; TypeDesc.FontSize = EditorTreeConfigHelper.Instance.Config.FontSize; //NodeIDText.Font = EditorTreeConfigHelper.Instance.Config.NodeForm; NodeIDText.FontSize = EditorTreeConfigHelper.Instance.Config.FontSize; ShowCloseFlag.ContentColor = Color.white; ShowCloseFlag.TextFontStyle = FontStyle.Bold; ShowCloseFlag.ContentOffset = new Vector2(0, -3); LeafNode = BgImg.Bg; NoneLeaf = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Editor/Resources/NoneLeaf.png"); RootNode = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Editor/Resources/RootNode.png"); ShowCloseFlag.OnBtnClick = ChildrenShowTypeChange; OnActiveChange.Add((ee) => { if (_param != null) { _param.IsShow = Active; } }); }
//设置高亮的对象 public void SetActiveItem(AutoCompleteOption item) { this.ActiveValue = item?.Value; if (OnActiveChange.HasDelegate) { OnActiveChange.InvokeAsync(item); } StateHasChanged(); }
public CogaNode SetActive(bool active = true) { IsActive = active; SetDirty(); SetChildrenDirty(); // Turning inactive will stop a layout from being triggered, // so manually trigger it now for listeners that need to know its disabled. TriggerLayout(); OnActiveChange?.Invoke(this); return(this); }
public virtual void ActivationUpdate(ElementManagerLeaf elementManagerLeaf, bool isActive) { bool oldActive = Active; if (_activationExpression != null && _activationExpression.UsedIdentifiers.Contains(elementManagerLeaf.Identifier)) { Active = _activationExpression.Result; } if (oldActive != Active && OnActiveChange != null) { OnActiveChange.Invoke(Identifier, Active); } }
protected void InvokeActiveChange(string identifier, bool active) { OnActiveChange?.Invoke(identifier, active); }