예제 #1
0
        public bool Eval(SongViewModel song)
        {
            T targetValue = DebugHelper.CastAndAssert <T>(TargetProperty.GetValue(song));

            switch (EvalType)
            {
            case NumericEvalType.StrictLess:
                return(targetValue.CompareTo(Target) < 0);

            case NumericEvalType.Less:
                return(targetValue.CompareTo(Target) <= 0);

            case NumericEvalType.Equal:
                return(targetValue.CompareTo(Target) == 0);

            case NumericEvalType.More:
                return(targetValue.CompareTo(Target) >= 0);

            case NumericEvalType.StrictMore:
                return(targetValue.CompareTo(Target) > 0);

            default:
                DebugHelper.Alert(new CallerInfo(), "Unexpected NumericEvalType: {0}", EvalType);
                return(false);
            }
        }
예제 #2
0
        protected override void DoInit()
        {
            GetMethod = () => (bool)TargetProperty.GetValue(null, null);
            SetMethod = newQuantity => TargetProperty.SetValue(null, newQuantity, null);

            text.text = Attribute.displayName;
            toggle.onValueChanged.AddListener(OnToggled);

            UpdateToggle();
        }
예제 #3
0
        protected override void DoInit()
        {
            GetQuantityMethod = () => (string)TargetProperty.GetValue(null, null);
            SetQuantityMethod = newQuantity => TargetProperty.SetValue(null, newQuantity, null);

            titleText.text = Attribute.displayName;

            inputField.onEndEdit.AddListener(OnInputEntered);

            UpdateQuantity();
        }
예제 #4
0
        protected override void DoInit()
        {
            GetQuantityMethod = () => (float)TargetProperty.GetValue(null, null);
            SetQuantityMethod = newQuantity => TargetProperty.SetValue(null, newQuantity, null);

            titleText.text = Attribute.displayName;

            slider.minValue = Attribute.min;
            slider.maxValue = Attribute.max;
            slider.onValueChanged.AddListener(delegate { OnQuantityFieldUpdated(slider.value); });
            UpdateQuantity();
        }
예제 #5
0
        protected override void DoInit()
        {
            GetQuantityMethod = () => (int)TargetProperty.GetValue(null, null);
            SetQuantityMethod = newQuantity => TargetProperty.SetValue(null, newQuantity, null);

            titleText.text = Attribute.displayName;

            inputField.characterValidation = InputField.CharacterValidation.Integer;
            inputField.onEndEdit.AddListener(OnInputEntered);

            _allowNegative = Attribute.allowNegative;

            UpdateQuantity();
        }
예제 #6
0
파일: Binding.cs 프로젝트: mlivensp/csla
        /// <summary>
        /// Updates the source with the current value in the target object.  Uses the ConvertBack function to convert the data if available.
        /// </summary>
        public void UpdateSource()
        {
            var value = TargetProperty.GetValue(Target, null);

            if (ConvertBack != null)
            {
                value = ConvertBack(value);
            }
            var converted = Utilities.CoerceValue(
                SourceProperty.PropertyType, TargetProperty.PropertyType, null, value);

            SourceProperty.SetValue(Source,
                                    converted,
                                    null);
        }
예제 #7
0
        public bool Eval(SongViewModel song)
        {
            DateTime targetValue = DebugHelper.CastAndAssert <DateTime>(TargetProperty.GetValue(song));

            switch (EvalType)
            {
            case RangeEvalType.Days:
                DateTime target = DateTime.Now - TimeSpan.FromDays(Target);

                return(target < targetValue);

            default:
                DebugHelper.Alert(new CallerInfo(), "Unexpected MemberEvalType: {0}", EvalType);
                return(false);
            }
        }
예제 #8
0
        /// <summary>
        /// Updates the source with the current value in the target object.  Uses the ConvertBack function to convert the data if available.
        /// </summary>
        public void UpdateSource()
        {
            if (this.BindingDirection == BindingDirection.OneWay)
            {
                return;
            }
            var value = TargetProperty.GetValue(Target, null);

            if (ConvertBack != null)
            {
                value = ConvertBack(value);
            }
            var converted = Utilities.CoerceValue(
                SourceProperty.PropertyType, TargetProperty.PropertyType, null, value);

            SourceProperty.SetValue(Source,
                                    converted,
                                    null);
        }
예제 #9
0
 /// <summary>
 /// Update Target / Source on property change events
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnPropertyChangeRaised(object sender, PropertyChangedEventArgs e)
 {
     if (sender == BindingTarget.Target)
     {
         if (e.PropertyName == TargetProperty.Name)
         {
             if (BindingTarget.IsAlive)
             {
                 Property.SetValue(TargetProperty.GetValue(BindingTarget.Target));
             }
         }
     }
     else if (sender == Property)
     {
         if (e.PropertyName == "Value")
         {
             UpdateTarget();
         }
     }
 }
예제 #10
0
        public override CExecutionPin Execute(CNodeExecutionContext context, List <object> inParameters, List <object> outReturn)
        {
            for (int i = 0; i < inParameters.Count; i++)
            {
                if (inParameters[i] == null)
                {
                    inParameters[i] = InputPins[i].Literal;
                }
            }

            if (m_bIsField)
            {
                TargetField.SetValue(inParameters[0], inParameters[1]);
                outReturn.Add(inParameters[1]);
            }
            else
            {
                TargetProperty.SetValue(inParameters[0], inParameters[1]);
                outReturn.Add(TargetProperty.GetValue(inParameters[0]));
            }
            return(OutExecutionPins[0]);
        }
예제 #11
0
        public bool Eval(SongViewModel song)
        {
            string targetValue = DebugHelper.CastAndAssert <string>(TargetProperty.GetValue(song));

            switch (EvalType)
            {
            case StringEvalType.Equal:
                return(targetValue == Target);

            case StringEvalType.SubString:
                return(targetValue.Contains(Target));

            case StringEvalType.StartsWith:
                return(targetValue.StartsWith(Target));

            case StringEvalType.EndsWith:
                return(targetValue.EndsWith(Target));

            default:
                DebugHelper.Alert(new CallerInfo(), "Unexpected StringEvalType: {0}", EvalType);
                return(false);
            }
        }
예제 #12
0
        public override CExecutionPin Execute(CNodeExecutionContext context, List <object> inParameters, List <object> outReturn)
        {
            for (int i = 0; i < inParameters.Count; i++)
            {
                if (inParameters[i] == null)
                {
                    inParameters[i] = InputPins[i].Literal;
                }
            }

            object targetObject = inParameters[0];

            if (m_bIsField)
            {
                outReturn.Add(TargetField.GetValue(targetObject));
            }
            else
            {
                outReturn.Add(TargetProperty.GetValue(targetObject));
            }

            // Implicit nodes do not return a following node
            return(null);
        }
예제 #13
0
 public virtual object GetTargetValue()
 {
     return(TargetProperty.GetValue(Binding.Target));
 }