示例#1
0
        private void UpdateRankDataSuccess(object obj)
        {
            m2c_getranklistbyuidbtid data = (m2c_getranklistbyuidbtid)obj;

            GameEntry.GameData.RankDatas = data.RankDatas;
            fsnKey++;
            RefreshFSN();
        }
示例#2
0
        public void MsgAnalysis(JsonData res, Action <object> action)
        {
            m2c_getranklistbyuidbtid m2c = new m2c_getranklistbyuidbtid();

            m2c.resultCode = res["respVo"]["resultCode"].ToString();
            m2c.resultDesc = res["respVo"]["resultDesc"].ToString();

            if (m2c.resultCode == "0")
            {
                m2c.RankDatas = new List <RankData>();

                //for (int i = 0; i < res["roleinfomap"][0]["rolepropertymap"]["rolepromap"].Count; i++)
                for (int i = 0; i < res["currentMap"].Count; i++)
                {
                    RankData   rankData   = new RankData();
                    rolepromap rm         = new rolepromap();
                    JsonData   currentMap = res["currentMap"][i];

                    rankData.name   = currentMap["nickname"].ToString();
                    rankData.score  = int.Parse(currentMap["score"].ToString());
                    rankData.timeId = int.Parse(currentMap["id"].ToString());
                    m2c.RankDatas.Add(rankData);
                }
                m2c.RankDatas.Sort(delegate(RankData x, RankData y)
                {
                    int a = y.score.CompareTo(x.score);
                    if (x.score == y.score)
                    {
                        a = x.timeId.CompareTo(y.timeId);
                    }

                    return(a);
                });
                for (int m = 0; m < m2c.RankDatas.Count; m++)
                {
                    m2c.RankDatas[m].rank = m;
                }
            }

            if (action != null)
            {
                action(m2c);
            }
        }