Exemplo n.º 1
0
        internal void UpdateElo(UserInfo user)
        {
            GowStarInfo starInfo = new GowStarInfo();

            starInfo.m_Guid                     = user.Guid;
            starInfo.m_GowElo                   = user.GowInfo.GowElo;
            starInfo.m_Nick                     = user.Nickname;
            starInfo.m_HeroId                   = user.HeroId;
            starInfo.m_Level                    = user.Level;
            starInfo.m_FightingScore            = user.FightingScore;
            starInfo.m_RankId                   = user.GowInfo.RankId;
            starInfo.m_Point                    = user.GowInfo.Point;
            starInfo.m_CriticalTotalMatches     = user.GowInfo.CriticalTotalMatches;
            starInfo.m_CriticalAmassWinMatches  = user.GowInfo.AmassWinMatches;
            starInfo.m_CriticalAmassLossMatches = user.GowInfo.AmassLossMatches;

            InsertGowStar(starInfo);
        }
Exemplo n.º 2
0
        private void InsertGowStar(GowStarInfo gsi)
        {
            if (gsi == null || gsi.m_RankId <= 0)
            {
                return;
            }
            GowStarInfo starInfo = m_GowStars.Find(info => info.m_Guid == gsi.m_Guid);

            if (null != starInfo)
            {
                m_GowStars.Remove(starInfo);
            }
            starInfo = gsi;
            int ct = m_GowStars.Count;

            if (ct <= 0)
            {
                m_GowStars.Add(starInfo);
            }
            else
            {
                int min = 0;
                int max = ct - 1;
                while (min <= max)
                {
                    int         i    = (min + max) / 2;
                    GowStarInfo info = m_GowStars[i];
                    if (info.m_RankId <= starInfo.m_RankId &&
                        info.m_Level < starInfo.m_Level)
                    {
                        max = i - 1;
                    }
                    else
                    {
                        min = i + 1;
                    }
                }
                m_GowStars.Insert(min, starInfo);
            }
            while (m_GowStars.Count > c_MaxGowStarNum)
            {
                m_GowStars.RemoveAt(c_MaxGowStarNum);
            }
        }