Make TargetFrameRate nullable

This commit is contained in:
Dean Herbert 2022-06-10 14:18:35 +09:00
parent c625c929e5
commit 613814c26c
2 changed files with 6 additions and 5 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
#nullable enable
using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -27,11 +28,11 @@ namespace osu.Game.Screens.Utility
private readonly Key key;
public readonly int TargetFrameRate;
public readonly int? TargetFrameRate;
public readonly BindableBool IsActiveArea = new BindableBool();
public LatencyArea(Key key, int targetFrameRate)
public LatencyArea(Key key, int? targetFrameRate)
{
this.key = key;
TargetFrameRate = targetFrameRate;
@ -94,7 +95,7 @@ namespace osu.Game.Screens.Utility
public override bool UpdateSubTree()
{
double elapsed = Clock.CurrentTime - lastFrameTime;
if (TargetFrameRate > 0 && elapsed < 1000.0 / TargetFrameRate)
if (TargetFrameRate.HasValue && elapsed < 1000.0 / TargetFrameRate)
return false;
lastFrameTime = Clock.CurrentTime;

View File

@ -358,13 +358,13 @@ Do whatever you need to try and perceive the difference in latency, then choose
mainArea.AddRange(new[]
{
new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0)
new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficultyLevel) : (int?)null)
{
Width = 0.5f,
IsActiveArea = { Value = true },
ReportUserBest = () => recordResult(betterSide == 0),
},
new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0)
new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficultyLevel) : (int?)null)
{
Width = 0.5f,
Anchor = Anchor.TopRight,