public void Tick()
        {
            int improvement = GridModule.FindDriverStatic(driver.Driver.CarIndex).Position - driver.PositionLive;

            if (improvement < 0)
            {
                Improved.Text       = (-improvement).ToString("0");
                ImprovedBg.Fill     = lostBrush;
                ImpAngle.Angle      = lostAngle;
                ImpTriangle.Fill    = blackBrush;
                Improved.Foreground = blackBrush;
            }
            else if (improvement == 0)
            {
                Improved.Text       = "0";
                ImprovedBg.Fill     = neutralBrush;
                ImpAngle.Angle      = neutralAngle;
                ImpTriangle.Fill    = whiteBrush;
                Improved.Foreground = whiteBrush;
            }
            else
            {
                Improved.Text       = improvement.ToString("0");
                ImprovedBg.Fill     = improvedBrush;
                ImpAngle.Angle      = improvedAngle;
                ImpTriangle.Fill    = whiteBrush;
                Improved.Foreground = whiteBrush;
            }

            if (driver.GapLaps > 0)
            {
                if (driver.GapLaps == 1)
                {
                    Gap.Text = "+1 Lap";
                }
                else
                {
                    Gap.Text = "+" + driver.GapLaps.ToString("0") + " Laps";
                }
            }
            else
            {
                if (driver.PositionLive == 1)
                {
                    Gap.Text = "Leader";
                }
                else
                {
                    Gap.Text = "+" + driver.GapLiveLeader.ConvertToTimeString();
                }
            }
        }
Beispiel #2
0
        public void FadeIn(DriverInfoMode mode)
        {
            if (cameraModule == null)
            {
                cameraModule = TMTVO.Controller.TMTVO.Instance.Api.FindModule("CameraModule") as CameraModule;
            }

            if (standingsModule == null)
            {
                standingsModule = TMTVO.Controller.TMTVO.Instance.Api.FindModule("LiveStandings") as LiveStandingsModule;
            }

            if (sessionTimer == null)
            {
                sessionTimer = TMTVO.Controller.TMTVO.Instance.Api.FindModule("SessionTimer") as SessionTimerModule;
            }

            if (Active)
            {
                return;
            }

            int camIndex = cameraModule.FollowedDriver;

            driver = standingsModule.FindDriver(camIndex);
            if (driver == null)
            {
                return;
            }

            Active    = true;
            this.mode = mode;

            DriversName.Text   = driver.Driver.LastUpperName;
            TeamCarName.Text   = Controller.TMTVO.Instance.Cars.GetValue(driver.Driver.Car.CarName);
            DriversNumber.Text = driver.Driver.Car.CarNumber;
            NumberPlate.Fill   = new SolidColorBrush(driver.Driver.LicColor);

            Storyboard sb = FindResource("FadeInName") as Storyboard;

            sb.Begin();

            if (mode != DriverInfoMode.NameOnly)
            {
                int position = 0;
                if (mode == DriverInfoMode.QualiTimeOnly || mode == DriverInfoMode.QualiTimeWithGap)
                {
                    position = GridModule.FindDriverStatic(driver).Position;
                }
                else
                {
                    position = driver.PositionLive;
                }

                if (position == 1)
                {
                    BackgroundLeader.Visibility = Visibility.Visible;
                }
                else
                {
                    BackgroundLeader.Visibility = Visibility.Hidden;
                }

                Position.Text = position.ToString("0");
                (FindResource("FadeInPosition") as Storyboard).Begin();
                pActive = true;
            }

            if (mode == DriverInfoMode.Improvements)
            {
                BestTime.Text = driver.FastestLapTime.ConvertToTimeString();
                LastTime.Text = driver.LastLapTime.ConvertToTimeString();

                int improvement = GridModule.FindDriverStatic(camIndex).Position - driver.PositionLive;
                if (improvement < 0)
                {
                    Improvement.Text = (-improvement).ToString("0");
                    ImpAngle.Angle   = lostAngle;
                    ImpTriangle.Fill = lostBrush;
                }
                else if (improvement == 0)
                {
                    Improvement.Text = "0";
                    ImpAngle.Angle   = neutralAngle;
                    ImpTriangle.Fill = neutralBrush;
                }
                else
                {
                    Improvement.Text = improvement.ToString("0");
                    ImpAngle.Angle   = improvedAngle;
                    ImpTriangle.Fill = improvedBrush;
                }

                (FindResource("FadeInImprovements") as Storyboard).Begin();
                bActive = true;
            }

            if (mode == DriverInfoMode.FastestLapTimeOnly || mode == DriverInfoMode.FastestLapTimeWithGap || mode == DriverInfoMode.QualiTimeOnly || mode == DriverInfoMode.QualiTimeWithGap)
            {
                FastestTime.Text = ((mode == DriverInfoMode.QualiTimeOnly || mode == DriverInfoMode.QualiTimeWithGap) ? GridModule.FindDriverStatic(camIndex).QualiTime : driver.FastestLapTime).ConvertToTimeString();
                (FindResource("FadeInFastestLap") as Storyboard).Begin();
                fActive = true;
            }

            if (mode == DriverInfoMode.FastestLapTimeWithGap || mode == DriverInfoMode.QualiTimeWithGap)
            {
                if (mode == DriverInfoMode.FastestLapTimeWithGap)
                {
                    Gap.Text = "+" + (driver.FastestLapTime - standingsModule.Leader.FastestLapTime).ConvertToTimeString();
                }
                else
                {
                    Gap.Text = "+" + (GridModule.FindDriverStatic(camIndex).QualiTime - GridModule.GetLeader().QualiTime).ConvertToTimeString();
                }

                (FindResource("FadeInGap") as Storyboard).Begin();
                gActive = true;
            }
        }
Beispiel #3
0
        public void Tick()
        {
            int index = cameraModule.FollowedDriver;
            LiveStandingsItem driver = standingsModule.FindDriver(index);

            if (driver == null)
            {
                FadeOut();
                return;
            }

            DriversName.Text   = driver.Driver.LastUpperName;
            TeamCarName.Text   = Controller.TMTVO.Instance.Cars.GetValue(driver.Driver.Car.CarName);
            DriversNumber.Text = driver.Driver.Car.CarNumber;
            NumberPlate.Fill   = new SolidColorBrush(driver.Driver.LicColor);

            if (pActive)
            {
                int position = 0;
                if (mode == DriverInfoMode.QualiTimeOnly || mode == DriverInfoMode.QualiTimeWithGap)
                {
                    position = GridModule.FindDriverStatic(driver).Position;
                }
                else
                {
                    position = driver.PositionLive;
                }

                if (position == 1)
                {
                    BackgroundLeader.Visibility = Visibility.Visible;
                }
                else
                {
                    BackgroundLeader.Visibility = Visibility.Hidden;
                }

                Position.Text = position.ToString("0");
            }

            if (fActive)
            {
                if (mode == DriverInfoMode.FastestLapTimeOnly || mode == DriverInfoMode.FastestLapTimeWithGap)
                {
                    FastestTime.Text = driver.FastestLapTime.ConvertToTimeString();
                }
                else if (mode == DriverInfoMode.QualiTimeOnly || mode == DriverInfoMode.QualiTimeWithGap)
                {
                    FastestTime.Text = GridModule.FindDriverStatic(driver).QualiTime.ConvertToTimeString();
                }
            }

            if (gActive)
            {
                if (mode == DriverInfoMode.FastestLapTimeWithGap)
                {
                    if ((sessionTimer.SessionType == SessionType.LapRace || sessionTimer.SessionType == SessionType.TimeRace) && (sessionTimer.SessionState == SessionState.Racing || sessionTimer.SessionState == SessionState.Checkered || sessionTimer.SessionState == SessionState.Cooldown))
                    {
                        if (driver.GapLaps == 0)
                        {
                            Gap.Text = "+" + driver.GapTime.ConvertToTimeString();
                        }
                        else if (driver.GapLive == 1)
                        {
                            Gap.Text = "+1 Lap";
                        }
                        else
                        {
                            Gap.Text = "+" + driver.GapLaps.ToString("0") + " Laps";
                        }
                    }
                    else
                    {
                        Gap.Text = "+" + (driver.FastestLapTime - standingsModule.Leader.FastestLapTime).ConvertToTimeString();
                    }
                }
                else
                {
                    Gap.Text = "+" + (GridModule.FindDriverStatic(driver).QualiTime - GridModule.GetLeader().QualiTime).ConvertToTimeString();
                }
            }

            if (bActive)
            {
                BestTime.Text = driver.FastestLapTime.ConvertToTimeString();
                LastTime.Text = driver.LastLapTime.ConvertToTimeString();

                int improvement = GridModule.FindDriverStatic(driver).Position - driver.PositionLive;
                if (improvement < 0)
                {
                    Improvement.Text = (-improvement).ToString("0");
                    ImpAngle.Angle   = lostAngle;
                    ImpTriangle.Fill = lostBrush;
                }
                else if (improvement == 0)
                {
                    Improvement.Text = "0";
                    ImpAngle.Angle   = neutralAngle;
                    ImpTriangle.Fill = neutralBrush;
                }
                else
                {
                    Improvement.Text = improvement.ToString("0");
                    ImpAngle.Angle   = improvedAngle;
                    ImpTriangle.Fill = improvedBrush;
                }
            }
        }