Example #1
0
    public static Goods_SellToSysProto GetProto(byte[] buffer, bool isChild = false)
    {
        Goods_SellToSysProto proto = new Goods_SellToSysProto();

        MMO_MemoryStream ms = null;

        if (!isChild)
        {
            ms = GameEntry.Socket.SocketSendMS;
        }
        else
        {
            ms = GameEntry.Pool.DequeueClassObject <MMO_MemoryStream>();
        }
        ms.SetLength(0);
        ms.Write(buffer, 0, buffer.Length);
        ms.Position = 0;

        proto.roleBackpackId = ms.ReadInt();
        proto.GoodsType      = (byte)ms.ReadByte();
        proto.GoodsId        = ms.ReadInt();
        proto.GoodsServerId  = ms.ReadInt();
        proto.SellCount      = ms.ReadInt();

        if (isChild)
        {
            GameEntry.Pool.EnqueueClassObject(ms);
        }
        return(proto);
    }
    public static Goods_SellToSysProto GetProto(byte[] buffer)
    {
        Goods_SellToSysProto proto = new Goods_SellToSysProto();

        using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer))
        {
            proto.roleBackpackId = ms.ReadInt();
            proto.GoodsType      = (byte)ms.ReadByte();
            proto.GoodsId        = ms.ReadInt();
            proto.GoodsServerId  = ms.ReadInt();
            proto.SellCount      = ms.ReadInt();
        }
        return(proto);
    }
    public static Goods_SellToSysProto GetProto(MMO_MemoryStream ms, byte[] buffer)
    {
        Goods_SellToSysProto proto = new Goods_SellToSysProto();

        ms.SetLength(0);
        ms.Write(buffer, 0, buffer.Length);
        ms.Position = 0;

        proto.roleBackpackId = ms.ReadInt();
        proto.GoodsType      = (byte)ms.ReadByte();
        proto.GoodsId        = ms.ReadInt();
        proto.GoodsServerId  = ms.ReadInt();
        proto.SellCount      = ms.ReadInt();

        return(proto);
    }