Beispiel #1
0
        protected NetOutgoingMessage GetOutgoingMessage(int messageType, object message)
        {
            // create message
            var outgoingMessage = this.NetPeer.CreateMessage();

            // record sent time
            //messageWrapper.SentNetTime = NetTime.Now;

            // write the message type
            outgoingMessage.Write(messageType);

            // get bytes
            var messageBytes = ProtocolBufferSerializer.Serialize(message);

            // write our package to the message
            outgoingMessage.Write(messageBytes);

            return(outgoingMessage);
        }
 public T As <T>()
 {
     return(ProtocolBufferSerializer.Deserialize <T>(this.Data));
 }