/// <summary>
 /// Writes an enumerable of RoomInfo objects to an outgoing message
 /// </summary>
 /// <param name="outgoingMessage">The message</param>
 /// <param name="enumerable">The enumerable to write</param>
 internal static void Write(this OutgoingMessage outgoingMessage, IEnumerable <RoomInfo> enumerable)
 {
     if (enumerable == null)
     {
         outgoingMessage.Write(0);
     }
     else
     {
         outgoingMessage.Write(enumerable.Count());
         foreach (var obj in enumerable)
         {
             obj.WriteToMessage(outgoingMessage);
         }
     }
 }
        /// <summary>
        /// Writes an array of strings to an outgoing message
        /// </summary>
        /// <param name="outgoingMessage">The message</param>
        /// <param name="enumerable">The enumerable to write</param>
        internal static void Write(this OutgoingMessage outgoingMessage, IEnumerable <string> enumerable)
        {
            if (enumerable == null)
            {
                outgoingMessage.Write(0);
            }
            else
            {
                outgoingMessage.Write(enumerable.Count());

                foreach (var str in enumerable)
                {
                    outgoingMessage.Write(str);
                }
            }
        }
 public override void WriteSyncData(OutgoingMessage writer)
 {
     this.lastPosition = this.transform.Position;
     writer.Write(this.lastPosition.X);
     writer.Write(this.lastPosition.Y);
 }
Esempio n. 4
0
 /// <summary>
 /// Writes the serialized entity.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="offlineEntity">The offline entity.</param>
 private void WriteEntity(OutgoingMessage message, Entity offlineEntity)
 {
     using (var stream = new MemoryStream())
     {
         this.serializer.Serialize(stream, offlineEntity);
         var data = new byte[stream.Length];
         stream.Seek(0, SeekOrigin.Begin);
         stream.Read(data, 0, data.Length);
         message.Write(data);
     }
 }
 /// <summary>
 /// Writes a <see cref="EnterRoomResultCodes"/> type to an outgoing message
 /// </summary>
 /// <param name="outgoingMessage">The message</param>
 /// <param name="messageType">The <see cref="EnterRoomResultCodes"/> type to write</param>
 internal static void Write(this OutgoingMessage outgoingMessage, EnterRoomResultCodes messageType)
 {
     outgoingMessage.Write((byte)messageType);
 }
 /// <summary>
 /// Writes a <see cref="ServerIncomingMessageTypes"/> type to an outgoing message
 /// </summary>
 /// <param name="outgoingMessage">The message</param>
 /// <param name="messageType">The <see cref="ServerIncomingMessageTypes"/> type to write</param>
 internal static void Write(this OutgoingMessage outgoingMessage, ServerIncomingMessageTypes messageType)
 {
     outgoingMessage.Write((byte)messageType);
 }
Esempio n. 7
0
 /// <summary>
 /// Writes this instance fields to an outgoing message.
 /// </summary>
 /// <param name="outgoingMessage">The outgoing message</param>
 public void Write(OutgoingMessage outgoingMessage)
 {
     outgoingMessage.Write(this.IsAbsolute);
     outgoingMessage.Write(this.IncludedRooms);
     outgoingMessage.Write(this.RemovedRooms);
 }