protected void InPitsV2(SdkWrapper.TelemetryUpdatedEventArgs e) { engineWarning = Int32.Parse(sessionWrapper.GetData("EngineWarnings").ToString()); var onPitRoad = Convert.ToBoolean(sessionWrapper.GetData("OnPitRoad")); var ontrack = Convert.ToBoolean(e.TelemetryInfo.IsOnTrack.Value); if ((onPitRoad && initForFuel) || (ontrack && initForFuel)) { initForFuel = false; } if (engineWarning == 16 || engineWarning == 48) //16 = pit limiter { sessionForm.Pit_Limiter_title.Visible = onPitRoad ? true : false; sessionForm.speed_limiter.Visible = true; sessionForm.Pit_limiter_background_panel.Visible = true; } else { sessionForm.Pit_Limiter_title.Visible = onPitRoad ? true : false; sessionForm.Pit_Limiter_title.Visible = false; sessionForm.Pit_limiter_background_panel.Visible = false; } }
public void UpdateLapTimeV2(SdkWrapper.TelemetryUpdatedEventArgs e) { var lapObject = _wrapper.GetData("LapCurrentLapTime"); var lap = Convert.ToDouble(lapObject); int min = (int)(lap / 60); double sec = (lap % 60); string laptime; laptime = string.Format("{0:00}:{1:00.000}", min, sec); _dashForm.Laptime_value.Text = laptime; }
private void CarBehindRelativeSpeedCheck(SdkWrapper.TelemetryUpdatedEventArgs e) { if (_drivers.Count > 2 && Sim.Instance.Driver != null) { Dictionary <Driver, float> driversAndPositons = new Dictionary <Driver, float>(); List <Driver> activeDrivers = _drivers.ToList(); if (e.TelemetryInfo.CarIdxLapDistPct.Value != null) { List <float> posList = e.TelemetryInfo.CarIdxLapDistPct.Value.ToList(); //This info should be in Driver.Live.TrackSurface but it isn't showing up most of the time TrackSurfaces[] driversTrackSurfaces = (TrackSurfaces[])wrapper.GetData("CarIdxTrackSurface"); foreach (Driver driver in activeDrivers) { if (((driversTrackSurfaces[driver.Id] != TrackSurfaces.InPitStall) && (driversTrackSurfaces[driver.Id] != TrackSurfaces.NotInWorld) && (driversTrackSurfaces[driver.Id] != TrackSurfaces.AproachingPits) | driver == Sim.Instance.Driver)) //Was getting duplicate entries for some reason. { driversAndPositons.Add(driver, posList[driver.Id]); } } if (driversAndPositons != null && driversAndPositons.Count > 2) { var driversAndPositonsOrdered = (from pair in driversAndPositons orderby pair.Value descending select pair).ToList(); //Need to not include people on pit road. int driverPos = driversAndPositonsOrdered.FindIndex(u => u.Key == Sim.Instance.Driver); int yourClassSpeed = Sim.Instance.Driver.Car.CarClassRelSpeed; if (driversAndPositonsOrdered.ElementAt(driversAndPositonsOrdered.Count - 1).Key == Sim.Instance.Driver) // If you are the most recent one to cross the S/F line get the next person who will cross the S/F. { Driver driverBehind = driversAndPositonsOrdered.ElementAt(0).Key; int driverBehindClassSpeed = driverBehind.Car.CarClassRelSpeed; if (yourClassSpeed < driverBehindClassSpeed && (1 + Sim.Instance.Driver.Live.LapDistance) - driverBehind.Live.LapDistance <= _trackDistPctFromKM) { FastClassApproachingIndicator1.Fill = classWarningColor; } else { FastClassApproachingIndicator1.Fill = Brushes.Transparent; } } else if (driversAndPositonsOrdered.Count > driverPos + 1) //Check if there is a driver behind you. { Driver driverBehind = driversAndPositonsOrdered.ElementAt(driverPos + 1).Key; int driverBehindClassSpeed = driverBehind.Car.CarClassRelSpeed; if (yourClassSpeed < driverBehindClassSpeed && (Sim.Instance.Driver.Live.LapDistance - driverBehind.Live.LapDistance <= _trackDistPctFromKM && Sim.Instance.Driver.Live.LapDistance - driverBehind.Live.LapDistance > 0)) { FastClassApproachingIndicator1.Fill = classWarningColor; } else { FastClassApproachingIndicator1.Fill = Brushes.Transparent; } } else { FastClassApproachingIndicator1.Fill = Brushes.Transparent; } } driversAndPositons = null; } } }