void CAS_List_Init() { int allStep = 0; //共groupCount,group是他们的下标,正好从0开始 for (int group = 0; group < groupCount; group++) { //这个地方是否消耗会很大,能否优化 //获取第group组有多少个运动的物体(目标和本体) List <Transform> groupTarTrans = U_Transform.GetAddedStrTrans(transform, brother[group], mark, markDigit, false, group); List <Transform> groupOriTrans = U_Transform.GetAddedStrTrans(transform, brother[group], mark, markDigit, true, group); List <C_AssembleOBJ> tempASList = new List <C_AssembleOBJ>(); oriTrans_AllStep.AddRange(groupOriTrans); tarTrans_AllStep.AddRange(groupTarTrans); eachGroupCount.Add(groupTarTrans.Count); //每一组中的step步。 for (int step = 0; step < groupTarTrans.Count; step++) { //Debug.Log("allStep "+allStep+" ori 【"+oriTrans_AllStep[allStep].name+"】 tar 【" + tarTrans_AllStep[allStep].name + "】"); C_AssembleOBJ tempCAS = oriTrans_AllStep[allStep].GetComponent <C_AssembleOBJ>(); tempCAS.SetAssemble(tarTrans_AllStep[allStep], group, groupTarTrans.Count); tempASList.Add(tempCAS); allStep += 1; } tarGroupList.Add(groupTarTrans); oriGroupList.Add(groupOriTrans); casGroupList.Add(tempASList); } allStepCount = oriTrans_AllStep.Count; }
public void GetBrother() { if (null == brother) { brother = U_Transform.GetCtrlD(transform); } }
public void ToUntagged() { //foreach(Transform tran in U_Transform.GetChildren(transform, true)) foreach (Transform tran in U_Transform.GetChildren(transform, true)) { tran.tag = "Untagged"; } }
//基础初始化,例如兄弟个数等等 void Base_Init() { RemoveData(); brother = U_Transform.GetBrotherS(transform, false); groupCount = brother.Count; oriTrans_Obj = U_Transform.GetAddedStrTrans(transform, brother[brother.Count - 1], mark, markDigit, true); assembles_Obj = AddComponentCAS(oriTrans_Obj); }
public void ToPlane() { //foreach(Transform tran in U_Transform.GetChildren(transform, true)) foreach (Transform tran in U_Transform.GetChildren(transform, true)) { tran.tag = "plane"; } }
void SetOriPosition() { if (oriPosList.Count != 0) { oriPosList.Clear(); } oriPosList = U_Transform.GetChildrenLocalPostion(transform); }
void SetTarPosition() { if (tarPosList.Count != 0) { tarPosList.Clear(); } tarPosList = U_Transform.GetChildrenLocalPostion(transform); }
public void ChangeChildrenTag() { //foreach(Transform tran in U_Transform.GetChildren(transform, true)) foreach (Transform tran in U_Transform.GetChildren(transform, true)) { tran.tag = tarTag; } }
public void Remove() { foreach (GridLayoutGroup grid in gridLayoutS) { U_Transform.DestroyImmediateAllSon(grid.transform); } U_Transform.DestroyImmediateAllSon(posModelParent); objS.Clear(); }
public void Update() { //isFather,解除其所有子物体 U_Bool.BoolTrueMethord (removerChildren, ref isSonFlag, () => U_Transform.RemoveChildren(transform)); U_Bool.BoolTrueMethord (setParent, ref isFatherFlag, () => U_Transform.SetParent(transform, parent)); }
public void ToEquip() { int i = 0; foreach (Transform tran in U_Transform.GetChildren(transform, true)) { i++; tran.tag = "equip"; } Debug.Log(i + " 个物体改tag为【equip】"); }
public void DebugSameNameButton() { list.Clear(); btnNameS.Clear(); list = U_FindAll.GetAllT <Button>(); int i = 0; foreach (var item in list) { if (!btnNameS.Contains(item.name)) { btnNameS.Add(item.name); } else { i++; Debug.Log(item.name + " " + U_Transform.GetHierarchyPathName(item.transform)); } } Debug.Log("共有 " + i + " 个重名的Button"); }
//获取组件 public static List <T> GetTComponent <T>(Transform tran, WE_TransformRange transformRange = WE_TransformRange.Self) { List <T> tC = new List <T>(); switch (transformRange) { case WE_TransformRange.Self: tC.Add(tran.GetComponent <T>()); break; case WE_TransformRange.SelfSon: GetTC_FromTransforms <T>(U_Transform.GetSonS(tran, true)); break; case WE_TransformRange.SelfChildren: tC = GetTC_FromTransforms <T>(U_Transform.GetChildren(tran, true)); break; case WE_TransformRange.SelfBrother: tC = GetTC_FromTransforms <T>(U_Transform.GetBrotherS(tran, true)); break; case WE_TransformRange.Son: tC = GetTC_FromTransforms <T>(U_Transform.GetSonS(tran, false)); break; case WE_TransformRange.Children: GetTC_FromTransforms <T>(U_Transform.GetChildren(tran, false)); break; case WE_TransformRange.Brother: tC = GetTC_FromTransforms <T>(U_Transform.GetBrotherS(tran, false)); break; } return(tC); }
/// <summary> /// 获取当前物体所在的画布 /// </summary> /// <param name="rect"></param> /// <returns></returns> public static Transform GetCanvas(Transform rect) { if (rect.root.GetComponent <Canvas>() != null) { return(rect.root); } Canvas[] canvaS = rect.root.GetComponentsInChildren <Canvas>(true); if (canvaS.Length == 1) { return(canvaS[0].transform); } else { foreach (Canvas can in canvaS) { if (U_Transform.IsContainChildren(can.transform.GetChildren(), rect)) { return(can.transform); } } return(null); } }
public static List <Transform> GetBrotherS(this Transform transform, bool isContainSelf = false) { return(U_Transform.GetBrotherS(transform, isContainSelf)); }
public static List <Transform> GetSameNameBrotherS(this Transform transform, bool sameName = true, bool isContainSelf = true) { return(U_Transform.GetSameNameBrotherS(transform, sameName, isContainSelf)); }
public static Transform GetSon(this Transform transform, string sonName, bool justContain = true) { return(U_Transform.GetSon(transform, sonName, justContain)); }
void GetChildrenName() { childrenNames = U_Transform.GetChildrenName(transform); }
void GetChildren() { children = U_Transform.GetChildren(transform); }
public static Transform GetChild(this Transform transform, string childName, bool justContain = true) { return(U_Transform.GetChild(transform, childName, justContain)); }
public static Transform GetBrother(this Transform transform, string brotherName, bool justContain = true) { return(U_Transform.GetBrother(transform, brotherName, justContain)); }
private void Awake() { sonS = transform.GetSonS(false); sonGoS = U_Transform.TranS_To_GameObjectS(sonS); StartCoroutine(ActiveOneByOne(sonGoS, 1, 0, true)); }
public void ClearAll() { stopList.Clear(); pointS.Clear(); U_Transform.DestroyImmediateAllSon(transform); }