コード例 #1
0
        private void SanitizeTypes()
        {
            bool didTypeChange = false;

            if (bindingType == BindingType.Variable && fromBinding.Type != typeof(IReadOnlyObservableVariable <TFrom>))
            {
                fromBinding   = new BindingInfo(typeof(IReadOnlyObservableVariable <TFrom>));
                expectedType  = new SerializableType(typeof(OperatorVariableViewModel <TTo>));
                didTypeChange = true;
            }

            if (bindingType == BindingType.Collection && fromBinding.Type != typeof(IReadOnlyObservableCollection <TFrom>))
            {
                fromBinding   = new BindingInfo(typeof(IReadOnlyObservableCollection <TFrom>));
                expectedType  = new SerializableType(typeof(OperatorCollectionViewModel <TTo>));
                didTypeChange = true;
            }

            if (bindingType == BindingType.Command && fromBinding.Type != typeof(IObservableCommand <TTo>))
            {
                fromBinding   = new BindingInfo(typeof(IObservableCommand <TTo>));
                expectedType  = new SerializableType(typeof(OperatorCommandViewModel <TFrom>));
                didTypeChange = true;
            }

            if (bindingType == BindingType.Event && fromBinding.Type != typeof(IObservableEvent <TFrom>))
            {
                fromBinding   = new BindingInfo(typeof(IObservableEvent <TFrom>));
                expectedType  = new SerializableType(typeof(OperatorEventViewModel <TTo>));
                didTypeChange = true;
            }

            if (didTypeChange)
            {
                BindingInfoTrackerProxy.RefreshBindingInfo();
            }
        }
コード例 #2
0
 public SkipCommandBindingProcessor(BindingInfo bindingInfo, Component context, int skipAmount)
     : base(bindingInfo, context)
 {
     this.skipAmount    = skipAmount;
     valueReceivedCount = 0;
 }
コード例 #3
0
        protected override IBindingProcessor GetBindingProcessor(BindingType bindingType, BindingInfo fromBinding)
        {
            IBindingProcessor result = null;

            switch (bindingType)
            {
            case BindingType.Variable:
                result = new TakeVariableBindingProcessor <T>(fromBinding, this, skipAmount);
                break;

            case BindingType.Collection:
                Debug.LogError("Collection take is not supported", this);
                break;

            case BindingType.Command:
                result = new TakeCommandBindingProcessor <T>(fromBinding, this, skipAmount);
                break;

            case BindingType.Event:
                result = new TakeEventBindingProcessor <T>(fromBinding, this, skipAmount);
                break;
            }

            return(result);
        }
コード例 #4
0
        protected override IBindingProcessor GetBindingProcessor(BindingType bindingType, BindingInfo fromBinding)
        {
            IBindingProcessor result = null;

            switch (bindingType)
            {
            case BindingType.Variable:
                result = new TweenVariableBindingProcessor <T>(fromBinding, this, BuildTweener);
                break;

            case BindingType.Collection:
                result = new TweenCollectionBindingProcessor <T>(fromBinding, this, BuildTweener);
                break;
            }

            return(result);
        }
コード例 #5
0
 public VariableBinding(BindingInfo bindingInfo, Component context) : base(bindingInfo, context)
 {
     exposedProperty = new ObservableVariable <T>();
 }
コード例 #6
0
 public TweenVariableBindingProcessor(BindingInfo bindingInfo, Component context, BuildTweener tweenBuilder)
     : base(bindingInfo, context)
 {
     this.tweenBuilder = tweenBuilder;
 }
コード例 #7
0
 protected CollectionBindingSubscriber <T> RegisterCollection <T>(BindingInfo bindingInfo)
 {
     return(bindingTracker.RegisterCollection <T>(bindingInfo));
 }
コード例 #8
0
 public DelayVariableBindingProcessor(BindingInfo bindingInfo, Component context, float delay)
     : base(bindingInfo, context)
 {
     actionQueue = new Queue <ActionCommand>();
     this.delay  = delay;
 }
コード例 #9
0
        protected override IBindingProcessor GetBindingProcessor(BindingType bindingType, BindingInfo fromBinding)
        {
            IBindingProcessor result = null;

            switch (bindingType)
            {
            case BindingType.Variable:
                result = new DelayVariableBindingProcessor <T>(fromBinding, this, delay);
                break;

            case BindingType.Collection:
                result = new DelayCollectionBindingProcessor <T>(fromBinding, this, delay);
                break;

            case BindingType.Command:
                result = new DelayCommandBindingProcessor <T>(fromBinding, this, delay);
                break;

            case BindingType.Event:
                result = new DelayEventBindingProcessor <T>(fromBinding, this, delay);
                break;
            }

            return(result);
        }
コード例 #10
0
 public CollectionBinding(BindingInfo bindingInfo, Component context) : base(bindingInfo, context)
 {
     exposedProperty = new ObservableCollection <T>();
 }
コード例 #11
0
 protected abstract IBindingProcessor GetBindingProcessor(BindingType bindingType, BindingInfo fromBinding);
コード例 #12
0
 protected CommandBindingSubscriber <T> RegisterCommand <T>(BindingInfo bindingInfo)
 {
     return(bindingTracker.RegisterCommand <T>(bindingInfo));
 }
コード例 #13
0
 protected EventBindingSubscriber <T> RegisterEvent <T>(BindingInfo bindingInfo)
 {
     return(bindingTracker.RegisterEvent <T>(bindingInfo));
 }
コード例 #14
0
 public ToEventBindingProcessor(BindingInfo bindingInfo, Component context, Func <TFrom, TTo> processFunction)
     : base(bindingInfo, context)
 {
     this.processFunction = processFunction;
 }
コード例 #15
0
 public Binding(BindingInfo bindingInfo, Component context)
 {
     this.bindingInfo = bindingInfo;
     this.context     = context;
 }
コード例 #16
0
 public EventBinding(BindingInfo bindingInfo, Component context) : base(bindingInfo, context)
 {
     exposedProperty = new ObservableEvent();
 }
コード例 #17
0
 public TakeCommandBindingProcessor(BindingInfo bindingInfo, Component context, int takeAmount)
     : base(bindingInfo, context)
 {
     this.takeAmount    = takeAmount;
     valueReceivedCount = 0;
 }
コード例 #18
0
 public CommandBinding(BindingInfo bindingInfo, Component context) : base(bindingInfo, context)
 {
     canExecuteSource = new ObservableVariable <bool>(false);
     exposedProperty  = new ObservableCommand(canExecuteSource, OnExecuteRequested);
 }
コード例 #19
0
 protected VariableBindingSubscriber <T> RegisterVariable <T>(BindingInfo bindingInfo)
 {
     return(bindingTracker.RegisterVariable <T>(bindingInfo));
 }