public void AddChild(FNode node) { int nodeIndex = _childNodes.IndexOf(node); if (nodeIndex == -1) //add it if it's not a child { node.HandleAddedToContainer(this); _childNodes.Add(node); if (_isOnStage) { node.stage = _stage; node.HandleAddedToStage(); } } else if (nodeIndex != _childNodes.Count - 1) //if node is already a child, put it at the top of the children if it's not already { _childNodes.RemoveAt(nodeIndex); _childNodes.Add(node); if (_isOnStage) { _stage.HandleFacetsChanged(); } } }
public void AddChildAtIndex(FNode node, int newIndex) { int nodeIndex = _childNodes.IndexOf(node); if (newIndex > _childNodes.Count) //if it's past the end, make it at the end { newIndex = _childNodes.Count; } if (nodeIndex == newIndex) { return; //if it's already at the right index, just leave it there } if (nodeIndex == -1) //add it if it's not a child { node.HandleAddedToContainer(this); _childNodes.Insert(newIndex, node); if (_isOnStage) { node.stage = _stage; node.HandleAddedToStage(); } } else //if node is already a child, move it to the desired index { _childNodes.RemoveAt(nodeIndex); if (nodeIndex < newIndex) { _childNodes.Insert(newIndex - 1, node); //gotta subtract 1 to account for it moving in the order } else { _childNodes.Insert(newIndex, node); } if (_isOnStage) { _stage.HandleFacetsChanged(); } } }
override public void HandleAddedToStage() { if (!_isOnStage) { base.HandleAddedToStage(); int childCount = _childNodes.Count; for (int c = 0; c < childCount; c++) { FNode childNode = _childNodes[c]; childNode.stage = _stage; childNode.HandleAddedToStage(); } if (_shouldSortByZ) { Futile.instance.SignalAfterUpdate += HandleUpdateAndSort; } } }
public void AddChild(FNode node) { int nodeIndex = _childNodes.IndexOf(node); if(nodeIndex == -1) //add it if it's not a child { node.HandleAddedToContainer(this); _childNodes.Add(node); if(_isOnStage) { node.HandleAddedToStage(); } } else if(nodeIndex != _childNodes.Count-1) //if node is already a child, put it at the top of the children if it's not already { _childNodes.RemoveAt(nodeIndex); _childNodes.Add(node); if(_isOnStage) _stage.HandleQuadsChanged(); } }
public void AddChildAtIndex(FNode node, int newIndex) { int nodeIndex = _childNodes.IndexOf(node); if(newIndex > _childNodes.Count) //if it's past the end, make it at the end { newIndex = _childNodes.Count; } if(nodeIndex == newIndex) return; //if it's already at the right index, just leave it there if(nodeIndex == -1) //add it if it's not a child { node.HandleAddedToContainer(this); _childNodes.Insert(newIndex, node); if(_isOnStage) { node.HandleAddedToStage(); } } else //if node is already a child, move it to the desired index { _childNodes.RemoveAt(nodeIndex); if(nodeIndex < newIndex) { _childNodes.Insert(newIndex-1, node); //gotta subtract 1 to account for it moving in the order } else { _childNodes.Insert(newIndex, node); } if(_isOnStage) _stage.HandleQuadsChanged(); } }
//添加至Stage override public void HandleAddedToStage() { //检测重复执行标志位 if (!_isOnStage) { base.HandleAddedToStage(); //遍历子节点添加至Stage int childCount = _childNodes.Count; for (int c = 0; c < childCount; c++) { FNode childNode = _childNodes[c]; childNode.stage = _stage; childNode.HandleAddedToStage(); } //检测是否需要每帧排序 if (_shouldSortByZ) { Futile.instance.SignalUpdate += HandleUpdateAndSort; } } }