Ejemplo n.º 1
0
    public List <DailyTestInfo> GetDailyTestInfoList()
    {
        m_lstDailyTestInfo.Clear();

        //有多个推荐  选取经验倍数最大的推荐
        uint tempId             = 0;
        uint tempExpMultiple    = 0;
        uint tempRecommendCount = 0;

        List <DailyTestDataBase> m_lstDailyTestDb = GameTableManager.Instance.GetTableList <DailyTestDataBase>();

        for (int i = 0; i < m_lstDailyTestDb.Count; i++)
        {
            DailyTestInfo dailyTestInfo = new DailyTestInfo();
            dailyTestInfo.id          = m_lstDailyTestDb[i].dwID;
            dailyTestInfo.name        = m_lstDailyTestDb[i].strName;
            dailyTestInfo.expMultiple = m_lstDailyTestDb[i].expMultiple;
            dailyTestInfo.lvMin       = m_lstDailyTestDb[i].monsterLvMin;
            dailyTestInfo.lvMax       = m_lstDailyTestDb[i].monsterLvMax;
            dailyTestInfo.bgId        = m_lstDailyTestDb[i].BgTextureId;

            bool bIsRecommend = IsRecommend(m_lstDailyTestDb[i].monsterLvMin, m_lstDailyTestDb[i].monsterLvMax);
            dailyTestInfo.isRecommend = bIsRecommend;
            if (true == bIsRecommend)
            {
                if (tempExpMultiple < m_lstDailyTestDb[i].expMultiple)
                {
                    tempId          = m_lstDailyTestDb[i].dwID;
                    tempExpMultiple = m_lstDailyTestDb[i].expMultiple;
                }

                tempRecommendCount++;
            }

            m_lstDailyTestInfo.Add(dailyTestInfo);
        }

        //有多个推荐  选取经验倍数最大的推荐
        if (tempRecommendCount >= 2)
        {
            for (int i = 0; i < m_lstDailyTestInfo.Count; i++)
            {
                if (tempId == m_lstDailyTestInfo[i].id)
                {
                    m_lstDailyTestInfo[i].isRecommend = true;
                }
                else
                {
                    m_lstDailyTestInfo[i].isRecommend = false;
                }
            }
        }

        m_lstDailyTestInfo.Sort(new DailyTestCompare <DailyTestInfo>());

        return(m_lstDailyTestInfo);
    }
Ejemplo n.º 2
0
    public int Compare(T x, T y)
    {
        DailyTestInfo left  = x as DailyTestInfo;
        DailyTestInfo right = y as DailyTestInfo;

        if (left != null && right != null)
        {
            if (left.isRecommend == true || right.isRecommend == true)
            {
                return(right.isRecommend == true ? 1 : -1);
            }
            else if (left.id != right.id)
            {
                return((int)left.id - (int)right.id);
            }
            return(0);
        }

        return(0);
    }