コード例 #1
0
ファイル: HeroV1DataWraper.cs プロジェクト: qipa/RpcCoder
    //Protobuffer从MemoryStream进行反序列化
    public bool FromMemoryStream(MemoryStream protoMS)
    {
        HeroHeroDataV1 pb = ProtoBuf.Serializer.Deserialize <HeroHeroDataV1>(protoMS);

        FromPB(pb);
        return(true);
    }
コード例 #2
0
ファイル: HeroV1DataWraper.cs プロジェクト: qipa/RpcCoder
 //从Protobuffer类型初始化
 public void FromPB(HeroHeroDataV1 v)
 {
     if (v == null)
     {
         return;
     }
     m_Lv        = v.Lv;
     m_Exp       = v.Exp;
     m_StarStage = v.StarStage;
     m_StarLv    = v.StarLv;
     m_HerdId    = v.HerdId;
     m_StoneArr.Clear();
     for (int i = 0; i < v.StoneArr.Count; i++)
     {
         m_StoneArr.Add(new HeroStoneInfoWraperV1());
     }
     for (int i = 0; i < v.StoneArr.Count; i++)
     {
         m_StoneArr[i].FromPB(v.StoneArr[i]);
     }
     m_DestinyLv = v.DestinyLv;
     m_SkillData.Clear();
     for (int i = 0; i < v.SkillData.Count; i++)
     {
         m_SkillData.Add(new HeroSkillObjWraperV1());
     }
     for (int i = 0; i < v.SkillData.Count; i++)
     {
         m_SkillData[i].FromPB(v.SkillData[i]);
     }
     m_Attrs.Clear();
     for (int i = 0; i < v.Attrs.Count; i++)
     {
         m_Attrs.Add(v.Attrs[i]);
     }
     m_Military = v.Military;
     m_StrAttr  = v.StrAttr;
     m_DexAttr  = v.DexAttr;
     m_IntAttr  = v.IntAttr;
     m_PercentAttrs.Clear();
     for (int i = 0; i < v.PercentAttrs.Count; i++)
     {
         m_PercentAttrs.Add(v.PercentAttrs[i]);
     }
     m_SkillMilitary = v.SkillMilitary;
     m_SpecialAttr.Clear();
     for (int i = 0; i < v.SpecialAttr.Count; i++)
     {
         m_SpecialAttr.Add(new HeroAttrObjWraperV1());
     }
     for (int i = 0; i < v.SpecialAttr.Count; i++)
     {
         m_SpecialAttr[i].FromPB(v.SpecialAttr[i]);
     }
     m_ExtraMilitary = v.ExtraMilitary;
 }
コード例 #3
0
ファイル: HeroV1DataWraper.cs プロジェクト: qipa/RpcCoder
    //转化成Protobuffer类型函数
    public HeroHeroDataV1 ToPB()
    {
        HeroHeroDataV1 v = new HeroHeroDataV1();

        v.Lv        = m_Lv;
        v.Exp       = m_Exp;
        v.StarStage = m_StarStage;
        v.StarLv    = m_StarLv;
        v.HerdId    = m_HerdId;
        for (int i = 0; i < (int)m_StoneArr.Count; i++)
        {
            v.StoneArr.Add(m_StoneArr[i].ToPB());
        }
        v.DestinyLv = m_DestinyLv;
        for (int i = 0; i < (int)m_SkillData.Count; i++)
        {
            v.SkillData.Add(m_SkillData[i].ToPB());
        }
        for (int i = 0; i < (int)m_Attrs.Count; i++)
        {
            v.Attrs.Add(m_Attrs[i]);
        }
        v.Military = m_Military;
        v.StrAttr  = m_StrAttr;
        v.DexAttr  = m_DexAttr;
        v.IntAttr  = m_IntAttr;
        for (int i = 0; i < (int)m_PercentAttrs.Count; i++)
        {
            v.PercentAttrs.Add(m_PercentAttrs[i]);
        }
        v.SkillMilitary = m_SkillMilitary;
        for (int i = 0; i < (int)m_SpecialAttr.Count; i++)
        {
            v.SpecialAttr.Add(m_SpecialAttr[i].ToPB());
        }
        v.ExtraMilitary = m_ExtraMilitary;

        return(v);
    }