public void Init() { casSS = U_List.NewListOfList <C_CascadeMenu>(9); casAll = transform.GetComponentsInChildren <C_CascadeMenu>(true); foreach (C_CascadeMenu cas in casAll) { switch (cas.level) { case 1: casSS[0].Add(cas); break; case 2: casSS[1].Add(cas); break; case 3: casSS[2].Add(cas); break; case 4: casSS[3].Add(cas); break; case 5: casSS[4].Add(cas); break; case 6: casSS[5].Add(cas); break; case 7: casSS[6].Add(cas); break; case 8: casSS[6].Add(cas); break; case 9: casSS[6].Add(cas); break; } } }
/// <summary> /// 将一个字符串数组根据i分类,按类别分组 /// </summary> /// <param name="length"></param> /// <param name="ori"></param> /// <returns></returns> public static List <List <string> > StrSTo_Type_List(int length, string[] ori) { List <List <string> > strSList = U_List.NewListOfList <string>(length); for (int i = 0; i < ori.Length; i++) { int yushu = i % length; strSList[yushu].Add(ori[i]); } return(strSList); }
/// <summary> /// 将一个字符串数组根据i分类,按物体分组 /// </summary> /// <param name="length"></param> /// <param name="ori"></param> /// <returns></returns> public static List <List <string> > StrSTo_Group_List(int length, string[] ori) { int strlenth = ori.Length / length; List <List <string> > strSList = U_List.NewListOfList <string>(strlenth); int bigIndex = -1; for (int i = 0; i < ori.Length; i++) { if (i % length == 0) { bigIndex += 1; } strSList[bigIndex].Add(ori[i]); } return(strSList); }