public void SetVisable(bool visable) { m_sortButtons.SetActive(visable); m_filter.SetActive(visable); m_status = visable; SetSelectedCondition(visable); if (!visable) { m_curSortClassType = ENSortClassType.enCSItem; } }
public void SortCards(ENSortType sortType, bool reverse, ENSortClassType classType) { if (sortType == ENSortType.enDefault) { sortType = ENSortType.enGotTime; } SortDelegate sortFunc = GetSortFunc((ENSortType)sortType); if (sortFunc != null) { m_lastSortType = sortType; m_lastDirReverse = reverse; m_sortedCardList = sortFunc(sortType, reverse); CardBag.Singleton.NotifySortResult(); } //SetVisable(false); }
public List <SortableItem> SortByList(ENSortType sortType, ENSortClassType classType, bool reverse, List <SortableItem> sortList) { List <float> tempTeam = new List <float>(); Dictionary <float, List <CSItem> > dicTeam = new Dictionary <float, List <CSItem> >(); Dictionary <float, List <SortableItem> > dic = new Dictionary <float, List <SortableItem> >(); List <float> tmpKeyList = new List <float>(); foreach (SortableItem item in sortList) { float propVal = 0f; switch (classType) { case ENSortClassType.enCSItem: CSItem itemData = (CSItem)item; propVal = GetSortValue(itemData, sortType, out dicTeam, out tempTeam); break; case ENSortClassType.enFriend: FriendItem tmpFriendItem = (FriendItem)item; propVal = GetSortValue(tmpFriendItem, sortType, out dicTeam, out tempTeam); break; default: UnityEngine.Debug.Log("SortByProperty err, type = " + sortType); return(null); } if (dic.ContainsKey(propVal)) { dic[propVal].Add(item); } else { List <SortableItem> tmpItemList = new List <SortableItem>(); tmpItemList.Add(item); dic.Add(propVal, tmpItemList); tmpKeyList.Add(propVal); } } tmpKeyList.Sort(); tempTeam.Reverse(); if (!reverse) { tempTeam.Reverse(); tmpKeyList.Reverse(); } List <SortableItem> resultList = new List <SortableItem>(); resultList.Clear(); foreach (float propVal in tempTeam) { dicTeam[propVal].Sort(new ItemGotTimeCompare()); foreach (CSItem item in dicTeam[propVal]) { resultList.Add(item); } } foreach (float propVal in tmpKeyList) { if (dic.ContainsKey(propVal)) { if (ENSortClassType.enCSItem == classType) { dic[propVal].Sort(new ItemGotTimeCompareMy()); } foreach (SortableItem item in dic[propVal]) { resultList.Add(item); } } } // //全部统计好了,将ID返回出去 // List<CSItemGuid> guidList = new List<CSItemGuid>(); // guidList.Add(User.Singleton.RepresentativeCard); // // foreach (CSItem item in resultList) // { // guidList.Add(item.Guid); // } return(resultList); // List<int> tmp = new List<int>(); // return tmp; }