2020-08-13 19:46:16 +00:00
|
|
|
|
using QSB.Messaging;
|
2020-12-16 09:08:38 +00:00
|
|
|
|
using QuantumUNET.Transport;
|
2020-02-14 21:14:24 +00:00
|
|
|
|
|
2021-12-23 21:57:33 +00:00
|
|
|
|
namespace QSB.TimeSync.Messages
|
2020-02-15 19:48:02 +00:00
|
|
|
|
{
|
2021-12-23 05:06:58 +00:00
|
|
|
|
public class ServerTimeMessage : QSBMessage
|
2020-12-02 21:23:01 +00:00
|
|
|
|
{
|
2021-12-23 05:06:58 +00:00
|
|
|
|
private float ServerTime;
|
|
|
|
|
private int LoopCount;
|
2020-02-14 21:14:24 +00:00
|
|
|
|
|
2021-12-23 05:06:58 +00:00
|
|
|
|
public ServerTimeMessage(float time, int count)
|
2020-12-02 21:23:01 +00:00
|
|
|
|
{
|
2021-12-23 05:06:58 +00:00
|
|
|
|
ServerTime = time;
|
|
|
|
|
LoopCount = count;
|
2020-12-02 21:23:01 +00:00
|
|
|
|
}
|
2020-02-14 21:14:24 +00:00
|
|
|
|
|
2020-12-23 12:58:45 +00:00
|
|
|
|
public override void Serialize(QNetworkWriter writer)
|
2020-12-02 21:23:01 +00:00
|
|
|
|
{
|
|
|
|
|
base.Serialize(writer);
|
|
|
|
|
writer.Write(ServerTime);
|
|
|
|
|
writer.Write(LoopCount);
|
|
|
|
|
}
|
2021-12-23 05:06:58 +00:00
|
|
|
|
|
|
|
|
|
public override void Deserialize(QNetworkReader reader)
|
|
|
|
|
{
|
|
|
|
|
base.Deserialize(reader);
|
|
|
|
|
ServerTime = reader.ReadSingle();
|
|
|
|
|
LoopCount = reader.ReadInt16();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnReceiveRemote()
|
|
|
|
|
=> WakeUpSync.LocalInstance.OnClientReceiveMessage(ServerTime, LoopCount);
|
2020-12-02 21:23:01 +00:00
|
|
|
|
}
|
2020-02-14 21:14:24 +00:00
|
|
|
|
}
|