Пример #1
0
        public void Play()
        {
            if (!this.playing)
            {
                this.Rewind();
                this.anchorTime = UIAnim.GetSysTime();
            }

            this.playing = true;

            if (this.paused)
            {
                this.paused     = false;
                this.anchorTime = UIAnim.GetSysTime() - this.currentTime;
            }
        }
Пример #2
0
        public void Update()
        {
            if (!this.playing)
            {
                return;
            }

            if (this.paused)
            {
                return;
            }

            if (this.totalDuration == 0)
            {
                this.Stop();
                return;
            }
            var sysTime = UIAnim.GetSysTime();

            this.currentTime = (sysTime - this.anchorTime) * this.speed;

            if (this.totalDuration <= this.currentTime)
            {
                if (this.pingpong)
                {
                    this.ChangePingpong(sysTime);
                }
                else if (this.loop)
                {
                    var currentTime = this.currentTime % this.totalDuration;
                    this.Rewind();
                    this.currentTime = currentTime;
                    this.Sample();
                }
                else
                {
                    this.currentTime = this.totalDuration;
                    this.Sample();
                    this.Stop();
                }
            }
            else
            {
                this.Sample();
            }
        }