// sorting 버튼 누를때 반응 매서드 public void ResponseButton_sorting(int sortType) { FRIENDSORTING_TYPE _sortType = (FRIENDSORTING_TYPE)sortType; if (nowSortType != _sortType) { nowSortType = _sortType; Sort_Friends(lst_friendEle, nowSortType); } }
void Sort_Friends(List <UIItem_FriendElement> lst_orinFriend, FRIENDSORTING_TYPE sortType) { List <UIItem_FriendElement> _lst_Orinsort = new List <UIItem_FriendElement>(); _lst_Orinsort = lst_orinFriend; List <UIItem_FriendElement> _lst_newsort = null; if (sortType == FRIENDSORTING_TYPE.ADD) // 추가순 { var sortName = from fri in _lst_Orinsort orderby fri.userFriend.FrIdx descending select fri; _lst_newsort = sortName.ToList(); } else if (sortType == FRIENDSORTING_TYPE.NAME) //이름순 { var sortName = from fri in _lst_Orinsort orderby fri.userFriend.NkNm descending select fri; _lst_newsort = sortName.ToList(); } else if (sortType == FRIENDSORTING_TYPE.LOGIN) // 로그인순 { var sortName = from fri in _lst_Orinsort orderby fri.userFriend.mtime orderby fri.IsLogining select fri; _lst_newsort = sortName.ToList(); } else if (sortType == FRIENDSORTING_TYPE.LOGINTIME) // 로그인순 { var sortName = from fri in _lst_Orinsort orderby fri.userFriend.mtime select fri; _lst_newsort = sortName.ToList(); } for (int i = 0; i < _lst_newsort.Count; i++) { if (sortType == FRIENDSORTING_TYPE.LOGIN) { _lst_newsort[i].transform.SetAsFirstSibling(); } else { // 정렬을위해 하이라키 순서 마지막으로 보내기 _lst_newsort[i].transform.SetAsLastSibling(); } } }