Ejemplo n.º 1
0
    /// <summary>
    /// 802
    /// </summary>
    private static void Recv_ItemGetResponse(object Info)
    {
        if (Info == null)
        {
            return;
        }
        item.ItemInfoResponse response = Info as item.ItemInfoResponse;

        foreach (item.ItemInfo itemInfo in response.item_infos)
        {
            int action = itemInfo.action;
            int id     = itemInfo.id;
            //添加
            if (action == 0)   //新增
            {
                if (m_lItem.ContainsKey(id) == true)
                {
                    ItemTypeInfo I = m_lItem[id];
                    ItemM.UpdateItemInfo(itemInfo, ref I);
                }
                else
                {
                    ItemTypeInfo I = ItemM.GetItemInfo(itemInfo);
                    if (I != null)
                    {
                        m_lItem.Add(id, I);
                    }
                }
            }
            //update
            else if (action == 1)
            {
                if (m_lItem.ContainsKey(id) == true)
                {
                    ItemTypeInfo I = m_lItem[id];
                    ItemM.UpdateItemInfo(itemInfo, ref I);
                }
            }
            else     //删除
            {
                if (m_lItem.ContainsKey(id) == true)
                {
                    m_lItem.Remove(id);
                }
            }
        }
    }