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; }
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; }
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); }
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); }
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); }
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; }
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++; } }
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++; } }
public void SpeedCompFadeIn(LiveStandingsItem driver1, LiveStandingsItem driver2) { if (!MyCanvas.Children.Contains(SpeedCompareWidget)) { MyCanvas.Children.Add(SpeedCompareWidget); } SpeedCompareWidget.FadeIn(driver1, driver2); }
public void SideBarFadeInDriverOverview(LiveStandingsItem driver1, LiveStandingsItem driver2) { if (!MyCanvas.Children.Contains(SideBar)) { MyCanvas.Children.Add(SideBar); } SideBar.FadeInDriverOverview(driver1, driver2); }
public void LapTimerLeftFadeIn(LiveStandingsItem driver) { if (!MyCanvas.Children.Contains(LapTimerLeft)) { MyCanvas.Children.Add(LapTimerLeft); } LapTimerLeft.FadeIn(driver); }
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; } }
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(); } }
internal void FadeIn(LiveStandingsItem item, int delay) { if (Active || item == null) { return; } Driver = item; Active = true; Thread t = new Thread(fadeInLater); t.Start(delay); }
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); }
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); }
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; } } }
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(); }
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; } } }
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); } }
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); } }
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); } }
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(); } }
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; }
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(); }
public void Reset() { Active = false; Driver = null; }
public void Reset() { driver = null; Active = false; }
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; } } }
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; } } }
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; } }