Exemplo n.º 1
0
    protected override void SetActionHead(NetWriter writer)
    {
        //todo 启用自定的结构;
        CTSPackageHead headPack = new CTSPackageHead()
        {
            MsgId     = Head.MsgId,
            ActionId  = ActionId,
            SessionId = Head.SessionId,
            UserId    = Head.UserId
        };

        byte[] data = ProtoBufUtils.Serialize(headPack);
        writer.SetHeadBuffer(data);
        writer.SetBodyData(null);

        //base.SetActionHead(writer);
    }
Exemplo n.º 2
0
    public byte[] BuildHearbeatPackage()
    {
        var            writer   = NetWriter.Instance;
        CTSPackageHead headPack = new CTSPackageHead()
        {
            MsgId     = NetWriter.MsgId,
            ActionId  = 1,
            SessionId = NetWriter.SessionID,
            UserId    = (int)NetWriter.UserID
        };

        byte[] headBytes = ProtoBufUtils.Serialize(headPack);
        writer.SetHeadBuffer(headBytes);
        writer.SetBodyData(new byte[0]);
        var data = writer.PostData();

        NetWriter.resetData();
        return(data);
    }