public SubscriptionToken ProcessEntity(IInteractReactionSystem system, IEntity entity)
        {
            var obs          = system.Impact(entity);
            var subscription = obs.Subscribe <IEntity>(x =>
            {
                system.Reaction(entity, x);
            });

            return(new SubscriptionToken(entity, subscription));
        }
コード例 #2
0
        public SubscriptionToken ProcessEntity(IInteractReactionSystem system, IEntity entity)
        {
            var hasEntityPredicate = system.TargetGroup is IHasPredicate;
            var subscription       = system.Impact(entity)
                                     .Subscribe(x =>
            {
                if (hasEntityPredicate)
                {
                    var groupPredicate = system.TargetGroup as IHasPredicate;
                    if (groupPredicate.CanProcessEntity(entity))
                    {
                        system.Reaction(entity, x);
                    }
                    return;
                }

                system.Reaction(entity, x);
            });

            return(new SubscriptionToken(entity, subscription));
        }