2017-05-08 00:59:50 +02:00
|
|
|
|
using UnityEngine.Networking;
|
|
|
|
|
|
2017-05-08 21:11:05 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generic Text Message for chat etc.
|
|
|
|
|
/// To be removed later when no longer necessary.
|
|
|
|
|
/// </summary>
|
2017-05-08 00:59:50 +02:00
|
|
|
|
public class TextMessage : MessageBase {
|
|
|
|
|
|
2017-05-08 21:11:05 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Message inside the Text Message. Does not container sender information.
|
|
|
|
|
/// </summary>
|
2017-05-08 02:59:42 +02:00
|
|
|
|
public string Message;
|
2017-05-08 00:59:50 +02:00
|
|
|
|
|
2017-05-08 21:11:05 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Create a TextMessage containing the message to be sent.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="message"></param>
|
2017-05-08 00:59:50 +02:00
|
|
|
|
public TextMessage(string message) {
|
2017-05-08 02:59:42 +02:00
|
|
|
|
this.Message = message;
|
2017-05-08 00:59:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-08 21:11:05 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Parameter-less constructor using when deserializing the message.
|
|
|
|
|
/// </summary>
|
2017-05-08 00:59:50 +02:00
|
|
|
|
public TextMessage() {
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-08 21:11:05 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used to deserialize a message received via networking.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="reader"></param>
|
2017-05-08 00:59:50 +02:00
|
|
|
|
public override void Deserialize(NetworkReader reader) {
|
2017-05-08 02:59:42 +02:00
|
|
|
|
Message = reader.ReadString();
|
2017-05-08 00:59:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-08 21:11:05 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used to serialize the message before it is sent.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="writer"></param>
|
2017-05-08 00:59:50 +02:00
|
|
|
|
public override void Serialize(NetworkWriter writer) {
|
2017-05-08 02:59:42 +02:00
|
|
|
|
writer.Write(Message);
|
2017-05-08 00:59:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|