quantum-space-buddies/QSB/Events/ServerTimeEvent.cs
Mister_Nebula ff6f771098 help
2020-08-10 11:45:24 +01:00

30 lines
818 B
C#

using QSB.Messaging;
using QSB.TimeSync;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace QSB.Events
{
class ServerTimeEvent : QSBEvent<ServerTimeMessage>
{
public override MessageType Type => MessageType.ServerTime;
public override void SetupListener()
{
GlobalMessenger<float, int>.AddListener("QSBServerTime", (time, count) => SendEvent(
new ServerTimeMessage {
SenderId = PlayerRegistry.LocalPlayer.NetId,
ServerTime = time,
LoopCount = count
}));
}
public override void OnReceive(ServerTimeMessage message)
{
WakeUpSync.LocalInstance.OnClientReceiveMessage(message);
}
}
}