public ReplayControl(SessionData sessionData, Incidents incidents, RemovalEdits removalEdits, TrackCameras trackCameras) { var cameras = trackCameras.Where(tc => tc.TrackName == sessionData.WeekendInfo.TrackDisplayName).ToArray(); TraceInfo.WriteLineIf(cameras.Count() <= 0, "Track Cameras not defined for {0}", sessionData.WeekendInfo.TrackDisplayName); Debug.Assert(cameras.Count() > 0, "Track Cameras not defined for {0}".F(sessionData.WeekendInfo.TrackDisplayName)); foreach (var tc in cameras) { tc.CameraNumber = (short)sessionData.CameraInfo.Groups.First(g => g.GroupName.ToLower() == tc.CameraName.ToLower()).GroupNum; } var camera = cameras.First(tc => tc.IsRaceStart); var cameraControl = new CameraControl(cameras); cameraControl.CameraOnPositon(1, camera.CameraNumber); var battleMarker = removalEdits.For(InterestState.Battle); var restartMarker = removalEdits.For(InterestState.Restart); var ruleLastSectors = new RuleLastLapPeriod(cameraControl, removalEdits); var ruleUnlimitedIncident = new RuleIncident(cameraControl, removalEdits, incidents, 999); var ruleLimitedIncident = new RuleIncident(cameraControl, removalEdits, incidents, Settings.Default.IgnoreIncidentsBelowPosition); var ruleFirstSectors = new RuleFirstLapPeriod(cameraControl, removalEdits); var rulePaceLaps = new RulePaceLaps(cameraControl, restartMarker, battleMarker); var ruleBattle = new RuleBattle(cameraControl, battleMarker, Settings.Default.CameraStickyPeriod, Settings.Default.BattleStickyPeriod, Settings.Default.BattleGap, Settings.Default.BattleFactor2); ruleRandom = new RuleRandomDriver(cameraControl, sessionData, Settings.Default.CameraStickyPeriod); var ruleForFirstSectors = Settings.Default.IgnoreIncidentsDuringRaceStart ? ruleFirstSectors : ruleFirstSectors.WithVeto(ruleUnlimitedIncident); directionRules = new IDirectionRule[] { ruleLastSectors, ruleForFirstSectors, rulePaceLaps.WithVeto(ruleUnlimitedIncident.WithVeto(ruleLastSectors)), ruleBattle.WithVeto(ruleLimitedIncident.WithVeto(ruleLastSectors)), ruleUnlimitedIncident.WithVeto(ruleLastSectors), ruleRandom.WithVeto(ruleLastSectors) }; currentRule = directionRules[0]; }
public ReplayControl(SessionData sessionData, Incidents incidents, RemovalEdits removalEdits, TrackCameras trackCameras) { var cameras = trackCameras.Where(tc => tc.TrackName == sessionData.WeekendInfo.TrackDisplayName).ToArray(); TraceInfo.WriteLineIf(cameras.Count() <= 0, "Track Cameras not defined for {0}", sessionData.WeekendInfo.TrackDisplayName); Debug.Assert(cameras.Count() > 0, "Track Cameras not defined for {0}".F(sessionData.WeekendInfo.TrackDisplayName)); foreach (var tc in cameras) tc.CameraNumber = (short)sessionData.CameraInfo.Groups.First(g => g.GroupName.ToLower() == tc.CameraName.ToLower()).GroupNum; var camera = cameras.First(tc => tc.IsRaceStart); var cameraControl = new CameraControl(cameras); cameraControl.CameraOnPositon(1, camera.CameraNumber); var battleMarker = removalEdits.For(InterestState.Battle); var restartMarker = removalEdits.For(InterestState.Restart); var ruleLastSectors = new RuleLastLapPeriod(cameraControl, removalEdits); var ruleUnlimitedIncident = new RuleIncident(cameraControl, removalEdits, incidents, 999); var ruleLimitedIncident = new RuleIncident(cameraControl, removalEdits, incidents, Settings.Default.IgnoreIncidentsBelowPosition); var ruleFirstSectors = new RuleFirstLapPeriod(cameraControl, removalEdits); var rulePaceLaps = new RulePaceLaps(cameraControl, restartMarker, battleMarker); var ruleBattle = new RuleBattle(cameraControl, battleMarker, Settings.Default.CameraStickyPeriod, Settings.Default.BattleStickyPeriod, Settings.Default.BattleGap, Settings.Default.BattleFactor2); ruleRandom = new RuleRandomDriver(cameraControl, sessionData, Settings.Default.CameraStickyPeriod); var ruleForFirstSectors = Settings.Default.IgnoreIncidentsDuringRaceStart ? ruleFirstSectors : ruleFirstSectors.WithVeto(ruleUnlimitedIncident); directionRules = new IDirectionRule[] { ruleLastSectors, ruleForFirstSectors, rulePaceLaps.WithVeto(ruleUnlimitedIncident.WithVeto(ruleLastSectors)), ruleBattle.WithVeto(ruleLimitedIncident.WithVeto(ruleLastSectors)), ruleUnlimitedIncident.WithVeto(ruleLastSectors), ruleRandom.WithVeto(ruleLastSectors) }; currentRule = directionRules[0]; }