mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Make TargetFrameRate
nullable
This commit is contained in:
parent
c625c929e5
commit
613814c26c
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -27,11 +28,11 @@ namespace osu.Game.Screens.Utility
|
|||||||
|
|
||||||
private readonly Key key;
|
private readonly Key key;
|
||||||
|
|
||||||
public readonly int TargetFrameRate;
|
public readonly int? TargetFrameRate;
|
||||||
|
|
||||||
public readonly BindableBool IsActiveArea = new BindableBool();
|
public readonly BindableBool IsActiveArea = new BindableBool();
|
||||||
|
|
||||||
public LatencyArea(Key key, int targetFrameRate)
|
public LatencyArea(Key key, int? targetFrameRate)
|
||||||
{
|
{
|
||||||
this.key = key;
|
this.key = key;
|
||||||
TargetFrameRate = targetFrameRate;
|
TargetFrameRate = targetFrameRate;
|
||||||
@ -94,7 +95,7 @@ namespace osu.Game.Screens.Utility
|
|||||||
public override bool UpdateSubTree()
|
public override bool UpdateSubTree()
|
||||||
{
|
{
|
||||||
double elapsed = Clock.CurrentTime - lastFrameTime;
|
double elapsed = Clock.CurrentTime - lastFrameTime;
|
||||||
if (TargetFrameRate > 0 && elapsed < 1000.0 / TargetFrameRate)
|
if (TargetFrameRate.HasValue && elapsed < 1000.0 / TargetFrameRate)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
lastFrameTime = Clock.CurrentTime;
|
lastFrameTime = Clock.CurrentTime;
|
||||||
|
@ -358,13 +358,13 @@ Do whatever you need to try and perceive the difference in latency, then choose
|
|||||||
|
|
||||||
mainArea.AddRange(new[]
|
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,
|
Width = 0.5f,
|
||||||
IsActiveArea = { Value = true },
|
IsActiveArea = { Value = true },
|
||||||
ReportUserBest = () => recordResult(betterSide == 0),
|
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,
|
Width = 0.5f,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
|
Loading…
Reference in New Issue
Block a user