예제 #1
0
        public void Tick(LiveStandingsItem item, LiveTimingItemMode mode)
        {
            this.Item   = item;
            this.mode   = mode;
            this.Module = API.Instance.FindModule("LiveStandings") as LiveStandingsModule;

            if (Item == null)
            {
                LayoutRoot.Visibility = Visibility.Hidden;
                return;
            }

            LayoutRoot.Visibility = Visibility.Visible;

            UpdateWidget();
            if (Item.PositionImprovedTiming)
            {
                PositionImproved();
            }
            else if (Item.LapTimeImproved)
            {
                LapTimeImproved();
            }

            OldCarIdx = item.Driver.CarIndex;
            Item.PositionImprovedTiming = Item.LapTimeImproved = Item.PositionLostTiming = false;
        }
예제 #2
0
        public void FadeInTopSpeeds()
        {
            if (Active)
            {
                return;
            }

            module = (LiveStandingsModule)API.Instance.FindModule("LiveStandings");
            Mode   = SideBarMode.TopSpeed;
            SideBarTitle title = new SideBarTitle(ParentWindow);

            title.VerticalAlignment = VerticalAlignment.Top;
            LayoutRoot.Children.Add(title);
            elements.Add(title);
            title.FadeIn("TOP SPEEDS kph");

            List <LiveStandingsItem> query = module.OrderByTopSpeed();

            for (int i = 0; i < 10; i++)
            {
                LiveStandingsItem item = query[i];
                if (item.TopSpeed > 0)
                {
                    SpeedElement se = new SpeedElement(ParentWindow, SpeedElement.SpeedElementMode.TopSpeed);
                    se.VerticalAlignment = VerticalAlignment.Top;
                    se.Margin            = new Thickness(0, (i + 1) * 36, 0, 0);
                    LayoutRoot.Children.Add(se);
                    elements.Add(se);
                    se.FadeIn(i + 1, item, (i + 1) * 25);
                }
            }

            Active = true;
        }
예제 #3
0
        public void FadeIn(string title, LiveStandingsItem driver, int delay)
        {
            if (Active || driver == null)
            {
                return;
            }

            Active      = true;
            this.driver = driver;
            if (title.StartsWith("BEST"))
            {
                mode = LapTimeItemMode.Best;
            }
            else if (title.StartsWith("LAST"))
            {
                mode = LapTimeItemMode.Last;
            }
            else
            {
                return;
            }

            TitleText.Text = title;
            Tick();

            Thread t = new Thread(fadeInLater);

            t.Start(delay);
        }
예제 #4
0
        public void FadeIn(int pos, LiveStandingsItem driver, int delay)
        {
            if (Active || driver == null)
            {
                return;
            }

            Active = true;

            this.Driver           = driver;
            this.TopSpeedPosition = pos;
            if (pos == 1)
            {
                NumberLeader.Visibility = Visibility.Visible;
            }
            else
            {
                NumberLeader.Visibility = Visibility.Hidden;
            }

            Position.Text          = pos.ToString();
            ClassColorLeader.Color = ClassColorNormal.Color = driver.Driver.LicColor;
            ThreeLetterCode.Text   = driver.Driver.ThreeLetterCode;
            Speed.Text             = driver.TopSpeedKmh.ToString("0.0").Replace(',', '.');

            Thread t = new Thread(fadeInLater);

            t.Start(delay);
        }
예제 #5
0
        private void addDriverOverviewElement(LiveStandingsItem driver, int i)
        {
            DriverOverviewTitle title = new DriverOverviewTitle(ParentWindow);
            DriverOverviewStops stops = new DriverOverviewStops(ParentWindow);
            LapTimeElement      best  = new LapTimeElement(ParentWindow);
            LapTimeElement      last  = new LapTimeElement(ParentWindow);

            title.VerticalAlignment = VerticalAlignment.Top;
            stops.VerticalAlignment = VerticalAlignment.Top;
            best.VerticalAlignment  = VerticalAlignment.Top;
            last.VerticalAlignment  = VerticalAlignment.Top;

            elements.Add(title);
            elements.Add(stops);
            elements.Add(best);
            elements.Add(last);

            title.Margin = new Thickness(0, 0 + i * 180, 0, 0);
            stops.Margin = new Thickness(0, 36 + i * 180, 0, 0);
            best.Margin  = new Thickness(0, 72 + i * 180, 0, 0);
            last.Margin  = new Thickness(0, 108 + i * 180, 0, 0);

            LayoutRoot.Children.Add(title);
            LayoutRoot.Children.Add(stops);
            LayoutRoot.Children.Add(best);
            LayoutRoot.Children.Add(last);

            title.FadeIn(driver, 0 + i * 125);
            stops.FadeIn(driver, 25 + i * 125);
            best.FadeIn("BEST", driver, 50 + i * 125);
            last.FadeIn("LAST", driver, 75 + i * 125);
        }
예제 #6
0
        public void FadeIniRatingGains()
        {
            if (Active)
            {
                return;
            }

            module  = (LiveStandingsModule)API.Instance.FindModule("LiveStandings");
            drivers = (DriverModule)API.Instance.FindModule("DriverModule");
            Mode    = SideBarMode.iRating;
            SideBarTitle title = new SideBarTitle(ParentWindow);

            title.VerticalAlignment = VerticalAlignment.Top;
            LayoutRoot.Children.Add(title);
            elements.Add(title);
            title.FadeIn("LIVE iRATING GAINS");

            for (int i = 0; i < Math.Min(drivers.DriversCount, 22); i++)
            {
                LiveStandingsItem item = module.FindDriverByPos(i + 1);
                if (item != null)
                {
                    SpeedElement se = new SpeedElement(ParentWindow, SpeedElement.SpeedElementMode.iRating);
                    se.VerticalAlignment = VerticalAlignment.Top;
                    se.Margin            = new Thickness(0, (i + 1) * 36, 0, 0);
                    LayoutRoot.Children.Add(se);
                    elements.Add(se);
                    se.FadeIn(i + 1, item, (i + 1) * 25);
                }
            }

            Active = true;
        }
예제 #7
0
        public void FadeInBattleForPos(int pos, int count)
        {
            this.FirstPos = pos;
            this.Count    = count;

            module = (LiveStandingsModule)API.Instance.FindModule("LiveStandings");
            foreach (LiveStandingsItem item in module.Items)
            {
                item.PositionImprovedBattleFor = item.PositionLostBattleFor = false;
            }

            Mode   = SideBarMode.BattleForPosition;
            Active = true;
            SideBarTitle title = new SideBarTitle(ParentWindow);
            string       t     = "BATTLE FOR ";

            if (pos == 1)
            {
                t += "1st";
            }
            else if (pos == 2)
            {
                t += " 2nd";
            }
            else if (pos == 3)
            {
                t += " 3rd";
            }
            else
            {
                t += pos.ToString("0") + "th";
            }

            title.VerticalAlignment = VerticalAlignment.Top;
            LayoutRoot.Children.Add(title);
            elements.Add(title);
            title.FadeIn(t);

            int j = 1;

            for (int i = pos; i < pos + count; i++)
            {
                LiveStandingsItem item = module.FindDriverByPos(i);
                if (item == null)
                {
                    break;
                }

                BattleElement e = new BattleElement(ParentWindow, this, module);
                e.VerticalAlignment = VerticalAlignment.Top;
                elements.Add(e);
                LayoutRoot.Children.Add(e);
                e.Margin = new Thickness(0, j * 36, 0, 0);
                e.FadeIn(item, j * 25);

                j++;
            }
        }
예제 #8
0
        public void FadeInBattleForPos(int pos, int count)
        {
            this.FirstPos = pos;
            this.Count    = count;

            Active = true;
            Mode   = SideBarMode.BattleForPosition;
            SideBarTitle title = new SideBarTitle();
            string       t     = "BATTLE FOR ";

            if (pos == 1)
            {
                t += "1st";
            }
            else if (pos == 2)
            {
                t += " 2nd";
            }
            else if (pos == 3)
            {
                t += " 3rd";
            }
            else
            {
                t += pos.ToString("0") + "th";
            }

            title.VerticalAlignment = VerticalAlignment.Top;
            LayoutRoot.Children.Add(title);
            elements.Add(title);
            title.FadeIn(t);

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

            int j = 1;

            for (int i = pos; i < pos + count; i++)
            {
                LiveStandingsItem item = module.FindDriverByPos(i);
                if (item == null)
                {
                    break;
                }

                BattleElement e = new BattleElement(this, module);
                e.VerticalAlignment = VerticalAlignment.Top;
                elements.Add(e);
                LayoutRoot.Children.Add(e);
                e.Margin = new Thickness(0, j * 36, 0, 0);
                e.FadeIn(item, j * 25);

                j++;
            }
        }
예제 #9
0
        public void SpeedCompFadeIn(LiveStandingsItem driver1, LiveStandingsItem driver2)
        {
            if (!MyCanvas.Children.Contains(SpeedCompareWidget))
            {
                MyCanvas.Children.Add(SpeedCompareWidget);
            }

            SpeedCompareWidget.FadeIn(driver1, driver2);
        }
예제 #10
0
        public void SideBarFadeInDriverOverview(LiveStandingsItem driver1, LiveStandingsItem driver2)
        {
            if (!MyCanvas.Children.Contains(SideBar))
            {
                MyCanvas.Children.Add(SideBar);
            }

            SideBar.FadeInDriverOverview(driver1, driver2);
        }
예제 #11
0
        public void LapTimerLeftFadeIn(LiveStandingsItem driver)
        {
            if (!MyCanvas.Children.Contains(LapTimerLeft))
            {
                MyCanvas.Children.Add(LapTimerLeft);
            }

            LapTimerLeft.FadeIn(driver);
        }
예제 #12
0
 private void checkPits(RaceBarItem raceBarItem, LiveStandingsItem liveStandingsItem)
 {
     if (liveStandingsItem.InPits)
     {
         raceBarItem.PitText.Visibility = Visibility.Visible;
         raceBarItem.GapText.Visibility = Visibility.Hidden;
     }
     else
     {
         raceBarItem.PitText.Visibility = Visibility.Hidden;
         raceBarItem.GapText.Visibility = Visibility.Visible;
     }
 }
예제 #13
0
        public void Tick()
        {
            int carIdx = cam.FollowedDriver;

            if (carIdx < 0)
            {
                Application.Current.Dispatcher.Invoke(new Action(FadeOut));
                return;
            }

            float rpm = ((float[])Controller.TMTVO.Instance.Api.GetData("CarIdxRPM"))[carIdx];

            if (rpm < 0)
            {
                Application.Current.Dispatcher.Invoke(new Action(FadeOut));
                return;
            }

            LiveStandingsItem d = standings.FindDriver(carIdx);

            if (d == null)
            {
                Application.Current.Dispatcher.Invoke(new Action(FadeOut));
                return;
            }

            setSpeed((int)(d.SpeedKmh));
            setRev((int)rpm);
            prevGear = ((int[])Controller.TMTVO.Instance.Api.GetData("CarIdxGear"))[carIdx];

            prevPushToPass = false;                                                                                             // TODO get Push to pass value
            if (prevPushToPass && !pushToPass)
            {
                Application.Current.Dispatcher.BeginInvoke(new Action(fadeInP2P));
            }
            else if (!prevPushToPass && pushToPass)
            {
                Application.Current.Dispatcher.BeginInvoke(new Action(fadeOutP2P));
            }

            if (prevGear == 0 && canUpdateGear)
            {
                canUpdateGear = false;
                neutralCooldown.Start();
            }

            if (canUpdateGear)
            {
                updateGear();
            }
        }
예제 #14
0
        internal void FadeIn(LiveStandingsItem item, int delay)
        {
            if (Active || item == null)
            {
                return;
            }

            Driver = item;
            Active = true;

            Thread t = new Thread(fadeInLater);

            t.Start(delay);
        }
예제 #15
0
        public void FadeIn(LiveStandingsItem driver, int delay)
        {
            if (Active || driver == null)
            {
                return;
            }

            this.driver = driver;
            Active      = true;
            Tick();

            Thread t = new Thread(fadeInLater);

            t.Start(delay);
        }
예제 #16
0
        public bool Update(LiveStandingsItem item)
        {
            if (item == null)
            {
                return(false);
            }

            Position.Text   = item.PositionLive.ToString();
            TeamName.Text   = item.Driver.Car.CarName;
            Gap.Text        = item.GapTime.ToString("0.000"); // TODO get correct gap
            DriverName.Text = item.Driver.FullName;
            CarNumber.Text  = item.Driver.Car.CarNumber;

            return(true);
        }
예제 #17
0
        public void Tick()
        {
            LinkedListNode <LiveTimingItem> node = Items.First;

            for (int i = 1; i <= Module.Items.Count; i++)
            {
                int pos = 1;
                if (i > 1)
                {
                    pos = i + (pageIndex * 21);
                }

                LiveStandingsItem item    = Module.Items.Find(it => it.PositionLive == pos);
                LiveTimingItem    current = node.Value;
                current.Tick(item, Mode);

                node = node.Next;
                if (node == null)
                {
                    break;
                }
            }

            if (dummyActive)
            {
                UpadeDummies();
            }

            int j = (((pageIndex + 1) * 21) + 1 < Module.Items.Count) ? pageIndex + 1 : 0;

            if (pageIndex < j && canUpdateButtons)
            {
                nextPageButton.IsEnabled = true;
            }

            foreach (LiveTimingItem item in Items)
            {
                if (item.OldPosition == -1)
                {
                    item.Visibility = Visibility.Hidden;
                }
                else
                {
                    item.Visibility = Visibility.Visible;
                }
            }
        }
예제 #18
0
        public void FadeIn(LiveStandingsItem driver)
        {
            if (Active)
            {
                return;
            }

            this.LapDriver = driver;
            this.Active    = true;
            this.canUpdate = true;

            this.DriversName.Text   = driver.Driver.LastUpperName;
            this.DriversNumber.Text = driver.Driver.NumberPlateInt.ToString();
            this.NumberPlate.Fill   = new SolidColorBrush(driver.Driver.LicColor);

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

            sb.Begin();
        }
예제 #19
0
        private void UpadeDummies()
        {
            LinkedListNode <LiveTimingItem> node = Dummies.First;

            for (int i = 2; i <= Module.Items.Count; i++)
            {
                int pos = i + (dummyPageIndex * 21);

                LiveStandingsItem item    = Module.Items.Find(it => it.PositionLive == pos);
                LiveTimingItem    current = node.Value;
                current.Tick(item, Mode);

                node = node.Next;
                if (node == null)
                {
                    break;
                }
            }
        }
예제 #20
0
        public void FadeInDriverOverview(LiveStandingsItem driver1, LiveStandingsItem driver2)
        {
            if (driver1 == null && driver2 == null)
            {
                return;
            }

            this.Mode = SideBarMode.DriverOverView;
            Active    = true;
            if (driver1 != null)
            {
                addDriverOverviewElement(driver1, 0);
            }

            if (driver2 != null)
            {
                addDriverOverviewElement(driver2, 1);
            }
        }
예제 #21
0
        public void FadeInDriverOverview(LiveStandingsItem driver1, LiveStandingsItem driver2)
        {
            if (driver1 == null && driver2 == null)
            {
                return;
            }

            module    = (LiveStandingsModule)API.Instance.FindModule("LiveStandings");
            this.Mode = SideBarMode.DriverOverView;
            Active    = true;
            if (driver1 != null)
            {
                addDriverOverviewElement(driver1, 0);
            }

            if (driver2 != null)
            {
                addDriverOverviewElement(driver2, 1);
            }
        }
예제 #22
0
        private void SpeedCompare_Click(object sender, RoutedEventArgs e)
        {
            if (f1Window.SpeedCompareWidget.Active)
            {
                f1Window.SpeedCompFadeOut();
            }
            else
            {
                LiveStandingsModule m = (LiveStandingsModule)api.FindModule("LiveStandings");

                LiveStandingsItem driver1 = null;
                LiveStandingsItem driver2 = null;

                int carIdx = CameraModule.FollowedDriver;
                if (carIdx == -1)
                {
                    return;
                }

                if (SpeedCompMode.SelectedIndex == 0)
                {
                    driver1 = m.FindDriver(carIdx);
                    driver2 = m.FindDriverByPos(driver1.PositionLive + 1);
                }
                else
                {
                    driver2 = m.FindDriver(carIdx);
                    driver1 = m.FindDriverByPos(driver2.PositionLive - 1);
                }

                if (driver1 == null || driver2 == null)
                {
                    return;
                }

                f1Window.SpeedCompFadeIn(driver1, driver2);
            }
        }
예제 #23
0
        private void RevMeter_Click(object sender, RoutedEventArgs e)
        {
            if (f1Window.RevMeter.Active)
            {
                f1Window.RevMeterFadeOut();
            }
            else
            {
                int carIdx = CameraModule.FollowedDriver;
                if (carIdx == -1)
                {
                    return;
                }

                LiveStandingsItem driver = ((LiveStandingsModule)api.FindModule("LiveStandings")).FindDriver(carIdx);
                if (driver == null)
                {
                    return;
                }

                f1Window.RevMeterFadeIn();
            }
        }
예제 #24
0
        public void Tick(LiveStandingsItem item, LiveTimingItemMode mode)
        {
            this.Item = item;
            this.mode = mode;
            this.Module = F1TVOverlay.Controller.TMTVO.Instance.Api.FindModule("LiveStandings") as LiveStandingsModule;

            if (Item == null)
            {
                LayoutRoot.Visibility = Visibility.Hidden;
                return;
            }

            LayoutRoot.Visibility = Visibility.Visible;

            UpdateWidget();
            if (Item.PositionImproved)
                PositionImproved();
            else if (Item.LapTimeImproved)
                LapTimeImproved();

            OldCarIdx = item.Driver.CarIndex;
            Item.PositionImproved = Item.LapTimeImproved = Item.PositionLost = false;
        }
예제 #25
0
        public void FadeIn(LiveStandingsItem driver1, LiveStandingsItem driver2)
        {
            if (Active || driver1 == null || driver2 == null)
            {
                return;
            }

            Active       = true;
            this.driver1 = driver1;
            this.driver2 = driver2;

            DriversNumber1.Text = driver1.Driver.Car.CarNumber;
            DriversNumber2.Text = driver2.Driver.Car.CarNumber;

            DriversName1.Text = driver1.Driver.LastUpperName;
            DriversName2.Text = driver2.Driver.LastUpperName;

            NumberPlate1.Fill = new SolidColorBrush(driver1.Driver.LicColor);
            NumberPlate2.Fill = new SolidColorBrush(driver2.Driver.LicColor);

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

            sb.Begin();
        }
예제 #26
0
 public void Reset()
 {
     Active = false;
     Driver = null;
 }
예제 #27
0
 public void Reset()
 {
     driver = null;
     Active = false;
 }
예제 #28
0
        private void LoadPage(int pageIndex)
        {
            UIElementCollection items = Positions.Children;
            int j = 0;

            for (int i = pageIndex; i < pageIndex + 12; i++)
            {
                ResultsItem       item   = (ResultsItem)items[j++];
                int               pos    = j + (pageIndex * 12);
                LiveStandingsItem stItem = Module.Items.Find(it => it.Position == pos);
                if (stItem == null)
                {
                    item.Show = false;
                    continue;
                }

                item.Show = true;

                if (stItem.Position == 1)
                {
                    item.NumberLeader.Visibility = Visibility.Visible;
                }
                else
                {
                    item.NumberLeader.Visibility = Visibility.Hidden;
                }

                item.Position.Text      = stItem.Position.ToString();
                item.DriversNumber.Text = stItem.Driver.Car.CarNumber;
                item.DriverName.Text    = stItem.Driver.LastUpperName;
                item.TeamCarName.Text   = F1TVOverlay.Controller.TMTVO.Instance.Cars.GetValue(stItem.Driver.Car.CarName);
                item.NumberPlate.Fill   = new SolidColorBrush(stItem.Driver.LicColor);

                switch (Mode)
                {
                case ResultsMode.Practice:
                    item.FadeInColorP.Visibility = Visibility.Hidden;
                    item.PointsItem.Visibility   = Visibility.Hidden;

                    if (pos == 1)
                    {
                        item.Time.Text = stItem.FastestLapTimeSting;
                    }
                    else
                    {
                        float diff = stItem.FastestLapTime - Module.Leader.FastestLapTime;
                        if (diff < 0)
                        {
                            item.Time.Text = "No Time";
                        }
                        else
                        {
                            item.Time.Text = stItem.FastestLapTime.ConvertToTimeString();
                        }
                    }

                    break;

                case ResultsMode.Race:
                    item.FadeInColorP.Visibility = Visibility.Visible;
                    item.PointsItem.Visibility   = Visibility.Visible;

                    if (pos == 1)
                    {
                        item.Time.Text = "Winner";
                    }
                    else
                    {
                        if (stItem.GapLaps == 0)
                        {
                            item.Time.Text = "+" + stItem.GapTime.ConvertToTimeString();
                        }
                        else
                        {
                            item.Time.Text = "+" + stItem.GapLaps.ToString() + (stItem.GapLaps == 1 ? " Lap" : " Laps");
                        }
                    }

                    int points = getPoints(pos);
                    if (points <= 0)
                    {
                        item.PointsItem.Visibility   = Visibility.Hidden;
                        item.FadeInColorP.Visibility = Visibility.Hidden;
                    }
                    else
                    {
                        item.PointsItem.Visibility   = Visibility.Visible;
                        item.FadeInColorP.Visibility = Visibility.Visible;

                        if (points == 1)
                        {
                            item.Time1.Text = "1 pt";
                        }
                        else
                        {
                            item.Time1.Text = points + " pts";
                        }
                    }

                    break;

                default:
                    break;
                }
            }
        }
예제 #29
0
        private void LoadPage(int index, bool clearImprs)
        {
            if (index == 0)
            {
                oldMode = Mode;
            }

            UIElementCollection items = RaceBarBackground.Children;
            int j = 0;

            for (int i = index; i < index + 5; i++)
            {
                RaceBarItem       item   = (RaceBarItem)items[j++];
                int               pos    = j + (index * 5);
                LiveStandingsItem stItem = Module.Items.Find(it => it.PositionLive == pos);
                if (stItem == null)
                {
                    item.Show = false;
                    continue;
                }

                if (clearImprs)
                {
                    stItem.PositionImprovedRaceBar = stItem.PositionLostRaceBar = false;
                }

                item.Show = true;

                if (stItem.PositionLive == 1)
                {
                    item.NumberLeader.Visibility = Visibility.Visible;
                }
                else
                {
                    item.NumberLeader.Visibility = Visibility.Hidden;
                }

                item.Position.Text          = stItem.PositionLive.ToString();
                item.ClassColorLeader.Color = stItem.Driver.LicColor; // TODO ClassColor
                item.ClassColorNormal.Color = stItem.Driver.LicColor;

                /*
                 * if (stItem.PositionImprovedRaceBar)
                 * {
                 *  item.PositionImproved();
                 *  stItem.PositionImprovedRaceBar = false;
                 * }
                 *
                 * if (stItem.PositionLostRaceBar)
                 * {
                 *  item.PositionLost();
                 *  stItem.PositionLostRaceBar = false;
                 * }
                 */
                switch (oldMode)
                {
                case RaceBarMode.Gap:
                    item.ThreeLetterCode.Visibility = Visibility.Visible;
                    item.GapText.Visibility         = Visibility.Visible;
                    item.DriverName.Visibility      = Visibility.Hidden;

                    checkPits(item, stItem);

                    item.ThreeLetterCode.Text = stItem.Driver.ThreeLetterCode;
                    if (stItem.PositionLive == 1)
                    {
                        item.GapText.Text = "Leader";
                    }
                    else
                    {
                        if (stItem.GapLaps == 0)
                        {
                            if (Live)
                            {
                                item.GapText.Text = "+" + stItem.GapLiveLeader.ConvertToTimeString();
                            }
                            else
                            {
                                item.GapText.Text = "+" + stItem.GapTime.ConvertToTimeString();
                            }
                        }
                        else
                        {
                            item.GapText.Text = "+" + stItem.GapLaps.ToString() + (stItem.GapLaps == 1 ? " Lap" : " Laps");
                        }
                    }
                    break;

                case RaceBarMode.Interval:
                    item.ThreeLetterCode.Visibility = Visibility.Visible;
                    item.GapText.Visibility         = Visibility.Visible;
                    item.DriverName.Visibility      = Visibility.Hidden;

                    checkPits(item, stItem);

                    item.ThreeLetterCode.Text = stItem.Driver.ThreeLetterCode;
                    if (stItem.PositionLive == 1)
                    {
                        item.GapText.Text = "Interval";
                    }
                    else
                    {
                        float gap = 0;
                        if (Live)
                        {
                            gap = stItem.GapLive;
                        }
                        else
                        {
                            LiveStandingsItem stItem2 = Module.Items.Find(it => it.PositionLive == (j + (index * 5)) - 1);
                            gap = stItem.GapTime - stItem2.GapTime;
                        }

                        item.GapText.Text = "+" + gap.ConvertToTimeString();
                    }
                    break;

                case RaceBarMode.Name:
                    item.ThreeLetterCode.Visibility = Visibility.Hidden;
                    item.GapText.Visibility         = Visibility.Hidden;
                    item.PitText.Visibility         = Visibility.Hidden;
                    item.DriverName.Visibility      = Visibility.Visible;

                    item.DriverName.Text = stItem.Driver.LastUpperName;
                    break;

                default:
                    break;
                }
            }
        }
예제 #30
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;
            }
        }