Exemplo n.º 1
0
        internal void Stop()
        {
            cachedStuff      = false;
            this.cachedPairs = null;

            if (this.actionPairs.Count > 0)
            {
                // fire all callbacks which should happen when or after the last nextAni ends
                float  lastFrame  = this.totalFinishedFrames;
                AniJob nextAniJob = this.AniJob;
                while (nextAniJob != null && this.model.TryGetAniFromJob(nextAniJob, out Animation nextAni))
                {
                    lastFrame += nextAni.GetFrameNum();
                    nextAniJob = nextAniJob.NextAni;
                }

                for (int i = 0; i < actionPairs.Count; i++)
                {
                    if (this.actionPairs[i].Frame >= lastFrame)
                    {
                        this.actionPairs[i].Callback();
                    }
                    else
                    {
                        break;
                    }
                }

                this.actionPairs.Clear();
            }

            this.ani = null;
        }
Exemplo n.º 2
0
        internal void OnTick(long now)
        {
            if (cachedStuff)
            {
                this.Start(ani, fpsMult, cachedProgress, cachedPairs);
            }

            if (!this.IsIdleAni)
            {
                if (now < endTime) // still playing
                {
                    for (int i = actionPairs.Count - 1; i >= 0; i--)
                    {
                        var current = actionPairs[i];
                        if (now < current.Time)
                        {
                            break;
                        }

                        actionPairs.RemoveAt(i);
                        current.Callback();
                        if (this.ani == null) // ani is stopped
                        {
                            break;
                        }
                    }
                }
                else
                {
                    AniJob nextAniJob = this.AniJob.NextAni;
                    if (nextAniJob != null)
                    {
                        if (model.TryGetAniFromJob(nextAniJob, out Animation nextAni))
                        {
                            Continue(nextAni); // there is a nextAni, continue playing it
                            return;
                        }
                    }

                    // fire all remaining actions
                    actionPairs.ForEach(p => p.Callback());
                    actionPairs.Clear();

                    // end this animation
                    model.EndAni(this.ani);
                    this.ani = null;
                }
            }
        }
Exemplo n.º 3
0
 internal void SetAniJob(AniJob job, Overlay overlay)
 {
     this.aniJob  = job;
     this.overlay = overlay;
 }