protected override void SetActionHead(NetWriter writer) { MessagePack headPack = new MessagePack() { MsgId = Head.MsgId, ActionId = ActionId, SessionId = Head.SessionId, UserId = Head.UserId }; byte[] data = ProtoBufUtils.Serialize(headPack); writer.SetHeadBuffer(data); writer.SetBodyData(null); }
public byte[] BuildHearbeatPackage() { var writer = NetWriter.Instance; MessagePack headPack = new MessagePack() { 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; }