Пример #1
0
        public static void Sort(ConceptCardListSortWindow.Type sort_type, ConceptCardListSortWindow.Type sort_order_type, List <ConceptCardData> card_list)
        {
            List <ConceptCardListSortWindow.SortData> sortDataList = new List <ConceptCardListSortWindow.SortData>();

            for (int index = 0; index < card_list.Count; ++index)
            {
                ConceptCardData card = card_list[index];
                if (card != null)
                {
                    sortDataList.Add(new ConceptCardListSortWindow.SortData(card, card.GetSortData(sort_type)));
                }
            }
            sortDataList.Sort((Comparison <ConceptCardListSortWindow.SortData>)((x, y) =>
            {
                if (x.sort_val != y.sort_val)
                {
                    return(x.sort_val.CompareTo(y.sort_val));
                }
                if (x.data.Param.type != y.data.Param.type)
                {
                    return(y.data.Param.type.CompareTo((object)x.data.Param.type));
                }
                if (x.data.Param.iname != y.data.Param.iname)
                {
                    return(x.data.Param.iname.CompareTo(y.data.Param.iname));
                }
                if ((int)x.data.Lv != (int)y.data.Lv)
                {
                    return((int)x.data.Lv.CompareTo((int)y.data.Lv));
                }
                if ((int)x.data.Exp != (int)y.data.Exp)
                {
                    return((int)x.data.Exp.CompareTo((int)y.data.Exp));
                }
                if ((long)x.data.UniqueID != (long)y.data.UniqueID)
                {
                    return((long)x.data.UniqueID.CompareTo((long)y.data.UniqueID));
                }
                return(0);
            }));
            card_list.Clear();
            for (int index = 0; index < sortDataList.Count; ++index)
            {
                ConceptCardListSortWindow.SortData sortData = sortDataList[index];
                card_list.Add(sortData.data);
            }
            if (sort_order_type != ConceptCardListSortWindow.Type.DESCENDING)
            {
                return;
            }
            card_list.Reverse();
        }