您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

63 行
1.5 KiB

using System.Collections.Generic;
using System.Linq;
namespace UnityEngine.Experimental.Rendering.UI
{
public class DebugUIHandlerContainer : MonoBehaviour
{
[SerializeField]
public RectTransform contentHolder;
internal DebugUIHandlerWidget GetFirstItem()
{
if (contentHolder.childCount == 0)
return null;
var items = GetActiveChildren();
if (items.Count == 0)
return null;
return items[0];
}
internal DebugUIHandlerWidget GetLastItem()
{
if (contentHolder.childCount == 0)
return null;
var items = GetActiveChildren();
if (items.Count == 0)
return null;
return items[items.Count - 1];
}
internal bool IsDirectChild(DebugUIHandlerWidget widget)
{
if (contentHolder.childCount == 0)
return false;
return GetActiveChildren()
.Count(x => x == widget) > 0;
}
List<DebugUIHandlerWidget> GetActiveChildren()
{
var list = new List<DebugUIHandlerWidget>();
foreach (Transform t in contentHolder)
{
if (!t.gameObject.activeInHierarchy)
continue;
var c = t.GetComponent<DebugUIHandlerWidget>();
if (c != null)
list.Add(c);
}
return list;
}
}
}