Files
Infratest/Assets/Code/Infrastructure/EventBus/EventBusHelper.cs
T
ThomasCharester 5f5ace1b52 Essentials + extra crap
Loadings
Startups
Movement
Camera
2026-01-12 18:43:51 +03:00

31 lines
884 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace Code.Infrastructure.EventBus
{
internal static class EventBusHelper
{
private static Dictionary<Type, List<Type>> s_CashedSubscriberTypes =
new();
public static List<Type> GetSubscriberTypes(
IGlobalSubscriber globalSubscriber)
{
Type type = globalSubscriber.GetType();
if (s_CashedSubscriberTypes.ContainsKey(type))
{
return s_CashedSubscriberTypes[type];
}
List<Type> subscriberTypes = type
.GetInterfaces()
.Where(t => t.GetInterfaces()
.Contains(typeof(IGlobalSubscriber)))
.ToList();
s_CashedSubscriberTypes[type] = subscriberTypes;
return subscriberTypes;
}
}
}