quantum-space-buddies/QSB/Events/WakeUpEvent.cs

30 lines
798 B
C#
Raw Normal View History

2020-08-09 18:33:36 +00:00
using QSB.Messaging;
2020-08-09 19:46:02 +00:00
using QSB.TimeSync;
2020-08-09 18:33:36 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace QSB.Events
{
class WakeUpEvent : QSBEvent<WakeUpMessage>
{
public override MessageType Type => MessageType.WakeUp;
public override void SetupListener()
{
GlobalMessenger<float, int>.AddListener("QSBServerTime", (time, count) => SendEvent(
new WakeUpMessage {
2020-08-09 19:46:02 +00:00
SenderId = PlayerRegistry.LocalPlayer.NetId,
2020-08-09 18:33:36 +00:00
ServerTime = time,
LoopCount = count
}));
}
2020-08-09 19:46:02 +00:00
public override void OnReceive(WakeUpMessage message)
{
WakeUpSync.LocalInstance.OnClientReceiveMessage(message);
}
2020-08-09 18:33:36 +00:00
}
}