本文整理汇总了C#中FairyGUI.GObject.InternalSetParent方法的典型用法代码示例。如果您正苦于以下问题:C# GObject.InternalSetParent方法的具体用法?C# GObject.InternalSetParent怎么用?C# GObject.InternalSetParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FairyGUI.GObject
的用法示例。
在下文中一共展示了GObject.InternalSetParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddChildAt
/// <summary>
/// Adds a child to the component at a certain index.
/// </summary>
/// <param name="child">A child object</param>
/// <param name="index">Index</param>
/// <returns>GObject</returns>
public virtual GObject AddChildAt(GObject child, int index)
{
int numChildren = _children.Count;
if (index >= 0 && index <= numChildren)
{
if (child.parent == this)
{
SetChildIndex(child, index);
}
else
{
child.RemoveFromParent();
child.InternalSetParent(this);
int cnt = _children.Count;
if (child.sortingOrder != 0)
{
_sortingChildCount++;
index = GetInsertPosForSortingChild(child);
}
else if (_sortingChildCount > 0)
{
if (index > (cnt - _sortingChildCount))
index = cnt - _sortingChildCount;
}
if (index == cnt)
_children.Add(child);
else
_children.Insert(index, child);
ChildStateChanged(child);
SetBoundsChangedFlag();
}
return child;
}
else
{
throw new Exception("Invalid child index: " + index + ">" + numChildren);
}
}