/// <summary> /// 递归遍历子目录 /// </summary> /// <param name="nodeInfor"></param> /// <returns></returns> protected bool GetSubTreeNodeItemIsSelected(BaseTreeNodeInfor nodeInfor) { if (nodeInfor.IsTreeNode) { return((nodeInfor as BuildAssetBundleTreeNode).m_IsSelected); } bool isHasItemSelected = false; foreach (var item in nodeInfor.m_AllSubNodesInfor) { if (item.IsTreeNode) { if ((item as BuildAssetBundleTreeNode).m_IsSelected) { isHasItemSelected = true; } } else { bool isSubINodeItemSelected = false; foreach (var subItem in item.m_AllSubNodesInfor) { isSubINodeItemSelected = GetSubTreeNodeItemIsSelected(subItem); if (isSubINodeItemSelected) { isHasItemSelected = true; return(isHasItemSelected); } }//递归遍历子目录 } } return(isHasItemSelected); }
protected void SetSubTreeNodeIsSelectedState(BaseTreeNodeInfor target, bool isselected) { if (target.IsTreeNode) { (target as BuildAssetBundleTreeNode).m_IsSelected = isselected; return; } foreach (var item in target.m_AllSubNodesInfor) { if (item.IsTreeNode) { (item as BuildAssetBundleTreeNode).m_IsSelected = isselected; } else { foreach (var subItem in item.m_AllSubNodesInfor) { SetSubTreeNodeIsSelectedState(subItem, isselected); } } } (target as BuildAssetBundleTreeNode).m_IsSelected = isselected; }