예제 #1
0
 public virtual void Update(GameTime gameTime)
 {
     present = gameTime;
     if (gameTime.TotalGameTime > BeginTime.TotalGameTime)
     {
         if ((gameTime.TotalGameTime < (BeginTime.TotalGameTime + Duration)) && !Finished)
         {
             isRunning = true;
             var presentvalue = (int)(BeginValue + (EasingFunction.EasingCurve(Progress, PlayBack) * (EndValue - BeginValue)));
             TargetProperty.SetValue(TargetSprite, presentvalue, null);
         }
         else
         {
             isRunning = false;
             Finished  = true;
         }
     }
     if ((LoopCount > 1 || LoopMode == LoopMode.Forever) && Finished && (LoopMode != LoopMode.Once))
     {
         LoopCount--;
         BeginTime = new GameTime(gameTime.TotalGameTime, gameTime.ElapsedGameTime);
         BeginTime.TotalGameTime += LoopDelay;
         if (ReturnToBeginning)
         {
             TargetProperty.SetValue(TargetSprite, (int)BeginValue, null);
         }
         isRunning = true;
         Finished  = false;
         return;
     }
 }
예제 #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
 /// <summary>
 /// Update value of CLR Property
 /// </summary>
 /// <param name="newValue"></param>
 private void UpdateTarget()
 {
     if (TargetProperty?.CanWrite == true)
     {
         // Update the target property if the owner hasn't already been GC'ed
         if (BindingTarget.IsAlive)
         {
             TargetProperty.SetValue(BindingTarget.Target, Property.GetValue());
         }
     }
 }
예제 #4
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();
        }
예제 #5
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();
        }
예제 #6
0
 public override void Map(object source, object target)
 {
     try
     {
         var sourceValue = _sourceProperty.GetValue(source);
         var targetValue = _map.Map(sourceValue);
         TargetProperty.SetValue(target, targetValue);
     }
     catch (Exception ex)
     {
         throw new MappingException(string.Format("Could not map {0}.{1} to {2}.{3}", source.GetType(), _sourceProperty.Name, target, TargetProperty.Name), ex);
     }
 }
예제 #7
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();
        }
예제 #8
0
파일: Binding.cs 프로젝트: mlivensp/csla
        /// <summary>
        /// Updates the target with the current value in the source object.  Uses the Convert function to convert the data if available.
        /// </summary>
        public void UpdateTarget()
        {
            var value = SourceProperty.GetValue(Source, null);

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

            TargetProperty.SetValue(Target,
                                    converted,
                                    null);
        }
예제 #9
0
        /// <summary>
        /// Updates the value of the property.
        /// </summary>
        /// <remarks>
        /// CAUTION This method must be called on a UI thread.
        /// </remarks>
        public override void UpdateValue()
        {
            var targetObject = this.TargetObject;

            if (targetObject == null)
            {
                // The object has been GC
                return;
            }

            if (BindingExpression != null)
            {
                BindingExpression.UpdateTarget();
            }
            else
            {
                var value = ProduceValue();
                TargetProperty.SetValue(targetObject, value);
            }
        }
예제 #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 virtual void SetTargetValue(object value)
 {
     TargetProperty.SetValue(Target, value);
 }