Commit 57919ae9 authored by Matus Celko's avatar Matus Celko Committed by GitHub

4.3.0 (#45)

parent 67fac903
......@@ -2,10 +2,11 @@
{
using System;
using System.Collections.Generic;
using System.Linq;
using DataModel.BasicProperties;
using DataModel.Snapshot;
using DataModel.Snapshot.Drivers;
using DataModel.Snapshot.Systems;
using PluginManager.Extensions;
public class AcDataConverter
......@@ -61,11 +62,54 @@
// Acceleration
AddAcceleration(simData, acData);
//Add Additional Player Car Info
AddPlayerCarInfo(acData, simData);
_startObserver.Observe(simData);
return simData;
}
private void AddPlayerCarInfo(AssettoCorsaShared data, SimulatorDataSet simData)
{
CarInfo playerCar = simData.PlayerInfo.CarInfo;
playerCar.CarDamageInformation.Bodywork.MediumDamageThreshold = 0.02;
playerCar.CarDamageInformation.Bodywork.HeavyDamageThreshold = 0.2;
playerCar.CarDamageInformation.Bodywork.Damage = data.AcsPhysics.carDamage.Max() / 100.0;
playerCar.SpeedLimiterEngaged = simData.PlayerInfo.InPits;
FillDrsData(data, playerCar);
FillBoostData(data, playerCar);
}
private void FillBoostData(AssettoCorsaShared data, CarInfo playerCar)
{
BoostSystem boostSystem = playerCar.BoostSystem;
if (data.AcsPhysics.kersCharge <= 0)
{
return;
}
boostSystem.ActivationsRemaining = (int)(data.AcsPhysics.kersCharge * 100);
boostSystem.BoostStatus = data.AcsPhysics.ersIsCharging == 1 ? BoostStatus.Available : BoostStatus.InUse;
}
private void FillDrsData(AssettoCorsaShared data, CarInfo playerCar)
{
DrsSystem drsSystem = playerCar.DrsSystem;
if (data.AcsPhysics.drsEnabled == 1)
{
drsSystem.DrsStatus = DrsStatus.InUse;
return;
}
if (data.AcsPhysics.drsAvailable == 1)
{
drsSystem.DrsStatus = DrsStatus.Available;
}
}
private void FillPlayerCarInfo(AssettoCorsaShared acData, SimulatorDataSet simData)
{
FillPlayersGear(acData, simData);
......@@ -96,6 +140,11 @@
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.Rps = acData.AcsPhysics.wheelAngularSpeed[(int)AcWheels.RL];
simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.Rps = acData.AcsPhysics.wheelAngularSpeed[(int)AcWheels.FR];
simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.DirtLevel = acData.AcsPhysics.tyreDirtyLevel[(int)AcWheels.FL];
simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.DirtLevel = acData.AcsPhysics.tyreDirtyLevel[(int)AcWheels.FR];
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.DirtLevel = acData.AcsPhysics.tyreDirtyLevel[(int)AcWheels.RL];
simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.DirtLevel = acData.AcsPhysics.tyreDirtyLevel[(int)AcWheels.FR];
simData.PlayerInfo.CarInfo.FrontHeight = Distance.FromMeters(acData.AcsPhysics.rideHeight[0]);
......
......@@ -58,7 +58,7 @@
public bool TryConnect()
{
#if !DEBUG
#if! DEBUG
IsConnected = true;
Thread executionThread = new Thread(new ThreadStart(TestingThreadExecutor));
executionThread.IsBackground = true;
......
namespace SecondMonitor.PCars2Connector.DataConvertor
{
using System;
using System.Linq;
using DataModel.BasicProperties;
using DataModel.Snapshot;
using DataModel.Snapshot.Drivers;
using DataModel.Snapshot.Systems;
using SharedMemory;
using PluginManager.Extensions;
using PluginManager.GameConnector;
......@@ -41,6 +42,9 @@
// Tyre Pressure Info
AddTyresAndFuelInfo(pcarsData, simData);
//Add Additional Player Car Info
AddPlayerCarInfo(pcarsData, simData);
// Acceleration
AddAcceleration(pcarsData, simData);
......@@ -55,6 +59,33 @@
return simData;
}
private void AddPlayerCarInfo(PCars2SharedMemory data, SimulatorDataSet simData)
{
CarInfo playerCar = simData.PlayerInfo.CarInfo;
playerCar.CarDamageInformation.Bodywork.Damage = data.mAeroDamage;
playerCar.CarDamageInformation.Engine.Damage = data.mEngineDamage;
playerCar.CarDamageInformation.Suspension.Damage = data.mSuspensionDamage.Max();
/*playerCar.SpeedLimiterEngaged = (data.mCarFlags & (int)CarFlags.CarSpeedLimiter) == (int)CarFlags.CarSpeedLimiter;*/
FillBoostData(data, playerCar);
}
private void FillBoostData(PCars2SharedMemory data, CarInfo playerCar)
{
BoostSystem boostSystem = playerCar.BoostSystem;
if (data.mBoostAmount <= 0)
{
boostSystem.BoostStatus = BoostStatus.UnAvailable;
return;
}
boostSystem.ActivationsRemaining = (int) data.mBoostAmount;
boostSystem.BoostStatus = data.mBoostActive ? BoostStatus.InUse : BoostStatus.Available;
}
public void AddActiveFlags(PCars2SharedMemory pcarsData, SimulatorDataSet simData)
{
for (int i = 0; i < pcarsData.mNumParticipants; i++)
......@@ -123,6 +154,13 @@
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.SuspensionTravel = Distance.FromMeters(data.mSuspensionTravel[(int)WheelIndex.TyreRearLeft]);
simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.SuspensionTravel = Distance.FromMeters(data.mSuspensionTravel[(int)WheelIndex.TyreRearRight]);
int direDeflatedFlag = (int) TyreFlags.TyreAttached | (int) TyreFlags.TyreInflated;
simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.Detached = (data.mTyreFlags[(int)WheelIndex.TyreFrontLeft] & direDeflatedFlag) != direDeflatedFlag;
simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.Detached = (data.mTyreFlags[(int)WheelIndex.TyreFrontRight] & direDeflatedFlag) != direDeflatedFlag;
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.Detached = (data.mTyreFlags[(int)WheelIndex.TyreRearLeft] & direDeflatedFlag) != direDeflatedFlag;
simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.Detached = (data.mTyreFlags[(int)WheelIndex.TyreRearRight] & direDeflatedFlag) != direDeflatedFlag;
/*simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.RideHeight = Distance.FromMeters(data.mTyreHeightAboveGround[(int)WheelIndex.TyreFrontLeft]);
simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.RideHeight = Distance.FromMeters(data.mTyreHeightAboveGround[(int)WheelIndex.TyreFrontRight]);
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.RideHeight = Distance.FromMeters(data.mTyreHeightAboveGround[(int)WheelIndex.TyreRearLeft]);
......
......@@ -5,6 +5,7 @@
using DataModel.BasicProperties;
using DataModel.Snapshot;
using DataModel.Snapshot.Drivers;
using DataModel.Snapshot.Systems;
using PluginManager.GameConnector;
internal class R3EDataConvertor : AbstractDataConvertor
......@@ -102,8 +103,6 @@
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.TyrePressure.ActualQuantity = Pressure.FromKiloPascals(data.TirePressure.RearLeft);
simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.TyrePressure.ActualQuantity = Pressure.FromKiloPascals(data.TirePressure.RearRight);
simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.TyreWear.ActualWear = 1 - data.TireWear.FrontLeft;
simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.TyreWear.ActualWear = 1 - data.TireWear.FrontRight;
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.TyreWear.ActualWear = 1 - data.TireWear.RearLeft;
......@@ -114,6 +113,13 @@
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.Rps = -data.TireRps.RearLeft;
simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.Rps = -data.TireRps.RearRight;
simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.DirtLevel = data.TireDirt.FrontLeft;
simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.DirtLevel = data.TireDirt.FrontRight;
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.DirtLevel = data.TireDirt.RearLeft;
simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.DirtLevel = data.TireDirt.RearRight;
// Front Left Tyre Temps
simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.LeftTyreTemp.ActualQuantity = Temperature.FromCelsius(data.TireTemp.FrontLeft_Left);
simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.RightTyreTemp.ActualQuantity = Temperature.FromCelsius(data.TireTemp.FrontLeft_Right);
......@@ -348,6 +354,9 @@
// Acceleration
AddAcceleration(data, simData);
//Add Additional Player Car Info
AddPlayerCarInfo(data, simData);
//Add Flags Info
AddFlags(data, simData);
......@@ -356,6 +365,72 @@
return simData;
}
private void AddPlayerCarInfo(R3ESharedData data, SimulatorDataSet simData)
{
CarInfo playerCar = simData.PlayerInfo.CarInfo;
playerCar.CarDamageInformation.Bodywork.MediumDamageThreshold = 0.01;
playerCar.CarDamageInformation.Engine.MediumDamageThreshold = 0.01;
playerCar.CarDamageInformation.Transmission.MediumDamageThreshold = 0.01;
playerCar.CarDamageInformation.Bodywork.Damage = 1 - data.CarDamage.Aerodynamics;
playerCar.CarDamageInformation.Engine.Damage = 1 - data.CarDamage.Engine;
playerCar.CarDamageInformation.Transmission.Damage = 1 -data.CarDamage.Transmission;
playerCar.SpeedLimiterEngaged = data.PitLimiter == 1;
FillDrsData(data, playerCar);
FillBoostData(data.PushToPass, playerCar);
}
private static void FillDrsData(R3ESharedData data, CarInfo playerCar)
{
DrsSystem drsSystem = playerCar.DrsSystem;
drsSystem.DrsActivationLeft = data.Drs.NumActivationsLeft < 100 ? data.Drs.NumActivationsLeft : -1;
if (data.Drs.Equipped == 0)
{
drsSystem.DrsStatus = DrsStatus.NotEquipped;
return;
}
if (data.Drs.Engaged == 1)
{
drsSystem.DrsStatus = DrsStatus.InUse;
return;
}
if (data.Drs.Available == 1)
{
drsSystem.DrsStatus = DrsStatus.Available;
return;
}
drsSystem.DrsStatus = DrsStatus.Equipped;
}
private static void FillBoostData(PushToPass pushToPass, CarInfo playerCar)
{
BoostSystem boostSystem = playerCar.BoostSystem;
if (pushToPass.Available != 1)
{
boostSystem.BoostStatus = BoostStatus.UnAvailable;
return;
}
boostSystem.ActivationsRemaining = pushToPass.AmountLeft;
boostSystem.CooldownTimer = TimeSpan.FromSeconds(pushToPass.WaitTimeLeft);
boostSystem.TimeRemaining = TimeSpan.FromSeconds(pushToPass.EngagedTimeLeft);
if (pushToPass.Engaged == 1)
{
boostSystem.BoostStatus = BoostStatus.InUse;
return;
}
boostSystem.BoostStatus = boostSystem.CooldownTimer == TimeSpan.Zero ? BoostStatus.Available : BoostStatus.Cooldown;
}
private void AddFlags(R3ESharedData data, SimulatorDataSet simData)
{
if (data.SectorYellow.Sector1 == 1)
......
......@@ -6,6 +6,7 @@
using DataModel.BasicProperties;
using DataModel.Snapshot;
using DataModel.Snapshot.Drivers;
using DataModel.Snapshot.Systems;
using PluginManager.Extensions;
using PluginManager.GameConnector;
using PluginManager.Visitor;
......@@ -69,6 +70,9 @@
// Acceleration
AddAcceleration(simData, playerF2VehicleTelemetry);
//Add Additional Player Car Info
AddPlayerCarInfo(playerF2VehicleTelemetry, simData);
AddFlags(rfData, simData);
currentlyIgnoredPackage = 0;
......@@ -84,6 +88,32 @@
}
}
private void AddPlayerCarInfo(rF2VehicleTelemetry data, SimulatorDataSet simData)
{
CarInfo playerCar = simData.PlayerInfo.CarInfo;
int totalDent = data.mDentSeverity.Aggregate((x, y) => (byte)(x + y));
int maxDent = data.mDentSeverity.Max();
playerCar.CarDamageInformation.Bodywork.Damage = totalDent / 16.0;
if (maxDent == 1)
{
playerCar.CarDamageInformation.Bodywork.MediumDamageThreshold = playerCar.CarDamageInformation.Bodywork.Damage;
}
else if (maxDent == 2)
{
playerCar.CarDamageInformation.Bodywork.MediumDamageThreshold = 0;
playerCar.CarDamageInformation.Bodywork.HeavyDamageThreshold = playerCar.CarDamageInformation.Bodywork.Damage;
}
if (data.mOverheating == 1)
{
playerCar.CarDamageInformation.Engine.Damage = 1;
}
playerCar.SpeedLimiterEngaged = data.mSpeedLimiter == 1;
}
private void AddFlags(Rf2FullData rfData, SimulatorDataSet simData)
{
if ((rFactor2Constants.rF2GamePhase)rfData.scoring.mScoringInfo.mGamePhase == rFactor2Constants.rF2GamePhase.FullCourseYellow)
......@@ -126,6 +156,11 @@
simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.TyrePressure.ActualQuantity =
Pressure.FromKiloPascals(playerVehicleTelemetry.mWheels[(int)rFactor2Constants.rF2WheelIndex.RearRight].mPressure);
simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.Detached = playerVehicleTelemetry.mWheels[(int)rFactor2Constants.rF2WheelIndex.FrontLeft].mDetached == 1 || playerVehicleTelemetry.mWheels[(int)rFactor2Constants.rF2WheelIndex.FrontLeft].mFlat == 1;
simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.Detached = playerVehicleTelemetry.mWheels[(int)rFactor2Constants.rF2WheelIndex.FrontRight].mDetached == 1 || playerVehicleTelemetry.mWheels[(int)rFactor2Constants.rF2WheelIndex.FrontRight].mFlat == 1;
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.Detached = playerVehicleTelemetry.mWheels[(int)rFactor2Constants.rF2WheelIndex.RearLeft].mDetached == 1 || playerVehicleTelemetry.mWheels[(int)rFactor2Constants.rF2WheelIndex.RearLeft].mFlat == 1;
simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.Detached = playerVehicleTelemetry.mWheels[(int)rFactor2Constants.rF2WheelIndex.RearRight].mDetached == 1 || playerVehicleTelemetry.mWheels[(int)rFactor2Constants.rF2WheelIndex.RearRight].mFlat == 1;
simData.PlayerInfo.CarInfo.RearHeight = Distance.FromMeters(playerVehicleTelemetry.mRearRideHeight);
simData.PlayerInfo.CarInfo.FrontHeight = Distance.FromMeters(playerVehicleTelemetry.mFrontWingHeight);
......
......@@ -5,6 +5,7 @@
using DataModel.BasicProperties;
using DataModel.Snapshot;
using DataModel.Snapshot.Drivers;
using DataModel.Snapshot.Systems;
using PluginManager.Extensions;
internal class RFDataConvertor
......@@ -48,12 +49,40 @@
// Acceleration
AddAcceleration(rfData, simData);
//Add Additional Player Car Info
AddPlayerCarInfo(rfData, simData);
AddFlags(rfData, simData);
currentlyIgnoredPackage = 0;
return simData;
}
private void AddPlayerCarInfo(RfShared data, SimulatorDataSet simData)
{
CarInfo playerCar = simData.PlayerInfo.CarInfo;
int totalDent = data.DentSeverity.Aggregate((x, y) => (byte)(x + y));
int maxDent = data.DentSeverity.Max();
playerCar.CarDamageInformation.Bodywork.Damage = totalDent / 16.0;
if (maxDent == 1)
{
playerCar.CarDamageInformation.Bodywork.MediumDamageThreshold = playerCar.CarDamageInformation.Bodywork.Damage;
}else if (maxDent == 2)
{
playerCar.CarDamageInformation.Bodywork.MediumDamageThreshold = 0;
playerCar.CarDamageInformation.Bodywork.HeavyDamageThreshold = playerCar.CarDamageInformation.Bodywork.Damage;
}
if (data.Overheating == 1)
{
playerCar.CarDamageInformation.Engine.Damage = 1;
}
playerCar.SpeedLimiterEngaged = false;
}
private void AddFlags(RfShared rfData, SimulatorDataSet simData)
{
if ((RfGamePhase) rfData.GamePhase == RfGamePhase.FullCourseYellow)
......@@ -92,7 +121,10 @@
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.TyrePressure.ActualQuantity = Pressure.FromKiloPascals(data.Wheel[(int)RfWheelIndex.RearLeft].Pressure);
simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.TyrePressure.ActualQuantity = Pressure.FromKiloPascals(data.Wheel[(int)RfWheelIndex.RearRight].Pressure);
simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.Detached = data.Wheel[(int) RfWheelIndex.FrontLeft].Detached == 1 || data.Wheel[(int)RfWheelIndex.FrontLeft].Flat == 1;
simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.Detached = data.Wheel[(int)RfWheelIndex.FrontRight].Detached == 1 || data.Wheel[(int)RfWheelIndex.FrontRight].Flat == 1;
simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.Detached = data.Wheel[(int)RfWheelIndex.RearLeft].Detached == 1 || data.Wheel[(int)RfWheelIndex.RearLeft].Flat == 1;
simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.Detached = data.Wheel[(int)RfWheelIndex.RearRight].Detached == 1 || data.Wheel[(int)RfWheelIndex.RearRight].Flat == 1;
simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.TyreWear.ActualWear = 1 - data.Wheel[(int)RfWheelIndex.FrontLeft].Wear;
simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.TyreWear.ActualWear = 1 - data.Wheel[(int)RfWheelIndex.FrontRight].Wear;
......
namespace SecondMonitor.DataModel.BasicProperties
{
public enum BoostStatus
{
UnAvailable, Available, InUse, Cooldown
}
}
\ No newline at end of file
namespace SecondMonitor.DataModel.BasicProperties
{
using System;
[Serializable]
public class DamageInformation
{
public DamageInformation()
{
Damage = 0;
MediumDamageThreshold = 0.05;
HeavyDamageThreshold = 0.25;
}
public double Damage { get; set; }
public double MediumDamageThreshold { get; set; }
public double HeavyDamageThreshold { get; set; }
}
}
\ No newline at end of file
namespace SecondMonitor.DataModel.BasicProperties
{
public enum DrsStatus
{
NotEquipped, Equipped, Available, InUse
}
}
\ No newline at end of file
......@@ -49,9 +49,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BasicProperties\Acceleration.cs" />
<Compile Include="BasicProperties\BoostStatus.cs" />
<Compile Include="BasicProperties\ColorDTO.cs" />
<Compile Include="BasicProperties\DamageInformation.cs" />
<Compile Include="BasicProperties\Distance.cs" />
<Compile Include="BasicProperties\DistanceUnits.cs" />
<Compile Include="BasicProperties\DrsStatus.cs" />
<Compile Include="BasicProperties\FlagKind.cs" />
<Compile Include="BasicProperties\FuelCalculationScope.cs" />
<Compile Include="BasicProperties\FuelConsumption\FuelPerDistance.cs" />
......@@ -83,6 +86,8 @@
<Compile Include="Snapshot\ISimulatorDateSetVisitor.cs" />
<Compile Include="Snapshot\SessionPhase.cs" />
<Compile Include="BasicProperties\SessionType.cs" />
<Compile Include="Snapshot\Systems\BoostSystem.cs" />
<Compile Include="Snapshot\Systems\CarDamageInformation.cs" />
<Compile Include="Snapshot\Systems\CarInfo.cs" />
<Compile Include="Snapshot\DataInputSupport.cs" />
<Compile Include="Snapshot\DatamodelSerializerHelper.cs" />
......@@ -91,6 +96,7 @@
<Compile Include="Snapshot\Drivers\DriverTimingInfo.cs" />
<Compile Include="Snapshot\SessionInfo.cs" />
<Compile Include="Snapshot\SimulatorDataSet.cs" />
<Compile Include="Snapshot\Systems\DrsSystem.cs" />
<Compile Include="Snapshot\Systems\FuelInfo.cs" />
<Compile Include="Snapshot\Systems\OilInfo.cs" />
<Compile Include="BasicProperties\Pressure.cs" />
......
......@@ -12,6 +12,8 @@ namespace SecondMonitor.DataModel.Snapshot.Drivers
[DebuggerDisplay("Driver Name: {DriverName}")]
public sealed class DriverInfo : IDriverInfo
{
private CarInfo _carInfo;
public DriverInfo()
{
......@@ -49,7 +51,11 @@ namespace SecondMonitor.DataModel.Snapshot.Drivers
public DriverFinishStatus FinishStatus { get; set; } = DriverFinishStatus.Na;
public CarInfo CarInfo { get; set; } = new CarInfo();
public CarInfo CarInfo
{
get => _carInfo ?? (_carInfo = new CarInfo());
set => _carInfo = value;
}
public DriverTimingInfo Timing { get; set; } = new DriverTimingInfo();
......
namespace SecondMonitor.DataModel.Snapshot.Systems
{
using System;
using BasicProperties;
[Serializable]
public class BoostSystem
{
public BoostStatus BoostStatus { get; set; } = BoostStatus.UnAvailable;
public TimeSpan CooldownTimer { get; set; } = TimeSpan.Zero;
public TimeSpan TimeRemaining { get; set; } = TimeSpan.Zero;
public int ActivationsRemaining { get; set; } = -1;
}
}
\ No newline at end of file
namespace SecondMonitor.DataModel.Snapshot.Systems
{
using System;
using BasicProperties;
[Serializable]
public class CarDamageInformation
{
public CarDamageInformation()
{
Engine = new DamageInformation();
Transmission = new DamageInformation();
Suspension = new DamageInformation();
Bodywork = new DamageInformation();
}
public DamageInformation Engine { get; set; }
public DamageInformation Transmission { get; set; }
public DamageInformation Suspension { get; set; }
public DamageInformation Bodywork { get; set; }
}
}
\ No newline at end of file
......@@ -17,8 +17,13 @@
FrontHeight = Distance.ZeroDistance;
RearHeight = Distance.ZeroDistance;
TurboPressure = Pressure.Zero;
CarDamageInformation = new CarDamageInformation();
DrsSystem = new DrsSystem();
BoostSystem = new BoostSystem();
}
public CarDamageInformation CarDamageInformation { get; set; }
public Wheels WheelsInfo { get; set; }
public OilInfo OilSystemInfo { get; set; }
......@@ -35,6 +40,12 @@
public Pressure TurboPressure { get; set; }
public bool SpeedLimiterEngaged { get; set; }
public DrsSystem DrsSystem { get; set; }
public BoostSystem BoostSystem { get; set; }
[XmlAttribute]
public string CurrentGear { get; set; } = string.Empty;
......
namespace SecondMonitor.DataModel.Snapshot.Systems
{
using System;
using BasicProperties;
[Serializable]
public class DrsSystem
{
public DrsStatus DrsStatus { get; set; }
public int DrsActivationLeft { get; set; } = -1;
}
}
\ No newline at end of file
......@@ -68,6 +68,10 @@
public TyreWear TyreWear { get; set; }
public bool Detached { get; set; }
public double DirtLevel { get; set; } = 0;
public OptimalQuantity<Temperature> LeftTyreTemp { get; set; }
public OptimalQuantity<Temperature> RightTyreTemp{ get; set; }
......
namespace SecondMonitor.DataModel.Snapshot.Systems
{
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
[Serializable]
public sealed class Wheels
......@@ -13,6 +15,9 @@
RearLeft = new WheelInfo();
}
[XmlIgnore]
public WheelInfo[] AllWheels => new WheelInfo[] { FrontLeft, FrontRight, RearLeft, RearRight };
public WheelInfo FrontLeft { get; set; }
public WheelInfo FrontRight { get; set; }
......
......@@ -17,13 +17,14 @@
private FuelOverviewViewModel _fuelOverviewViewModel;
private FuelPlannerViewModel _fuelPlannerViewModel;
private CarSystemsViewModel _carSystemsViewModel;
private DashboardViewModel _dashboardViewModel;
private bool _isFuelCalculatorShown;
private PedalsAndGearViewModel _pedalAndGearViewModel;
public CarStatusViewModel(IPaceProvider paceProvider)
{
_viewModels = new SimulatorDSViewModels { new OilTemperatureViewModel(), new WaterTemperatureViewModel(), new CarWheelsViewModel(), new FuelOverviewViewModel(paceProvider), new PedalsAndGearViewModel(), new CarSystemsViewModel()};
_viewModels = new SimulatorDSViewModels { new OilTemperatureViewModel(), new WaterTemperatureViewModel(), new CarWheelsViewModel(), new FuelOverviewViewModel(paceProvider), new PedalsAndGearViewModel(), new CarSystemsViewModel(), new DashboardViewModel()};
_fuelPlannerViewModelFactory = new FuelPlannerViewModelFactory();;
RefreshProperties();
}
......@@ -76,6 +77,12 @@
private set => SetProperty(ref _carSystemsViewModel, value);
}
public DashboardViewModel DashboardViewModel
{
get => _dashboardViewModel;
set => SetProperty(ref _dashboardViewModel, value);
}
public void ApplyDateSet(SimulatorDataSet dataSet)
{
_viewModels.ApplyDateSet(dataSet);
......@@ -114,7 +121,7 @@
FuelOverviewViewModel = _viewModels.GetFirst<FuelOverviewViewModel>();
PedalsAndGearViewModel = _viewModels.GetFirst<PedalsAndGearViewModel>();
CarSystemsViewModel = _viewModels.GetFirst<CarSystemsViewModel>();
DashboardViewModel = _viewModels.GetFirst<DashboardViewModel>();
}
}
}
\ No newline at end of file
namespace SecondMonitor.ViewModels.CarStatus
{
using System;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using DataModel.BasicProperties;
using DataModel.Extensions;
using DataModel.Snapshot;
using DataModel.Snapshot.Drivers;
using DataModel.Snapshot.Systems;
using StatusIcon;
public class DashboardViewModel : AbstractViewModel, ISimulatorDataSetViewModel
{
private readonly Stopwatch _refreshStopwatch;
public DashboardViewModel()
{
_refreshStopwatch = Stopwatch.StartNew();
EngineStatus = new StatusIconViewModel();
TransmissionStatus = new StatusIconViewModel();
SuspensionStatus = new StatusIconViewModel();
BodyworkStatus = new StatusIconViewModel();
PitLimiterStatus = new StatusIconViewModel();
AlternatorStatus = new StatusIconViewModel();
TyreDirtStatus = new StatusIconViewModel();