コード例 #1
0
    //Protobuffer从MemoryStream进行反序列化
    public bool FromMemoryStream(MemoryStream protoMS)
    {
        ShopShopObjV1 pb = ProtoBuf.Serializer.Deserialize <ShopShopObjV1>(protoMS);

        FromPB(pb);
        return(true);
    }
コード例 #2
0
    //转化成Protobuffer类型函数
    public ShopShopObjV1 ToPB()
    {
        ShopShopObjV1 v = new ShopShopObjV1();

        v.ShopType = m_ShopType;
        for (int i = 0; i < (int)m_ItemArray.Count; i++)
        {
            v.ItemArray.Add(m_ItemArray[i].ToPB());
        }
        v.LastRefreshTime = m_LastRefreshTime;
        v.RefreshTimes    = m_RefreshTimes;

        return(v);
    }
コード例 #3
0
 //从Protobuffer类型初始化
 public void FromPB(ShopShopObjV1 v)
 {
     if (v == null)
     {
         return;
     }
     m_ShopType = v.ShopType;
     m_ItemArray.Clear();
     for (int i = 0; i < v.ItemArray.Count; i++)
     {
         m_ItemArray.Add(new ShopItemObjWraperV1());
     }
     for (int i = 0; i < v.ItemArray.Count; i++)
     {
         m_ItemArray[i].FromPB(v.ItemArray[i]);
     }
     m_LastRefreshTime = v.LastRefreshTime;
     m_RefreshTimes    = v.RefreshTimes;
 }