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

        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.BackpackItemId = ms.ReadInt();
        proto.GoodsId        = ms.ReadInt();

        if (isChild)
        {
            GameEntry.Pool.EnqueueClassObject(ms);
        }
        return(proto);
    }
Exemple #2
0
    public static Goods_UseItemProto GetProto(byte[] buffer)
    {
        Goods_UseItemProto proto = new Goods_UseItemProto();

        using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer))
        {
            proto.BackpackItemId = ms.ReadInt();
            proto.GoodsId        = ms.ReadInt();
        }
        return(proto);
    }
    public static Goods_UseItemProto GetProto(MMO_MemoryStream ms, byte[] buffer)
    {
        Goods_UseItemProto proto = new Goods_UseItemProto();

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

        proto.BackpackItemId = ms.ReadInt();
        proto.GoodsId        = ms.ReadInt();

        return(proto);
    }