Пример #1
0
    public void AddItem(int id)
    {
        for (int i = 0; i < m_CharBagData.ItemInfoList.Count; ++i)
        {
            if (m_CharBagData.ItemInfoList[i].ItemId == id)
            {
                return;
            }
        }
        var item = new NetWork.Auto.ItemInfo();

        item.ItemId = id;
        item.Count  = 1;
        m_CharBagData.ItemInfoList.Add(item);
        SaveData();
    }
Пример #2
0
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 10:
         if (field.Type == TType.I32) {
           CharId = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 20:
         if (field.Type == TType.List) {
           {
             ItemInfoList = new List<ItemInfo>();
             TList _list17 = iprot.ReadListBegin();
             for( int _i18 = 0; _i18 < _list17.Count; ++_i18)
             {
               ItemInfo _elem19 = new ItemInfo();
               _elem19 = new ItemInfo();
               _elem19.Read(iprot);
               ItemInfoList.Add(_elem19);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }