protected override void ExecuteCombo(int id)
        {
            switch (id)
            {
            case 40:
                SwitchWeapon?.Invoke();
                break;

            case 50:
                FireOn?.Invoke();
                break;

            case 51:
                FireOff?.Invoke();
                break;
            }
        }
Esempio n. 2
0
        protected void Register <TResult>(Expression <Func <T, TResult> > propertyAccessor, FireOn fireOn)
        {
            PropertyAccessTree propertyAccessTree = ExpressionPropertyAnalyzer.Analyze(propertyAccessor);

            if (propertyAccessTree.DoesEntireTreeSupportINotifyPropertyChanging)
            {
                if (_propertyChangeSubscribers == null)
                {
                    _propertyChangeSubscribers = new List <IPropertyAccessTreeSubscriber <ReactiveMethod <T> > >();
                }

                Action <ReactiveMethod <T>, object, PropertyChangingEventArgs> onPropertyChanging = OnAnyPropertyInSubscriptionChanging;
                Action <ReactiveMethod <T>, object, PropertyChangedEventArgs>  onPropertyChanged  = OnAnyPropertyInSubscriptionChanged;

                if ((fireOn & FireOn.PropertyChanging) != FireOn.PropertyChanging)
                {
                    onPropertyChanging = null;
                }

                if ((fireOn & FireOn.PropertyChanged) != FireOn.PropertyChanged)
                {
                    onPropertyChanged = null;
                }

                var subscriber = propertyAccessTree.CreateCallbackSubscription <ReactiveMethod <T> >(
                    onPropertyChanging, onPropertyChanged
                    );

                _propertyChangeSubscribers.Add(subscriber);
            }
            else if ((fireOn & FireOn.PropertyChanged) == FireOn.PropertyChanged)
            {
                if (_accessTreesWithoutNotifyPropertyChanging == null)
                {
                    _accessTreesWithoutNotifyPropertyChanging = new List <PropertyAccessTree>();
                }
                _accessTreesWithoutNotifyPropertyChanging.Add(propertyAccessTree);
            }
        }