Esempio n. 1
0
 public AnimationController()
 {
     state         = Globals.TelemetryAnimationState.Stopped;
     playSpeed     = 0;
     nextIndexDraw = 0;
     needRefresh   = true;
 }
Esempio n. 2
0
 public void Stop()
 {
     state         = Globals.TelemetryAnimationState.Stopped;
     playSpeed     = 0;
     nextIndexDraw = eventContainer.events.Count - 1;
     eventContainer.ShouldAnimate = false;
 }
Esempio n. 3
0
 public AnimationController(EventEditorContainer newContainer)
 {
     state          = Globals.TelemetryAnimationState.Stopped;
     playSpeed      = 0;
     nextIndexDraw  = 0;
     needRefresh    = true;
     eventContainer = newContainer;
 }
Esempio n. 4
0
        public void Play(int speed)
        {
            if (eventContainer == null)
            {
                return;
            }

            if (state == Globals.TelemetryAnimationState.Playing && playSpeed == speed)
            {
                //Already playing at this speed, so pause
                Pause();
            }
            else if (state == Globals.TelemetryAnimationState.Playing)
            {
                //Need to play at different speed, so reset the start time to when it would have started
                //at the given speed
                localStartTime = DateTime.UtcNow;

                if (nextIndexDraw > 0)
                {
                    localStartTime -= eventContainer.events[nextIndexDraw].Time - eventContainer.events[eventContainer.events.Count - 1].Time;
                }
            }
            else if (state == Globals.TelemetryAnimationState.Stopped)
            {
                //Start playing from the beginning
                needRefresh = true;

                if (speed >= 0)
                {
                    nextIndexDraw = eventContainer.events.Count - 1;
                }
                else
                {
                    nextIndexDraw = 0;
                }

                localStartTime = DateTime.UtcNow;
                state          = Globals.TelemetryAnimationState.Playing;
                eventContainer.ShouldAnimate = true;
            }
            else if (state == Globals.TelemetryAnimationState.Paused)
            {
                //Resume playing, so update start time to include the time this was paused
                localStartTime = DateTime.UtcNow;

                if (nextIndexDraw > 0)
                {
                    localStartTime -= eventContainer.events[nextIndexDraw].Time - eventContainer.events[eventContainer.events.Count - 1].Time;
                }

                state = Globals.TelemetryAnimationState.Playing;
                eventContainer.ShouldAnimate = true;
            }

            playSpeed = speed;
        }
Esempio n. 5
0
 public void Pause()
 {
     state = Globals.TelemetryAnimationState.Paused;
     eventContainer.ShouldAnimate = false;
 }