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