Beispiel #1
0
 public int GetScore(RES_STAR_CONDITION_DATA_SUB_TYPE inDataSubType)
 {
     if (inDataSubType == 1)
     {
         return(this.HeadPoints);
     }
     if (inDataSubType == 2)
     {
         return(this.campScore);
     }
     return(-1);
 }
        public void GetCampsByScoreRank(RES_STAR_CONDITION_DATA_SUB_TYPE inDataSubType, out List <COM_PLAYERCAMP> result, out List <int> resultScore)
        {
            result      = new List <COM_PLAYERCAMP>();
            resultScore = new List <int>();
            Dictionary <uint, int> dictionary = new Dictionary <uint, int>();

            DictionaryView <uint, CampInfo> .Enumerator enumerator = this.campStat.GetEnumerator();
            while (enumerator.MoveNext())
            {
                KeyValuePair <uint, CampInfo> current = enumerator.Current;
                CampInfo info = current.Value;
                if (info != null)
                {
                    KeyValuePair <uint, CampInfo> pair2 = enumerator.Current;
                    uint key   = pair2.Key;
                    int  score = info.GetScore(inDataSubType);
                    if (score >= 0)
                    {
                        dictionary.Add(key, score);
                    }
                }
            }
            Dictionary <uint, int> .Enumerator enumerator2 = dictionary.GetEnumerator();
            while (enumerator2.MoveNext())
            {
                KeyValuePair <uint, int> pair3 = enumerator2.Current;
                COM_PLAYERCAMP           item  = pair3.Key;
                KeyValuePair <uint, int> pair4 = enumerator2.Current;
                int  num3  = pair4.Value;
                bool flag  = false;
                int  count = result.Count;
                for (int i = 0; i < count; i++)
                {
                    if (resultScore[i] < num3)
                    {
                        result.Insert(i, item);
                        resultScore.Insert(i, num3);
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    result.Add(item);
                    resultScore.Add(num3);
                }
            }
            DebugHelper.Assert(resultScore.Count == result.Count);
        }
        public void GetCampsByScoreRank(RES_STAR_CONDITION_DATA_SUB_TYPE inDataSubType, out List <COM_PLAYERCAMP> result, out List <int> resultScore)
        {
            result      = new List <COM_PLAYERCAMP>();
            resultScore = new List <int>();
            Dictionary <uint, int> dictionary = new Dictionary <uint, int>();

            DictionaryView <uint, CampInfo> .Enumerator enumerator = this.campStat.GetEnumerator();
            while (enumerator.MoveNext())
            {
                KeyValuePair <uint, CampInfo> current = enumerator.Current;
                CampInfo value = current.get_Value();
                if (value != null)
                {
                    KeyValuePair <uint, CampInfo> current2 = enumerator.Current;
                    uint key   = current2.get_Key();
                    int  score = value.GetScore(inDataSubType);
                    if (score >= 0)
                    {
                        dictionary.Add(key, score);
                    }
                }
            }
            Dictionary <uint, int> .Enumerator enumerator2 = dictionary.GetEnumerator();
            while (enumerator2.MoveNext())
            {
                KeyValuePair <uint, int> current3 = enumerator2.get_Current();
                COM_PLAYERCAMP           key2     = (COM_PLAYERCAMP)current3.get_Key();
                KeyValuePair <uint, int> current4 = enumerator2.get_Current();
                int  value2 = current4.get_Value();
                bool flag   = false;
                int  count  = result.get_Count();
                for (int i = 0; i < count; i++)
                {
                    if (resultScore.get_Item(i) < value2)
                    {
                        result.Insert(i, key2);
                        resultScore.Insert(i, value2);
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    result.Add(key2);
                    resultScore.Add(value2);
                }
            }
            DebugHelper.Assert(resultScore.get_Count() == result.get_Count());
        }
        public uint GetScoreRank(COM_PLAYERCAMP inCampType, RES_STAR_CONDITION_DATA_SUB_TYPE inDataSubType)
        {
            List <COM_PLAYERCAMP> result      = null;
            List <int>            resultScore = null;

            this.GetCampsByScoreRank(inDataSubType, out result, out resultScore);
            HashSet <int> set = new HashSet <int>();

            if ((result != null) && (result.Count > 0))
            {
                int index = result.IndexOf(inCampType);
                if (index >= 0)
                {
                    for (int i = 0; i <= index; i++)
                    {
                        set.Add(resultScore[i]);
                    }
                }
            }
            return((uint)set.Count);
        }
        public uint GetScoreRank(COM_PLAYERCAMP inCampType, RES_STAR_CONDITION_DATA_SUB_TYPE inDataSubType)
        {
            List <COM_PLAYERCAMP> list  = null;
            List <int>            list2 = null;

            this.GetCampsByScoreRank(inDataSubType, out list, out list2);
            HashSet <int> hashSet = new HashSet <int>();

            if (list != null && list.get_Count() > 0)
            {
                int num = list.IndexOf(inCampType);
                if (num >= 0)
                {
                    for (int i = 0; i <= num; i++)
                    {
                        hashSet.Add(list2.get_Item(i));
                    }
                }
            }
            return((uint)hashSet.get_Count());
        }