using QSB.Events; using QSB.Messaging; namespace QSB.Utility.Events { public class DebugEvent : QSBEvent> { public override EventType Type => EventType.DebugEvent; public override void SetupListener() => GlobalMessenger.AddListener(EventNames.QSBDebugEvent, Handler); public override void CloseListener() => GlobalMessenger.RemoveListener(EventNames.QSBDebugEvent, Handler); private void Handler(DebugEventEnum type) => SendEvent(CreateMessage(type)); private EnumMessage CreateMessage(DebugEventEnum type) => new EnumMessage { AboutId = LocalPlayerId, EnumValue = type }; public override void OnReceiveLocal(bool isHost, EnumMessage message) => OnReceiveRemote(isHost, message); public override void OnReceiveRemote(bool isHost, EnumMessage message) { switch (message.EnumValue) { case DebugEventEnum.TriggerSupernova: TimeLoop.SetSecondsRemaining(0f); break; } } } }