예제 #1
0
        public void RegisterSubscriptionManager(Type type, SubscriptionManagerBase manager)
        {
            if (typeToSubscriptionManager.ContainsKey(type))
            {
                throw new InvalidOperationException("Already a manager registered");
            }

            typeToSubscriptionManager[type] = manager;
        }
예제 #2
0
        public void RegisterSubscriptionManager(Type type, SubscriptionManagerBase manager)
        {
            if (typeToSubscriptionManager.ContainsKey(type))
            {
                throw new InvalidOperationException($"Duplicate manager for {type.Name}.");
            }

            typeToSubscriptionManager.Add(type, manager);
        }
        public static void TryRegisterManager(Type type, SubscriptionManagerBase manager, World world)
        {
            var subscriptionSystem = world.GetExistingManager <SubscriptionSystem>();

            if (subscriptionSystem == null)
            {
                throw new ArgumentException("No subscription system");
            }

            subscriptionSystem.RegisterSubscriptionManager(type, manager);
        }
 public static void TryRegisterManager <T>(SubscriptionManagerBase manager, World world)
 {
     TryRegisterManager(typeof(T), manager, world);
 }