inline events

This commit is contained in:
Mister_Nebula 2021-07-04 23:15:53 +01:00
parent 35af592a58
commit f4483b27b3
2 changed files with 8 additions and 16 deletions

View File

@ -8,15 +8,11 @@ namespace QSB.ProbeSync.Events
{
public override EventType Type => EventType.ProbeEvent;
public override void SetupListener()
{
GlobalMessenger<ProbeEvent>.AddListener(EventNames.QSBProbeEvent, Handler);
}
public override void SetupListener()
=> GlobalMessenger<ProbeEvent>.AddListener(EventNames.QSBProbeEvent, Handler);
public override void CloseListener()
{
GlobalMessenger<ProbeEvent>.RemoveListener(EventNames.QSBProbeEvent, Handler);
}
public override void CloseListener()
=> GlobalMessenger<ProbeEvent>.RemoveListener(EventNames.QSBProbeEvent, Handler);
private void Handler(ProbeEvent probeEvent) => SendEvent(CreateMessage(probeEvent));

View File

@ -8,15 +8,11 @@ namespace QSB.ProbeSync.Events
{
public override EventType Type => EventType.ProbeStartRetrieve;
public override void SetupListener()
{
GlobalMessenger<float>.AddListener(EventNames.QSBProbeStartRetrieve, Handler);
}
public override void SetupListener()
=> GlobalMessenger<float>.AddListener(EventNames.QSBProbeStartRetrieve, Handler);
public override void CloseListener()
{
GlobalMessenger<float>.RemoveListener(EventNames.QSBProbeStartRetrieve, Handler);
}
public override void CloseListener()
=> GlobalMessenger<float>.RemoveListener(EventNames.QSBProbeStartRetrieve, Handler);
private void Handler(float duration) => SendEvent(CreateMessage(duration));