Example #1
0
 //从Protobuffer类型初始化
 public void FromPB(BagTalismanObjV1 v)
 {
     if (v == null)
     {
         return;
     }
     m_ItemID     = v.ItemID;
     m_TemplateId = v.TemplateId;
     m_CurExp     = v.CurExp;
     m_EquipScore = v.EquipScore;
     m_StarLevel  = v.StarLevel;
     m_GatherSpriteSlot.Clear();
     for (int i = 0; i < v.GatherSpriteSlot.Count; i++)
     {
         m_GatherSpriteSlot.Add(new BagSlotInfoWraperV1());
     }
     for (int i = 0; i < v.GatherSpriteSlot.Count; i++)
     {
         m_GatherSpriteSlot[i].FromPB(v.GatherSpriteSlot[i]);
     }
     m_TailsManLevel = v.TailsManLevel;
     m_TalismanAttr.Clear();
     for (int i = 0; i < v.TalismanAttr.Count; i++)
     {
         m_TalismanAttr.Add(v.TalismanAttr[i]);
     }
 }
Example #2
0
    //Protobuffer从MemoryStream进行反序列化
    public bool FromMemoryStream(MemoryStream protoMS)
    {
        BagTalismanObjV1 pb = ProtoBuf.Serializer.Deserialize <BagTalismanObjV1>(protoMS);

        FromPB(pb);
        return(true);
    }
Example #3
0
    //转化成Protobuffer类型函数
    public BagTalismanObjV1 ToPB()
    {
        BagTalismanObjV1 v = new BagTalismanObjV1();

        v.ItemID     = m_ItemID;
        v.TemplateId = m_TemplateId;
        v.CurExp     = m_CurExp;
        v.EquipScore = m_EquipScore;
        v.StarLevel  = m_StarLevel;
        for (int i = 0; i < (int)m_GatherSpriteSlot.Count; i++)
        {
            v.GatherSpriteSlot.Add(m_GatherSpriteSlot[i].ToPB());
        }
        v.TailsManLevel = m_TailsManLevel;
        for (int i = 0; i < (int)m_TalismanAttr.Count; i++)
        {
            v.TalismanAttr.Add(m_TalismanAttr[i]);
        }

        return(v);
    }