Пример #1
0
        public bool Load(string text)
        {
            JsonData jsonData = JsonMapper.ToObject(text);

            for (int i = 0; i < jsonData.Count; i++)
            {
                JsonData       data          = jsonData[i];
                RankLevelTable TableInstance = new RankLevelTable();
                JsonData       tempID        = data["ID"];
                TableInstance.ID = int.Parse(tempID.ToString());
                JsonData tempRankLevel = data["RankLevel"];
                TableInstance.RankLevel = int.Parse(tempRankLevel.ToString());
                JsonData tempCups = data["Cups"];
                TableInstance.Cups = int.Parse(tempCups.ToString());
                JsonData tempIcon = data["Icon"];
                TableInstance.Icon = int.Parse(tempIcon.ToString());
                JsonData tempReward1 = data["Reward1"];
                TableInstance.Reward1 = new List <int>();
                for (int j = 0; j < tempReward1.Count; j++)
                {
                    string v = tempReward1[j].ToString();
                    if (v == "")
                    {
                        continue;
                    }
                    TableInstance.Reward1.Add(int.Parse(v));
                }
                ////////////////////
                m_kDatas.Add(TableInstance);
                m_kMapDatas.Add(TableInstance.ID, TableInstance);
            }

            return(true);
        }
Пример #2
0
        public RankLevelTable Get(int iID)
        {
            RankLevelTable rkRet = null;

            if (!m_kMapDatas.TryGetValue(iID, out rkRet))
            {
                return(null);
            }
            return(rkRet);
        }