public void getParentList(List <SceneProcedure> parentList) { // 由于父节点列表中需要包含自己,所以先加入自己 parentList.Add(this); // 再加入父节点的所有父节点 mParentProcedure?.getParentList(parentList); }
// 获得自己和otherProcedure的共同的父节点 public SceneProcedure getSameParent(SceneProcedure otherProcedure) { // 获得两个流程的父节点列表 LIST(out List <SceneProcedure> tempList0); LIST(out List <SceneProcedure> tempList1); getParentList(tempList0); otherProcedure.getParentList(tempList1); // 从前往后判断,找到第一个相同的父节点 int count0 = tempList0.Count; for (int i = 0; i < count0; ++i) { var thisParent = tempList0[i]; int count1 = tempList1.Count; for (int j = 0; j < count1; ++j) { if (thisParent == tempList1[j]) { UN_LIST(tempList0); UN_LIST(tempList1); return(thisParent); } } } UN_LIST(tempList0); UN_LIST(tempList1); return(null); }
// 获得自己和otherProcedure的共同的父节点 public SceneProcedure getSameParent(SceneProcedure otherProcedure) { // 获得两个流程的父节点列表 List <SceneProcedure> tempList0 = mListPool.newList(out tempList0); List <SceneProcedure> tempList1 = mListPool.newList(out tempList1); getParentList(ref tempList0); otherProcedure.getParentList(ref tempList1); // 从前往后判断,找到第一个相同的父节点 foreach (var thisParent in tempList0) { foreach (var otherParent in tempList1) { if (thisParent == otherParent) { mListPool.destroyList(tempList0); mListPool.destroyList(tempList1); return(thisParent); } } } mListPool.destroyList(tempList0); mListPool.destroyList(tempList1); return(null); }
public void getParentList(ref List <SceneProcedure> parentList) { // 由于父节点列表中需要包含自己,所以先加入自己 parentList.Add(this); // 再加入父节点的所有父节点 if (mParentProcedure != null) { mParentProcedure.getParentList(ref parentList); } }
// 获得自己和otherProcedure的共同的父节点 public SceneProcedure getSameParent(SceneProcedure otherProcedure) { // 获得两个流程的父节点列表 List <SceneProcedure> thisParentList = new List <SceneProcedure>(); List <SceneProcedure> otherParentList = new List <SceneProcedure>(); getParentList(ref thisParentList); otherProcedure.getParentList(ref otherParentList); // 从前往后判断,找到第一个相同的父节点 foreach (var thisParent in thisParentList) { foreach (var otherParent in otherParentList) { if (thisParent == otherParent) { return(thisParent); } } } return(null); }