Esempio n. 1
0
        /// <summary>
        /// 对列表进行排序(注:对传入的list进行排序)
        /// </summary>
        /// <param name="infoList">要排序的列表</param>
        /// <param name="line">根据第几行的信息进行排序</param>
        void SortList(List <UserMatchInfo> infoList, int line)
        {
            //将列表按当前行手牌进行从小到大排列
            infoList.Sort((info1, info2) =>
            {
                if (info1.DunTypeList[line] != info2.DunTypeList[line])
                {
                    return(info1.DunTypeList[line] - info2.DunTypeList[line]);
                }
                else
                {
                    int beginIndex = 0;
                    int count      = 0;
                    switch (line)
                    {
                    case 0:
                        beginIndex = 0;
                        count      = 3;
                        break;

                    case 1:
                        beginIndex = 3;
                        count      = 5;
                        break;

                    case 2:
                        beginIndex = 8;
                        count      = 5;
                        break;
                    }

                    List <int> list1 = info1.Cards.GetRange(beginIndex, count);
                    List <int> list2 = info2.Cards.GetRange(beginIndex, count);
                    SortList(list1);
                    SortList(list2);

                    Help1.VnList vn1 = new Help1.VnList(list1);
                    Help1.VnList vn2 = new Help1.VnList(list2);
                    return(vn1.CompareLine(vn2));
                }
            });
        }
Esempio n. 2
0
        /// <summary>
        /// 小于0,倒水
        /// </summary>
        /// <param name="list1"></param>
        /// <param name="line1"></param>
        /// <param name="list2"></param>
        /// <param name="line2"></param>
        /// <returns></returns>
        int MatchListType(List <int> list1, int line1, List <int> list2, int line2)
        {
            Help1.VnList vnList1 = new Help1.VnList(list1);
            Help1.VnList vnList2 = new Help1.VnList(list2);
            CardType     type1   = CheckCardType(list1, line1);
            CardType     type2   = CheckCardType(list2, line2);

            YxDebug.Log(string.Format(" === 第{0}行牌型为{1} , 第{2}行牌型为{3} === ", line1, type1, line2, type2));

            int result = (int)type1 - (int)type2;

            if (result == 0)
            {
                for (int i = 0; i < vnList2.Count; i++)
                {
                    if (vnList1[i].Val != vnList2[i].Val)
                    {
                        return(vnList1[i].Val.CompareTo(vnList2[i].Val));
                    }
                }
            }
            return(result);
        }