Esempio n. 1
0
 public virtual void Play(SafeInvoker <float> frameCallback, SafeInvoker endCallback)
 {
     this.Stop();
     this.FrameCallback = frameCallback;
     this.EndCallback   = endCallback;
     this._timer.ResetClock();
     lock (this._tempPaths)
         this._tempPaths.AddRange((IEnumerable <Path>) this._paths);
     this._timer.Start();
 }
Esempio n. 2
0
        public virtual void Play(object targetObject, string propertyName, SafeInvoker endCallback)
        {
            this.TargetObject = targetObject;
            PropertyInfo prop = this.TargetObject.GetType().GetProperty(propertyName, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.SetProperty);

            if (prop == null)
            {
                return;
            }
            this.Play(new SafeInvoker <float>((Action <float>)(value => prop.SetValue(this.TargetObject, Convert.ChangeType((object)value, prop.PropertyType), (object[])null)), this.TargetObject), endCallback);
        }
Esempio n. 3
0
 public void Play(SafeInvoker <Float2D> frameCallback, SafeInvoker endCallback)
 {
     this.Stop();
     this.FrameCallback = frameCallback;
     this.EndCallback   = endCallback;
     this.HorizontalAnimator.Play(new SafeInvoker <float>((Action <float>)(value =>
     {
         this.XValue = new float?(value);
         this.InvokeSetter();
     })), new SafeInvoker(new Action(this.InvokeFinisher)));
     this.VerticalAnimator.Play(new SafeInvoker <float>((Action <float>)(value =>
     {
         this.YValue = new float?(value);
         this.InvokeSetter();
     })), new SafeInvoker(new Action(this.InvokeFinisher)));
 }
Esempio n. 4
0
 private void Elapsed(ulong millSinceBeginning)
 {
     lock (this._tempPaths)
     {
         if (this._tempPaths != null && this.ActivePath == null && this._tempPaths.Count > 0)
         {
             while (this.ActivePath == null)
             {
                 if (this._tempReverseRepeat)
                 {
                     this.ActivePath = this._tempPaths.LastOrDefault <Path>();
                     this._tempPaths.RemoveAt(this._tempPaths.Count - 1);
                 }
                 else
                 {
                     this.ActivePath = this._tempPaths.FirstOrDefault <Path>();
                     this._tempPaths.RemoveAt(0);
                 }
                 this._timer.ResetClock();
                 millSinceBeginning = 0UL;
             }
         }
         if (this.ActivePath != null)
         {
             if (!this._tempReverseRepeat && millSinceBeginning < this.ActivePath.Delay)
             {
                 this.CurrentStatus = AnimatorStatus.OnHold;
             }
             else if (millSinceBeginning - (!this._tempReverseRepeat ? this.ActivePath.Delay : 0UL) <= this.ActivePath.Duration)
             {
                 if (this.CurrentStatus != AnimatorStatus.Playing)
                 {
                     this.FrameCallback.Invoke(this._tempReverseRepeat ? this.ActivePath.End : this.ActivePath.Start);
                     this.CurrentStatus = AnimatorStatus.Playing;
                 }
                 this.FrameCallback.Invoke(this.ActivePath.Function(this._tempReverseRepeat ? (float)(this.ActivePath.Duration - millSinceBeginning) : (float)(millSinceBeginning - this.ActivePath.Delay), this.ActivePath.Start, this.ActivePath.Change, (float)this.ActivePath.Duration));
             }
             else
             {
                 if (this.CurrentStatus == AnimatorStatus.Playing)
                 {
                     this.FrameCallback.Invoke(this._tempReverseRepeat ? this.ActivePath.Start : this.ActivePath.End);
                 }
                 if (this._tempReverseRepeat && millSinceBeginning - this.ActivePath.Duration < this.ActivePath.Delay)
                 {
                     this.CurrentStatus = AnimatorStatus.OnHold;
                 }
                 else
                 {
                     this.ActivePath = (Path)null;
                 }
             }
         }
         else if (this.Repeat)
         {
             lock (this._tempPaths)
             {
                 this._tempPaths.AddRange((IEnumerable <Path>) this._paths);
                 this._tempReverseRepeat = this.ReverseRepeat && !this._tempReverseRepeat;
             }
         }
         else
         {
             this.Stop();
             SafeInvoker temp_11 = this.EndCallback;
             if (temp_11 == null)
             {
                 return;
             }
             temp_11.Invoke();
         }
     }
 }
Esempio n. 5
0
 public virtual void Play(SafeInvoker <float> frameCallback)
 {
     this.Play(frameCallback, (SafeInvoker)null);
 }
Esempio n. 6
0
 public virtual void Play(object targetObject, Animator.KnownProperties property, SafeInvoker endCallback)
 {
     this.Play(targetObject, property.ToString(), endCallback);
 }
Esempio n. 7
0
        public virtual void Play <T>(T targetObject, Expression <Func <T, object> > propertySetter, SafeInvoker endCallback)
        {
            if (propertySetter == null)
            {
                return;
            }
            this.TargetObject = (object)targetObject;
            MemberExpression memberExpression = propertySetter.Body as MemberExpression ?? ((UnaryExpression)propertySetter.Body).Operand as MemberExpression;
            PropertyInfo     property         = (memberExpression != null ? memberExpression.Member : (MemberInfo)null) as PropertyInfo;

            if (property == null)
            {
                throw new ArgumentException("propertySetter");
            }
            this.Play(new SafeInvoker <float>((Action <float>)(value => property.SetValue(this.TargetObject, Convert.ChangeType((object)value, property.PropertyType), (object[])null)), this.TargetObject), endCallback);
        }
Esempio n. 8
0
 public void Play(SafeInvoker <Float3D> frameCallback)
 {
     this.Play(frameCallback, (SafeInvoker)null);
 }