protected void fireAnimationComplete(LayoutContainer oldChild)
 {
     if (AnimationComplete != null)
     {
         AnimationComplete.Invoke(oldChild);
     }
 }
Exemplo n.º 2
0
        public void Update(GameTime gameTime)
        {
            if (isHidden == true)
            {
                return;
            }

            if (totalFrames > 1)
            {
                lastElapsedTime += gameTime.ElapsedGameTime;

                if (lastElapsedTime > frameInterval)
                {
                    currentFrame    = (currentFrame + 1) % totalFrames;
                    lastElapsedTime = TimeSpan.FromMilliseconds(0);
                    if (currentFrame == 0)
                    {
                        AnimationComplete?.Invoke(this, null);
                    }
                    if (shouldLoop == false && currentFrame == 0)
                    {
                        animationEnd();
                        return;
                    }
                }
            }
        }
Exemplo n.º 3
0
 private void TimerTick(object sender, EventArgs e)
 {
     if (currentFrame++ >= frames.Length - 1)
     {
         currentFrame = 0;
         AnimationComplete?.Invoke(this, EventArgs.Empty);
     }
 }
Exemplo n.º 4
0
        protected void Init(float durationSeconds, AnimationUpdate updateDelegate, AnimationComplete completeDelegate)
        {
            // create our timer at 60hz
            AnimTimer = NSTimer.CreateRepeatingTimer(new TimeSpan(ANIMATION_TICK_FREQUENCY), new Action <NSTimer>(
                                                         delegate
            {
                // update our timer
                CurrentTime += ANIMATION_TICK_RATE;

                float percent = 0.00f;

                // check the style of animation they want
                switch (AnimStyle)
                {
                // linear is, well, linear.
                case Style.Linear:
                    {
                        percent = CurrentTime / durationSeconds;
                        break;
                    }


                // curve ease in starts SLOW and ends FAST
                case Style.CurveEaseIn:
                    {
                        float xPerc = CurrentTime / durationSeconds;
                        percent     = (float)System.Math.Pow(xPerc, 3.0f);
                        break;
                    }

                // curve ease out starts FAST and ends SLOW
                case Style.CurveEaseOut:
                    {
                        float xPerc = CurrentTime / durationSeconds;
                        percent     = (float)1 + (float)System.Math.Pow((xPerc - 1), 3.0f);
                        break;
                    }
                }

                // let the animation implementation do what it needs to
                AnimTick(System.Math.Min(percent, 1.00f), updateDelegate);

                // see if we're finished.
                if (CurrentTime >= durationSeconds)
                {
                    // we are, so notify the completion delegate
                    if (completeDelegate != null)
                    {
                        completeDelegate( );
                    }

                    // and kill the timer
                    AnimTimer.Invalidate( );
                }
            })
                                                     );
        }
        protected void Init(float duration, AnimationUpdate updateDelegate, AnimationComplete completeDelegate)
        {
            Animator = ValueAnimator.OfFloat(0.00f, 1.00f);

            Animator.AddUpdateListener(this);
            Animator.AddListener(this);

            // convert duration to milliseconds
            Animator.SetDuration((int)(duration * 1000.0f));

            AnimationUpdateDelegate   = updateDelegate;
            AnimationCompleteDelegate = completeDelegate;
        }
Exemplo n.º 6
0
 public ColorTweenData(object o, Color startColor, Color endColor, int duration, AnimationComplete completeHandler, AnimationUpdate updateHandler)
 {
     this._object = o;
     this._prop = _object.GetType().GetProperty("color");
     _property_name = "color";
     _startColor = startColor;
     _endColor = endColor;
     _startVal = 0;
     _endVal = 1;
     _duration = duration;
     _tweenFunc = Tweener.GetFunction(TransitionType.LINEAR);
     Complete += completeHandler;
     Update += updateHandler;
 }
        /// <summary>
        /// Event callback handling correct answers
        /// </summary>
        public void OnAnswerCorrect()
        {
            AnimationComplete completion = DisablePanel;

            MainController.Instance.GetGUIController().correctPanel.AddAnimationCompleteDelegate(completion);
            MainController.Instance.GetGUIController().correctPanel.EnablePanel();

            MainController.Instance.GetNodeController().TargetNode.isAnswered = true;

            incorrectLabel.enabled = false;

            m_NumOfCompletedPuzzles += 1;

            if (m_NumOfCompletedPuzzles >= NumOfPuzzles)
            {
                MainController.Instance.OnWin();
            }
        }
Exemplo n.º 8
0
 public IEnumerator UnloadAnimationRoutine()
 {
     if (controllerAnimation != null)
     {
         bool completed = false;
         controllerAnimation.Hide(() => {
             if (unloadAnimationCompleted != null)
             {
                 App.Util.AppManager.CurrentScene.StartCoroutine(unloadAnimationCompleted());
                 unloadAnimationCompleted = null; // 連打時のエラー回避
             }
             completed = true;
         });
         while (!completed)
         {
             yield return 0;
         }
     }
 }
Exemplo n.º 9
0
 public TweenData(object o, string property_name, float startVal, float endVal, int duration, TransitionType transitionType, AnimationComplete _completeHandler, AnimationUpdate _updateHandler)
     : this(o, property_name, startVal, endVal, duration, transitionType)
 {
     Complete += _completeHandler;
     Update += _updateHandler;
 }
Exemplo n.º 10
0
 private IEnumerator animatedProgressRoutine(float sourceV, float targetV, float duration, Easing.Function easingFunction, AnimationComplete completeCallback, float delay)
 {
 protected override void OnAnimationComplete()
 {
     Timer.Stop();
     AnimationComplete?.Invoke();
 }
Exemplo n.º 12
0
 public void addTween(object o, string property_name, float startVal, float endVal, int duration, TransitionType transitionType, AnimationComplete _completeHandler = null, AnimationUpdate _updateHandler = null)
 {
     TweenData tween = new TweenData(o, property_name, startVal, endVal, duration, transitionType, _completeHandler, _updateHandler);
     this.addTween(tween);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Event callback for when GUI slide in/out animation is completed
 /// </summary>
 public void AddAnimationCompleteDelegate(AnimationComplete completion)
 {
     m_AnimationCompleters.Add(completion);
 }
Exemplo n.º 14
0
        public TweenData(AnimationComplete completeHandler = null, AnimationUpdate updateHandler = null)
        {
            if (completeHandler != null)
                Complete += completeHandler;

            if (updateHandler != null)
                Update += updateHandler;
        }
Exemplo n.º 15
0
        public SimpleAnimator_PointF(System.Drawing.PointF start, System.Drawing.PointF end, float duration, AnimationUpdate updateDelegate, AnimationComplete completeDelegate)
        {
            StartValue = start;
            Delta      = new System.Drawing.PointF(end.X - start.X, end.Y - start.Y);

            Init(duration, updateDelegate, completeDelegate);
        }
Exemplo n.º 16
0
        public SimpleAnimator_RectF(System.Drawing.RectangleF start, System.Drawing.RectangleF end, float duration, AnimationUpdate updateDelegate, AnimationComplete completeDelegate)
        {
            StartValue = start;
            Delta      = new System.Drawing.RectangleF(end.X - start.X, end.Y - start.Y, end.Width - start.Width, end.Height - start.Height);

            Init(duration, updateDelegate, completeDelegate);
        }
Exemplo n.º 17
0
        public SimpleAnimator_Float(float start, float end, float duration, AnimationUpdate updateDelegate, AnimationComplete completeDelegate)
        {
            StartValue = start;
            EndValue   = end;

            Init(duration, updateDelegate, completeDelegate);
        }
Exemplo n.º 18
0
        public SimpleAnimator_Color(uint start, uint end, float duration, AnimationUpdate updateDelegate, AnimationComplete completionDelegate)
        {
            Init(duration, updateDelegate, completionDelegate);

            StartR = (start & 0xFF000000) >> 24;
            StartG = (start & 0x00FF0000) >> 16;
            StartB = (start & 0x0000FF00) >> 8;
            StartA = (start & 0xFF);

            uint endR = (end & 0xFF000000) >> 24;
            uint endG = (end & 0x00FF0000) >> 16;
            uint endB = (end & 0x0000FF00) >> 8;;
            uint endA = (end & 0xFF);

            DeltaR = (int)(endR - StartR);
            DeltaG = (int)(endG - StartG);
            DeltaB = (int)(endB - StartB);
            DeltaA = (int)(endA - StartA);
        }