mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 16:33:22 +08:00
Don't display calibration options when the previous play was too short to be useful
This commit is contained in:
parent
bc2a15db96
commit
4d9efe771b
@ -33,6 +33,20 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestTooShortToDisplay()
|
||||||
|
{
|
||||||
|
AddStep("Set short reference score", () =>
|
||||||
|
{
|
||||||
|
offsetControl.ReferenceScore.Value = new ScoreInfo
|
||||||
|
{
|
||||||
|
HitEvents = TestSceneHitEventTimingDistributionGraph.CreateDistributedHitEvents(0, 2)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDisplay()
|
public void TestDisplay()
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,8 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -75,6 +77,9 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
private IDisposable beatmapOffsetSubscription;
|
private IDisposable beatmapOffsetSubscription;
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -140,32 +145,53 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
|
|
||||||
private void scoreChanged(ValueChangedEvent<ScoreInfo> score)
|
private void scoreChanged(ValueChangedEvent<ScoreInfo> score)
|
||||||
{
|
{
|
||||||
if (!(score.NewValue?.HitEvents.CalculateAverageHitError() is double average))
|
var hitEvents = score.NewValue?.HitEvents;
|
||||||
{
|
|
||||||
referenceScoreContainer.Clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastPlayAverage = average;
|
referenceScoreContainer.Clear();
|
||||||
|
|
||||||
|
if (!(hitEvents?.CalculateAverageHitError() is double average))
|
||||||
|
return;
|
||||||
|
|
||||||
referenceScoreContainer.Children = new Drawable[]
|
referenceScoreContainer.Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = "Last play:"
|
Text = "Previous play:"
|
||||||
},
|
},
|
||||||
new HitEventTimingDistributionGraph(score.NewValue.HitEvents)
|
};
|
||||||
|
|
||||||
|
if (hitEvents.Count < 10)
|
||||||
|
{
|
||||||
|
referenceScoreContainer.AddRange(new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuTextFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Colour = colours.Red1,
|
||||||
|
Text = "Previous play too short to use for calibration"
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastPlayAverage = average;
|
||||||
|
|
||||||
|
referenceScoreContainer.AddRange(new Drawable[]
|
||||||
|
{
|
||||||
|
new HitEventTimingDistributionGraph(hitEvents)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 50,
|
Height = 50,
|
||||||
},
|
},
|
||||||
new AverageHitError(score.NewValue.HitEvents),
|
new AverageHitError(hitEvents),
|
||||||
useAverageButton = new SettingsButton
|
useAverageButton = new SettingsButton
|
||||||
{
|
{
|
||||||
Text = "Calibrate using last play",
|
Text = "Calibrate using last play",
|
||||||
Action = () => Current.Value = lastPlayAverage
|
Action = () => Current.Value = lastPlayAverage
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
Loading…
Reference in New Issue
Block a user