Example #1
0
        public bool Load(string text)
        {
            JsonData jsonData = JsonMapper.ToObject(text);

            for (int i = 0; i < jsonData.Count; i++)
            {
                JsonData  data          = jsonData[i];
                ItemTable TableInstance = new ItemTable();
                JsonData  tempID        = data["ID"];
                TableInstance.ID = int.Parse(tempID.ToString());
                JsonData tempName = data["Name"];
                TableInstance.Name = tempName.ToString();
                JsonData tempHeroShard = data["HeroShard"];
                TableInstance.HeroShard = int.Parse(tempHeroShard.ToString());
                JsonData tempNeedShardNum = data["NeedShardNum"];
                TableInstance.NeedShardNum = int.Parse(tempNeedShardNum.ToString());
                JsonData tempIcon = data["Icon"];
                TableInstance.Icon = int.Parse(tempIcon.ToString());
                JsonData tempDescription = data["Description"];
                TableInstance.Description = tempDescription.ToString();
                ////////////////////
                m_kDatas.Add(TableInstance);
                m_kMapDatas.Add(TableInstance.ID, TableInstance);
            }

            return(true);
        }
Example #2
0
        public ItemTable Get(int iID)
        {
            ItemTable rkRet = null;

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