Esempio n. 1
0
 /// <summary>
 ///     Starts the playing of the animation
 /// </summary>
 /// <param name="frameCallback">
 ///     The callback to get invoked at each frame
 /// </param>
 /// <param name="endCallback">
 ///     The callback to get invoked at the end of the animation
 /// </param>
 public void Play(SafeInvoker <Float3D> frameCallback, SafeInvoker endCallback)
 {
     Stop();
     FrameCallback = frameCallback;
     EndCallback   = endCallback;
     IsEnded       = false;
     HorizontalAnimator.Play(
         new SafeInvoker <float>(
             value =>
     {
         XValue = value;
         InvokeSetter();
     }),
         new SafeInvoker(InvokeFinisher));
     VerticalAnimator.Play(
         new SafeInvoker <float>(
             value =>
     {
         YValue = value;
         InvokeSetter();
     }),
         new SafeInvoker(InvokeFinisher));
     DepthAnimator.Play(
         new SafeInvoker <float>(
             value =>
     {
         ZValue = value;
         InvokeSetter();
     }),
         new SafeInvoker(InvokeFinisher));
 }
Esempio n. 2
0
 /// <summary>
 ///     Starts the playing of the animation
 /// </summary>
 /// <param name="frameCallback">
 ///     The callback to get invoked at each frame
 /// </param>
 /// <param name="endCallback">
 ///     The callback to get invoked at the end of the animation
 /// </param>
 public virtual void Play(SafeInvoker <int> frameCallback, SafeInvoker endCallback)
 {
     Stop();
     FrameCallbackInt = frameCallback;
     EndCallback      = endCallback;
     _timer.ResetClock();
     lock (_tempPaths)
     {
         _tempPaths.AddRange(_paths);
     }
     _timer.Start();
 }
Esempio n. 3
0
        /// <summary>
        ///     Starts the playing of the animation
        /// </summary>
        /// <param name="targetObject">
        ///     The target object to change the property
        /// </param>
        /// <param name="propertyName">
        ///     The name of the property to change
        /// </param>
        /// <param name="endCallback">
        ///     The callback to get invoked at the end of the animation
        /// </param>
        /// <param name="type">
        ///     Redundant value. Enter 1
        /// </param>
        public virtual void Play(object targetObject, string propertyName, SafeInvoker endCallback, int type)
        {
            TargetObject = targetObject;
            var prop = TargetObject.GetType()
                       .GetProperty(
                propertyName,
                BindingFlags.IgnoreCase | BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance |
                BindingFlags.SetProperty);

            if (prop == null)
            {
                return;
            }
            Play(
                new SafeInvoker <int>(
                    value => prop.SetValue(TargetObject, Convert.ChangeType(value, prop.PropertyType), null),
                    TargetObject),
                endCallback);
        }
Esempio n. 4
0
 /// <summary>
 ///     Starts the playing of the animation
 /// </summary>
 /// <param name="frameCallback">
 ///     The callback to get invoked at each frame
 /// </param>
 public virtual void Play(SafeInvoker <int> frameCallback)
 {
     Play(frameCallback, (SafeInvoker <int>)null);
 }
Esempio n. 5
0
        /// <summary>
        ///     Starts the playing of the animation
        /// </summary>
        /// <param name="targetObject">
        ///     The target object to change the property
        /// </param>
        /// <param name="propertySetter">
        ///     The expression that represents the property of the target object
        /// </param>
        /// <param name="endCallback">
        ///     The callback to get invoked at the end of the animation
        /// </param>
        /// <param name="type">
        ///     Redundant value. Enter 1
        /// </param>
        /// <typeparam name="T">
        ///     Any object containing a property
        /// </typeparam>
        public virtual void Play <T>(T targetObject, Expression <Func <T, object> > propertySetter, SafeInvoker endCallback, int type)
        {
            if (propertySetter == null)
            {
                return;
            }
            TargetObject = targetObject;

            var property =
                ((propertySetter.Body as MemberExpression) ??
                 (((UnaryExpression)propertySetter.Body).Operand as MemberExpression))?.Member as PropertyInfo;

            if (property == null)
            {
                throw new ArgumentException(nameof(propertySetter));
            }

            Play(
                new SafeInvoker <int>(
                    value => property.SetValue(TargetObject, Convert.ChangeType(value, property.PropertyType), null),
                    TargetObject),
                endCallback);
        }
Esempio n. 6
0
 /// <summary>
 ///     Starts the playing of the animation
 /// </summary>
 /// <param name="targetObject">
 ///     The target object to change the property
 /// </param>
 /// <param name="property">
 ///     The property to change
 /// </param>
 /// <param name="endCallback">
 ///     The callback to get invoked at the end of the animation
 /// </param>
 public virtual void Play(object targetObject, KnownProperties property, SafeInvoker endCallback)
 {
     Play(targetObject, property.ToString(), endCallback);
 }
Esempio n. 7
0
 /// <summary>
 ///     Starts the playing of the animation
 /// </summary>
 /// <param name="frameCallback">
 ///     The callback to get invoked at each frame
 /// </param>
 public void Play(SafeInvoker <Float3D> frameCallback)
 {
     Play(frameCallback, (SafeInvoker)null);
 }