mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 21:13:20 +08:00
Merge remote-tracking branch 'ppy/master' into colour-rework
This commit is contained in:
commit
319d0aa036
@ -52,7 +52,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.607.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.611.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
||||
|
@ -113,6 +113,9 @@ namespace osu.Desktop
|
||||
{
|
||||
tools.CreateShortcutForThisExe();
|
||||
tools.CreateUninstallerRegistryEntry();
|
||||
}, onAppUpdate: (version, tools) =>
|
||||
{
|
||||
tools.CreateUninstallerRegistryEntry();
|
||||
}, onAppUninstall: (version, tools) =>
|
||||
{
|
||||
tools.RemoveShortcutForThisExe();
|
||||
|
@ -25,8 +25,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing
|
||||
/// </summary>
|
||||
public readonly double StrainTime;
|
||||
|
||||
public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth, List<DifficultyHitObject> objects, int position)
|
||||
: base(hitObject, lastObject, clockRate, objects, position)
|
||||
public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth, List<DifficultyHitObject> objects, int index)
|
||||
: base(hitObject, lastObject, clockRate, objects, index)
|
||||
{
|
||||
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
|
||||
float scalingFactor = normalized_hitobject_radius / halfCatcherWidth;
|
||||
|
@ -12,8 +12,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Preprocessing
|
||||
{
|
||||
public new ManiaHitObject BaseObject => (ManiaHitObject)base.BaseObject;
|
||||
|
||||
public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int position)
|
||||
: base(hitObject, lastObject, clockRate, objects, position)
|
||||
public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int index)
|
||||
: base(hitObject, lastObject, clockRate, objects, index)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
// The first jump is formed by the first two hitobjects of the map.
|
||||
// If the map has less than two OsuHitObjects, the enumerator will not return anything.
|
||||
for (int i = 1; i < beatmap.HitObjects.Count; i++)
|
||||
objects.Add(new OsuDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate, objects, objects.Count));
|
||||
{
|
||||
var lastLast = i > 1 ? beatmap.HitObjects[i - 2] : null;
|
||||
objects.Add(new OsuDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], lastLast, clockRate, objects, objects.Count));
|
||||
}
|
||||
|
||||
return objects;
|
||||
}
|
||||
|
@ -75,10 +75,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
private readonly OsuHitObject lastLastObject;
|
||||
private readonly OsuHitObject lastObject;
|
||||
|
||||
public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int position)
|
||||
: base(hitObject, lastObject, clockRate, objects, position)
|
||||
public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List<DifficultyHitObject> objects, int index)
|
||||
: base(hitObject, lastObject, clockRate, objects, index)
|
||||
{
|
||||
lastLastObject = (OsuHitObject)Previous(1)?.BaseObject;
|
||||
this.lastLastObject = (OsuHitObject)lastLastObject;
|
||||
this.lastObject = (OsuHitObject)lastObject;
|
||||
|
||||
// Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects.
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
|
||||
private double strainValueOf(DifficultyHitObject current)
|
||||
{
|
||||
if (current.BaseObject is Spinner || current.Position <= 1 || current.Previous(0).BaseObject is Spinner)
|
||||
if (current.BaseObject is Spinner || current.Index <= 1 || current.Previous(0).BaseObject is Spinner)
|
||||
return 0;
|
||||
|
||||
var osuCurrObj = (OsuDifficultyHitObject)current;
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
OsuDifficultyHitObject lastObj = osuCurrent;
|
||||
|
||||
// This is iterating backwards in time from the current object.
|
||||
for (int i = 0; i < Math.Min(current.Position, 10); i++)
|
||||
for (int i = 0; i < Math.Min(current.Index, 10); i++)
|
||||
{
|
||||
var currentObj = (OsuDifficultyHitObject)current.Previous(i);
|
||||
var currentHitObject = (OsuHitObject)(currentObj.BaseObject);
|
||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
|
||||
bool firstDeltaSwitch = false;
|
||||
|
||||
int historicalNoteCount = Math.Min(current.Position, 32);
|
||||
int historicalNoteCount = Math.Min(current.Index, 32);
|
||||
|
||||
int rhythmStart = 0;
|
||||
|
||||
@ -136,7 +136,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
|
||||
// derive strainTime for calculation
|
||||
var osuCurrObj = (OsuDifficultyHitObject)current;
|
||||
var osuPrevObj = current.Position > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null;
|
||||
var osuPrevObj = current.Index > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null;
|
||||
|
||||
double strainTime = osuCurrObj.StrainTime;
|
||||
double greatWindowFull = greatWindow * 2;
|
||||
|
@ -17,9 +17,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
public class TaikoDifficultyHitObject : DifficultyHitObject
|
||||
{
|
||||
private readonly IReadOnlyList<TaikoDifficultyHitObject> monoDifficultyHitObjects;
|
||||
public readonly int MonoPosition;
|
||||
public readonly int MonoIndex;
|
||||
private readonly IReadOnlyList<TaikoDifficultyHitObject> noteObjects;
|
||||
public readonly int NotePosition;
|
||||
public readonly int NoteIndex;
|
||||
|
||||
/// <summary>
|
||||
/// The rhythm required to hit this hit object.
|
||||
@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
/// <param name="centreHitObjects">The list of centre (don) <see cref="DifficultyHitObject"/>s in the current beatmap.</param>
|
||||
/// <param name="rimHitObjects">The list of rim (kat) <see cref="DifficultyHitObject"/>s in the current beatmap.</param>
|
||||
/// <param name="noteObjects">The list of <see cref="DifficultyHitObject"/>s that is a hit (i.e. not a slider or spinner) in the current beatmap.</param>
|
||||
/// <param name="position">The position of this <see cref="DifficultyHitObject"/> in the <paramref name="objects"/> list.</param>
|
||||
/// <param name="index">The position of this <see cref="DifficultyHitObject"/> in the <paramref name="objects"/> list.</param>
|
||||
///
|
||||
/// TODO: This argument list is getting long, we might want to refactor this into a static method that create
|
||||
/// all <see cref="DifficultyHitObject"/>s from a <see cref="IBeatmap"/>.
|
||||
@ -86,8 +86,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
List<DifficultyHitObject> objects,
|
||||
List<TaikoDifficultyHitObject> centreHitObjects,
|
||||
List<TaikoDifficultyHitObject> rimHitObjects,
|
||||
List<TaikoDifficultyHitObject> noteObjects, int position)
|
||||
: base(hitObject, lastObject, clockRate, objects, position)
|
||||
List<TaikoDifficultyHitObject> noteObjects, int index)
|
||||
: base(hitObject, lastObject, clockRate, objects, index)
|
||||
{
|
||||
var currentHit = hitObject as Hit;
|
||||
this.noteObjects = noteObjects;
|
||||
@ -97,13 +97,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
|
||||
if (HitType == Objects.HitType.Centre)
|
||||
{
|
||||
MonoPosition = centreHitObjects.Count;
|
||||
MonoIndex = centreHitObjects.Count;
|
||||
centreHitObjects.Add(this);
|
||||
monoDifficultyHitObjects = centreHitObjects;
|
||||
}
|
||||
else if (HitType == Objects.HitType.Rim)
|
||||
{
|
||||
MonoPosition = rimHitObjects.Count;
|
||||
MonoIndex = rimHitObjects.Count;
|
||||
rimHitObjects.Add(this);
|
||||
monoDifficultyHitObjects = rimHitObjects;
|
||||
}
|
||||
@ -111,10 +111,10 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
// Need to be done after HitType is set.
|
||||
if (HitType == null) return;
|
||||
|
||||
NotePosition = noteObjects.Count;
|
||||
NoteIndex = noteObjects.Count;
|
||||
noteObjects.Add(this);
|
||||
|
||||
// Need to be done after NotePosition is set.
|
||||
// Need to be done after NoteIndex is set.
|
||||
Colour = TaikoDifficultyHitObjectColour.GetInstanceFor(this);
|
||||
}
|
||||
|
||||
@ -155,12 +155,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
return common_rhythms.OrderBy(x => Math.Abs(x.Ratio - ratio)).First();
|
||||
}
|
||||
|
||||
public TaikoDifficultyHitObject PreviousMono(int backwardsIndex) => monoDifficultyHitObjects.ElementAtOrDefault(MonoPosition - (backwardsIndex + 1));
|
||||
public TaikoDifficultyHitObject PreviousMono(int backwardsIndex) => monoDifficultyHitObjects.ElementAtOrDefault(MonoIndex - (backwardsIndex + 1));
|
||||
|
||||
public TaikoDifficultyHitObject NextMono(int forwardsIndex) => monoDifficultyHitObjects.ElementAtOrDefault(MonoPosition + (forwardsIndex + 1));
|
||||
public TaikoDifficultyHitObject NextMono(int forwardsIndex) => monoDifficultyHitObjects.ElementAtOrDefault(MonoIndex + (forwardsIndex + 1));
|
||||
|
||||
public TaikoDifficultyHitObject PreviousNote(int backwardsIndex) => noteObjects.ElementAtOrDefault(NotePosition - (backwardsIndex + 1));
|
||||
public TaikoDifficultyHitObject PreviousNote(int backwardsIndex) => noteObjects.ElementAtOrDefault(NoteIndex - (backwardsIndex + 1));
|
||||
|
||||
public TaikoDifficultyHitObject NextNote(int forwardsIndex) => noteObjects.ElementAtOrDefault(NotePosition + (forwardsIndex + 1));
|
||||
public TaikoDifficultyHitObject NextNote(int forwardsIndex) => noteObjects.ElementAtOrDefault(NoteIndex + (forwardsIndex + 1));
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
||||
if (!samePattern(start, mostRecentPatternsToCompare))
|
||||
continue;
|
||||
|
||||
int notesSince = hitObject.Position - rhythmHistory[start].Position;
|
||||
int notesSince = hitObject.Index - rhythmHistory[start].Index;
|
||||
penalty *= repetitionPenalty(notesSince);
|
||||
break;
|
||||
}
|
||||
|
@ -24,6 +24,24 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
AddUntilStep("wait for load", () => latencyCertifier.IsLoaded);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSimple()
|
||||
{
|
||||
AddStep("set visual mode to simple", () => latencyCertifier.VisualMode.Value = LatencyVisualMode.Simple);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCircleGameplay()
|
||||
{
|
||||
AddStep("set visual mode to circles", () => latencyCertifier.VisualMode.Value = LatencyVisualMode.CircleGameplay);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCycleVisualModes()
|
||||
{
|
||||
AddRepeatStep("cycle mode", () => InputManager.Key(Key.Space), 6);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCertification()
|
||||
{
|
||||
@ -38,7 +56,6 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
|
||||
clickUntilResults(true);
|
||||
AddAssert("check at results", () => !latencyCertifier.ChildrenOfType<LatencyArea>().Any());
|
||||
AddAssert("check no buttons", () => !latencyCertifier.ChildrenOfType<OsuButton>().Any());
|
||||
checkDifficulty(1);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,10 @@ namespace osu.Game.Graphics
|
||||
/// <param name="fixedWidth">Whether all characters should be spaced the same distance apart.</param>
|
||||
/// <returns>The <see cref="FontUsage"/>.</returns>
|
||||
public static FontUsage GetFont(Typeface typeface = Typeface.Torus, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false)
|
||||
=> new FontUsage(GetFamilyString(typeface), size, GetWeightString(typeface, weight), getItalics(italics), fixedWidth);
|
||||
{
|
||||
string familyString = GetFamilyString(typeface);
|
||||
return new FontUsage(familyString, size, GetWeightString(familyString, weight), getItalics(italics), fixedWidth);
|
||||
}
|
||||
|
||||
private static bool getItalics(in bool italicsRequested)
|
||||
{
|
||||
@ -54,16 +57,16 @@ namespace osu.Game.Graphics
|
||||
switch (typeface)
|
||||
{
|
||||
case Typeface.Venera:
|
||||
return "Venera";
|
||||
return @"Venera";
|
||||
|
||||
case Typeface.Torus:
|
||||
return "Torus";
|
||||
return @"Torus";
|
||||
|
||||
case Typeface.TorusAlternate:
|
||||
return "Torus-Alternate";
|
||||
return @"Torus-Alternate";
|
||||
|
||||
case Typeface.Inter:
|
||||
return "Inter";
|
||||
return @"Inter";
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -72,25 +75,17 @@ namespace osu.Game.Graphics
|
||||
/// <summary>
|
||||
/// Retrieves the string representation of a <see cref="FontWeight"/>.
|
||||
/// </summary>
|
||||
/// <param name="typeface">The <see cref="Typeface"/>.</param>
|
||||
/// <param name="weight">The <see cref="FontWeight"/>.</param>
|
||||
/// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="typeface"/>.</returns>
|
||||
public static string GetWeightString(Typeface typeface, FontWeight weight)
|
||||
/// <param name="family">The font family.</param>
|
||||
/// <param name="weight">The font weight.</param>
|
||||
/// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="family"/>.</returns>
|
||||
public static string GetWeightString(string family, FontWeight weight)
|
||||
{
|
||||
if (typeface == Typeface.Torus && weight == FontWeight.Medium)
|
||||
if ((family == GetFamilyString(Typeface.Torus) || family == GetFamilyString(Typeface.TorusAlternate)) && weight == FontWeight.Medium)
|
||||
// torus doesn't have a medium; fallback to regular.
|
||||
weight = FontWeight.Regular;
|
||||
|
||||
return GetWeightString(GetFamilyString(typeface), weight);
|
||||
return weight.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the string representation of a <see cref="FontWeight"/>.
|
||||
/// </summary>
|
||||
/// <param name="family">The family string.</param>
|
||||
/// <param name="weight">The <see cref="FontWeight"/>.</param>
|
||||
/// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="family"/>.</returns>
|
||||
public static string GetWeightString(string family, FontWeight weight) => weight.ToString();
|
||||
}
|
||||
|
||||
public static class OsuFontExtensions
|
||||
|
@ -34,11 +34,6 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString ShowFPS => new TranslatableString(getKey(@"show_fps"), @"Show FPS");
|
||||
|
||||
/// <summary>
|
||||
/// "Using unlimited frame limiter can lead to stutters, bad performance and overheating. It will not improve perceived latency. "2x refresh rate" is recommended."
|
||||
/// </summary>
|
||||
public static LocalisableString UnlimitedFramesNote => new TranslatableString(getKey(@"unlimited_frames_note"), @"Using unlimited frame limiter can lead to stutters, bad performance and overheating. It will not improve perceived latency. ""2x refresh rate"" is recommended.");
|
||||
|
||||
/// <summary>
|
||||
/// "Layout"
|
||||
/// </summary>
|
||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Online
|
||||
WebsiteRootUrl = APIEndpointUrl = @"https://osu.ppy.sh";
|
||||
APIClientSecret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk";
|
||||
APIClientID = "5";
|
||||
SpectatorEndpointUrl = "https://spectator2.ppy.sh/spectator";
|
||||
MultiplayerEndpointUrl = "https://spectator2.ppy.sh/multiplayer";
|
||||
SpectatorEndpointUrl = "https://spectator.ppy.sh/spectator";
|
||||
MultiplayerEndpointUrl = "https://spectator.ppy.sh/multiplayer";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
{
|
||||
protected override LocalisableString Header => GraphicsSettingsStrings.RendererHeader;
|
||||
|
||||
private SettingsEnumDropdown<FrameSync> frameLimiterDropdown;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig)
|
||||
{
|
||||
@ -24,7 +22,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
Children = new Drawable[]
|
||||
{
|
||||
// TODO: this needs to be a custom dropdown at some point
|
||||
frameLimiterDropdown = new SettingsEnumDropdown<FrameSync>
|
||||
new SettingsEnumDropdown<FrameSync>
|
||||
{
|
||||
LabelText = GraphicsSettingsStrings.FrameLimiter,
|
||||
Current = config.GetBindable<FrameSync>(FrameworkSetting.FrameSync)
|
||||
@ -41,24 +39,5 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
frameLimiterDropdown.Current.BindValueChanged(limit =>
|
||||
{
|
||||
switch (limit.NewValue)
|
||||
{
|
||||
case FrameSync.Unlimited:
|
||||
frameLimiterDropdown.SetNoticeText(GraphicsSettingsStrings.UnlimitedFramesNote, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
frameLimiterDropdown.ClearNoticeText();
|
||||
break;
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing
|
||||
private readonly IReadOnlyList<DifficultyHitObject> difficultyHitObjects;
|
||||
|
||||
/// <summary>
|
||||
/// The position of this <see cref="DifficultyHitObject"/> in the <see cref="difficultyHitObjects"/> list.
|
||||
/// The index of this <see cref="DifficultyHitObject"/> in the list of all <see cref="DifficultyHitObject"/>s.
|
||||
/// </summary>
|
||||
public int Position;
|
||||
public int Index;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="HitObject"/> this <see cref="DifficultyHitObject"/> wraps.
|
||||
@ -51,11 +51,11 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing
|
||||
/// <param name="lastObject">The last <see cref="HitObject"/> which occurs before <paramref name="hitObject"/> in the beatmap.</param>
|
||||
/// <param name="clockRate">The rate at which the gameplay clock is run at.</param>
|
||||
/// <param name="objects">The list of <see cref="DifficultyHitObject"/>s in the current beatmap.</param>
|
||||
/// <param name="position">The position of this <see cref="DifficultyHitObject"/> in the <see cref="difficultyHitObjects"/> list.</param>
|
||||
public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int position)
|
||||
/// <param name="index">The index of this <see cref="DifficultyHitObject"/> in <paramref name="objects"/> list.</param>
|
||||
public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int index)
|
||||
{
|
||||
difficultyHitObjects = objects;
|
||||
Position = position;
|
||||
Index = index;
|
||||
BaseObject = hitObject;
|
||||
LastObject = lastObject;
|
||||
DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate;
|
||||
@ -63,8 +63,8 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing
|
||||
EndTime = hitObject.GetEndTime() / clockRate;
|
||||
}
|
||||
|
||||
public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Position - (backwardsIndex + 1));
|
||||
public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Index - (backwardsIndex + 1));
|
||||
|
||||
public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Position + (forwardsIndex + 1));
|
||||
public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Index + (forwardsIndex + 1));
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills
|
||||
public sealed override void Process(DifficultyHitObject current)
|
||||
{
|
||||
// The first object doesn't generate a strain, so we begin with an incremented section end
|
||||
if (current.Position == 0)
|
||||
if (current.Index == 0)
|
||||
currentSectionEnd = Math.Ceiling(current.StartTime / SectionLength) * SectionLength;
|
||||
|
||||
while (current.StartTime > currentSectionEnd)
|
||||
|
240
osu.Game/Screens/Utility/CircleGameplay.cs
Normal file
240
osu.Game/Screens/Utility/CircleGameplay.cs
Normal file
@ -0,0 +1,240 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Utility.SampleComponents;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Utility
|
||||
{
|
||||
public class CircleGameplay : LatencySampleComponent
|
||||
{
|
||||
private int nextLocation;
|
||||
|
||||
private readonly List<HitEvent> hitEvents = new List<HitEvent>();
|
||||
|
||||
private double? lastGeneratedBeatTime;
|
||||
|
||||
private Container circles = null!;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
circles = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
};
|
||||
|
||||
SampleBPM.BindValueChanged(_ =>
|
||||
{
|
||||
circles.Clear();
|
||||
lastGeneratedBeatTime = null;
|
||||
});
|
||||
}
|
||||
|
||||
protected override void UpdateAtLimitedRate(InputState inputState)
|
||||
{
|
||||
double beatLength = 60000 / SampleBPM.Value;
|
||||
|
||||
int nextBeat = (int)(Clock.CurrentTime / beatLength) + 1;
|
||||
|
||||
// We want to generate a few hit objects ahead of the current time (to allow them to animate).
|
||||
double generateUpTo = (nextBeat + 2) * beatLength;
|
||||
|
||||
while (lastGeneratedBeatTime == null || lastGeneratedBeatTime < generateUpTo)
|
||||
{
|
||||
double time = ++nextBeat * beatLength;
|
||||
|
||||
if (time <= lastGeneratedBeatTime)
|
||||
continue;
|
||||
|
||||
newBeat(time);
|
||||
lastGeneratedBeatTime = time;
|
||||
}
|
||||
}
|
||||
|
||||
private void newBeat(double time)
|
||||
{
|
||||
nextLocation++;
|
||||
|
||||
Vector2 location;
|
||||
|
||||
float adjust = SampleVisualSpacing.Value * 0.25f;
|
||||
|
||||
float spacingLow = 0.5f - adjust;
|
||||
float spacingHigh = 0.5f + adjust;
|
||||
|
||||
switch (nextLocation % 4)
|
||||
{
|
||||
default:
|
||||
location = new Vector2(spacingLow, spacingLow);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
location = new Vector2(spacingHigh, spacingHigh);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
location = new Vector2(spacingHigh, spacingLow);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
location = new Vector2(spacingLow, spacingHigh);
|
||||
break;
|
||||
}
|
||||
|
||||
circles.Add(new SampleHitCircle(time)
|
||||
{
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = location,
|
||||
Hit = hit,
|
||||
});
|
||||
}
|
||||
|
||||
private void hit(HitEvent h)
|
||||
{
|
||||
hitEvents.Add(h);
|
||||
}
|
||||
|
||||
public class SampleHitCircle : LatencySampleComponent
|
||||
{
|
||||
public HitEvent? HitEvent;
|
||||
|
||||
public Action<HitEvent>? Hit { get; set; }
|
||||
|
||||
public readonly double HitTime;
|
||||
|
||||
private CircularContainer approach = null!;
|
||||
private Circle circle = null!;
|
||||
|
||||
private const float size = 100;
|
||||
private const float duration = 200;
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
|
||||
=> circle.ReceivePositionalInputAt(screenSpacePos);
|
||||
|
||||
public SampleHitCircle(double hitTime)
|
||||
{
|
||||
HitTime = hitTime;
|
||||
|
||||
Origin = Anchor.Centre;
|
||||
AutoSizeAxes = Axes.Both;
|
||||
AlwaysPresent = true;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
circle = new Circle
|
||||
{
|
||||
Colour = OverlayColourProvider.Content1,
|
||||
Size = new Vector2(size),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
approach = new CircularContainer
|
||||
{
|
||||
BorderColour = colours.Blue,
|
||||
Size = new Vector2(size),
|
||||
Masking = true,
|
||||
BorderThickness = 4,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
if (HitEvent != null)
|
||||
return false;
|
||||
|
||||
if (Math.Abs(Clock.CurrentTime - HitTime) > duration)
|
||||
return false;
|
||||
|
||||
attemptHit();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (!IsActive.Value)
|
||||
return false;
|
||||
|
||||
if (Math.Abs(Clock.CurrentTime - HitTime) > duration)
|
||||
return false;
|
||||
|
||||
if (IsHovered)
|
||||
attemptHit();
|
||||
return base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
protected override void UpdateAtLimitedRate(InputState inputState)
|
||||
{
|
||||
if (HitEvent == null)
|
||||
{
|
||||
double preempt = (float)IBeatmapDifficultyInfo.DifficultyRange(SampleApproachRate.Value, 1800, 1200, 450);
|
||||
|
||||
approach.Scale = new Vector2(1 + 4 * (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / preempt, 0, 100));
|
||||
Alpha = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1);
|
||||
|
||||
if (Clock.CurrentTime > HitTime + duration)
|
||||
Expire();
|
||||
}
|
||||
}
|
||||
|
||||
private void attemptHit() => Schedule(() =>
|
||||
{
|
||||
if (HitEvent != null)
|
||||
return;
|
||||
|
||||
// in case it was hit outside of display range, show immediately
|
||||
// so the user isn't confused.
|
||||
this.FadeIn();
|
||||
|
||||
approach.Expire();
|
||||
|
||||
circle
|
||||
.FadeOut(duration)
|
||||
.ScaleTo(1.5f, duration);
|
||||
|
||||
HitEvent = new HitEvent(Clock.CurrentTime - HitTime, HitResult.Good, new HitObject
|
||||
{
|
||||
HitWindows = new HitWindows(),
|
||||
}, null, null);
|
||||
|
||||
Hit?.Invoke(HitEvent.Value);
|
||||
|
||||
this.Delay(duration).Expire();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -9,14 +9,14 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Overlays;
|
||||
using osuTK;
|
||||
using osu.Game.Screens.Utility.SampleComponents;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Utility
|
||||
{
|
||||
[Cached]
|
||||
public class LatencyArea : CompositeDrawable
|
||||
{
|
||||
[Resolved]
|
||||
@ -28,10 +28,14 @@ namespace osu.Game.Screens.Utility
|
||||
|
||||
private readonly Key key;
|
||||
|
||||
private Container visualContent = null!;
|
||||
|
||||
public readonly int? TargetFrameRate;
|
||||
|
||||
public readonly BindableBool IsActiveArea = new BindableBool();
|
||||
|
||||
public readonly Bindable<LatencyVisualMode> VisualMode = new Bindable<LatencyVisualMode>();
|
||||
|
||||
public LatencyArea(Key key, int? targetFrameRate)
|
||||
{
|
||||
this.key = key;
|
||||
@ -61,20 +65,9 @@ namespace osu.Game.Screens.Utility
|
||||
Origin = Anchor.TopCentre,
|
||||
Action = () => ReportUserBest?.Invoke(),
|
||||
},
|
||||
new Container
|
||||
visualContent = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new LatencyMovableBox(IsActiveArea)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new LatencyCursorContainer(IsActiveArea)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@ -82,6 +75,43 @@ namespace osu.Game.Screens.Utility
|
||||
{
|
||||
background.FadeColour(active.NewValue ? overlayColourProvider.Background4 : overlayColourProvider.Background6, 200, Easing.OutQuint);
|
||||
}, true);
|
||||
|
||||
VisualMode.BindValueChanged(mode =>
|
||||
{
|
||||
switch (mode.NewValue)
|
||||
{
|
||||
case LatencyVisualMode.Simple:
|
||||
visualContent.Children = new Drawable[]
|
||||
{
|
||||
new LatencyMovableBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new LatencyCursorContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
};
|
||||
break;
|
||||
|
||||
case LatencyVisualMode.CircleGameplay:
|
||||
visualContent.Children = new Drawable[]
|
||||
{
|
||||
new CircleGameplay
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new LatencyCursorContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
};
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||
@ -102,140 +132,5 @@ namespace osu.Game.Screens.Utility
|
||||
|
||||
return base.UpdateSubTree();
|
||||
}
|
||||
|
||||
public class LatencyMovableBox : CompositeDrawable
|
||||
{
|
||||
private Box box = null!;
|
||||
private InputManager inputManager = null!;
|
||||
|
||||
private readonly BindableBool isActive;
|
||||
|
||||
[Resolved]
|
||||
private OverlayColourProvider overlayColourProvider { get; set; } = null!;
|
||||
|
||||
public LatencyMovableBox(BindableBool isActive)
|
||||
{
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
inputManager = GetContainingInputManager();
|
||||
|
||||
InternalChild = box = new Box
|
||||
{
|
||||
Size = new Vector2(40),
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = new Vector2(0.5f),
|
||||
Origin = Anchor.Centre,
|
||||
Colour = overlayColourProvider.Colour1,
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e) => false;
|
||||
|
||||
private double? lastFrameTime;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (!isActive.Value)
|
||||
{
|
||||
lastFrameTime = null;
|
||||
box.Colour = overlayColourProvider.Colour1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastFrameTime != null)
|
||||
{
|
||||
float movementAmount = (float)(Clock.CurrentTime - lastFrameTime) / 400;
|
||||
|
||||
var buttons = inputManager.CurrentState.Keyboard.Keys;
|
||||
|
||||
box.Colour = buttons.HasAnyButtonPressed ? overlayColourProvider.Content1 : overlayColourProvider.Colour1;
|
||||
|
||||
foreach (var key in buttons)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case Key.K:
|
||||
case Key.Up:
|
||||
box.Y = MathHelper.Clamp(box.Y - movementAmount, 0.1f, 0.9f);
|
||||
break;
|
||||
|
||||
case Key.J:
|
||||
case Key.Down:
|
||||
box.Y = MathHelper.Clamp(box.Y + movementAmount, 0.1f, 0.9f);
|
||||
break;
|
||||
|
||||
case Key.Z:
|
||||
case Key.Left:
|
||||
box.X = MathHelper.Clamp(box.X - movementAmount, 0.1f, 0.9f);
|
||||
break;
|
||||
|
||||
case Key.X:
|
||||
case Key.Right:
|
||||
box.X = MathHelper.Clamp(box.X + movementAmount, 0.1f, 0.9f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastFrameTime = Clock.CurrentTime;
|
||||
}
|
||||
}
|
||||
|
||||
public class LatencyCursorContainer : CompositeDrawable
|
||||
{
|
||||
private Circle cursor = null!;
|
||||
private InputManager inputManager = null!;
|
||||
|
||||
private readonly BindableBool isActive;
|
||||
|
||||
[Resolved]
|
||||
private OverlayColourProvider overlayColourProvider { get; set; } = null!;
|
||||
|
||||
public LatencyCursorContainer(BindableBool isActive)
|
||||
{
|
||||
this.isActive = isActive;
|
||||
Masking = true;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
InternalChild = cursor = new Circle
|
||||
{
|
||||
Size = new Vector2(40),
|
||||
Origin = Anchor.Centre,
|
||||
Colour = overlayColourProvider.Colour2,
|
||||
};
|
||||
|
||||
inputManager = GetContainingInputManager();
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e) => false;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
cursor.Colour = inputManager.CurrentState.Mouse.IsPressed(MouseButton.Left) ? overlayColourProvider.Content1 : overlayColourProvider.Colour2;
|
||||
|
||||
if (isActive.Value)
|
||||
{
|
||||
cursor.Position = ToLocalSpace(inputManager.CurrentState.Mouse.Position);
|
||||
cursor.Alpha = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor.Alpha = 0;
|
||||
}
|
||||
|
||||
base.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -24,11 +25,13 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Utility
|
||||
{
|
||||
[Cached]
|
||||
public class LatencyCertifierScreen : OsuScreen
|
||||
{
|
||||
private FrameSync previousFrameSyncMode;
|
||||
@ -42,12 +45,16 @@ namespace osu.Game.Screens.Utility
|
||||
|
||||
public override float BackgroundParallaxAmount => 0;
|
||||
|
||||
private readonly OsuTextFlowContainer explanatoryText;
|
||||
private readonly LinkFlowContainer explanatoryText;
|
||||
|
||||
private readonly Container<LatencyArea> mainArea;
|
||||
|
||||
private readonly Container resultsArea;
|
||||
|
||||
public readonly BindableDouble SampleBPM = new BindableDouble(120) { MinValue = 60, MaxValue = 300, Precision = 1 };
|
||||
public readonly BindableDouble SampleApproachRate = new BindableDouble(9) { MinValue = 5, MaxValue = 12, Precision = 0.1 };
|
||||
public readonly BindableFloat SampleVisualSpacing = new BindableFloat(0.5f) { MinValue = 0f, MaxValue = 1, Precision = 0.1f };
|
||||
|
||||
/// <summary>
|
||||
/// The rate at which the game host should attempt to run.
|
||||
/// </summary>
|
||||
@ -62,6 +69,8 @@ namespace osu.Game.Screens.Utility
|
||||
[Resolved]
|
||||
private FrameworkConfigManager config { get; set; } = null!;
|
||||
|
||||
public readonly Bindable<LatencyVisualMode> VisualMode = new Bindable<LatencyVisualMode>();
|
||||
|
||||
private const int rounds_to_complete = 5;
|
||||
|
||||
private const int rounds_to_complete_certified = 20;
|
||||
@ -81,9 +90,14 @@ namespace osu.Game.Screens.Utility
|
||||
private double lastPoll;
|
||||
private int pollingMax;
|
||||
|
||||
private readonly FillFlowContainer settings;
|
||||
|
||||
[Resolved]
|
||||
private GameHost host { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private MusicController musicController { get; set; } = null!;
|
||||
|
||||
public LatencyCertifierScreen()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
@ -116,18 +130,54 @@ namespace osu.Game.Screens.Utility
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopRight,
|
||||
},
|
||||
explanatoryText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
|
||||
settings = new FillFlowContainer
|
||||
{
|
||||
Name = "Settings",
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = 800,
|
||||
Padding = new MarginPadding(10),
|
||||
Spacing = new Vector2(2),
|
||||
Direction = FillDirection.Vertical,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
TextAnchor = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Text = @"Welcome to the latency certifier!
|
||||
Use the arrow keys, Z/X/J/K to move the square.
|
||||
Use the Tab key to change focus.
|
||||
Do whatever you need to try and perceive the difference in latency, then choose your best side.
|
||||
",
|
||||
Children = new Drawable[]
|
||||
{
|
||||
explanatoryText = new LinkFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
TextAnchor = Anchor.TopCentre,
|
||||
},
|
||||
new SettingsSlider<double>
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 400,
|
||||
LabelText = "bpm",
|
||||
Current = SampleBPM
|
||||
},
|
||||
new SettingsSlider<float>
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 400,
|
||||
LabelText = "visual spacing",
|
||||
Current = SampleVisualSpacing
|
||||
},
|
||||
new SettingsSlider<double>
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 400,
|
||||
LabelText = "approach rate",
|
||||
Current = SampleApproachRate
|
||||
},
|
||||
},
|
||||
},
|
||||
resultsArea = new Container
|
||||
{
|
||||
@ -143,11 +193,17 @@ Do whatever you need to try and perceive the difference in latency, then choose
|
||||
AutoSizeAxes = Axes.Y,
|
||||
},
|
||||
};
|
||||
|
||||
explanatoryText.AddParagraph(@"Welcome to the latency certifier!");
|
||||
explanatoryText.AddParagraph(@"Do whatever you need to try and perceive the difference in latency, then choose your best side. Read more about the methodology ");
|
||||
explanatoryText.AddLink("here", "https://github.com/ppy/osu/wiki/Latency-and-unlimited-frame-rates#methodology");
|
||||
explanatoryText.AddParagraph(@"Use the arrow keys or Z/X/F/J to control the display.");
|
||||
explanatoryText.AddParagraph(@"Tab key to change focus. Space to change display mode");
|
||||
}
|
||||
|
||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||
{
|
||||
if (lastPoll > 0)
|
||||
if (lastPoll > 0 && Clock.CurrentTime != lastPoll)
|
||||
pollingMax = (int)Math.Max(pollingMax, 1000 / (Clock.CurrentTime - lastPoll));
|
||||
lastPoll = Clock.CurrentTime;
|
||||
return base.OnMouseMove(e);
|
||||
@ -162,6 +218,8 @@ Do whatever you need to try and perceive the difference in latency, then choose
|
||||
config.SetValue(FrameworkSetting.FrameSync, FrameSync.Unlimited);
|
||||
host.UpdateThread.ActiveHz = target_host_update_frames;
|
||||
host.AllowBenchmarkUnlimitedFrames = true;
|
||||
|
||||
musicController.Stop();
|
||||
}
|
||||
|
||||
public override bool OnExiting(ScreenExitEvent e)
|
||||
@ -182,6 +240,11 @@ Do whatever you need to try and perceive the difference in latency, then choose
|
||||
{
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Space:
|
||||
int availableModes = Enum.GetValues(typeof(LatencyVisualMode)).Length;
|
||||
VisualMode.Value = (LatencyVisualMode)(((int)VisualMode.Value + 1) % availableModes);
|
||||
return true;
|
||||
|
||||
case Key.Tab:
|
||||
var firstArea = mainArea.FirstOrDefault(a => !a.IsActiveArea.Value);
|
||||
if (firstArea != null)
|
||||
@ -195,6 +258,8 @@ Do whatever you need to try and perceive the difference in latency, then choose
|
||||
private void showResults()
|
||||
{
|
||||
mainArea.Clear();
|
||||
resultsArea.Clear();
|
||||
settings.Hide();
|
||||
|
||||
var displayMode = host.Window?.CurrentDisplayMode.Value;
|
||||
|
||||
@ -301,7 +366,9 @@ Do whatever you need to try and perceive the difference in latency, then choose
|
||||
isCertifying = true;
|
||||
changeDifficulty(DifficultyLevel - 1);
|
||||
},
|
||||
TooltipText = isPass ? $"Chain {rounds_to_complete_certified} rounds to confirm your perception!" : "You've reached your limits. Go to the previous level to complete certification!",
|
||||
TooltipText = isPass
|
||||
? $"Chain {rounds_to_complete_certified} rounds to confirm your perception!"
|
||||
: "You've reached your limits. Go to the previous level to complete certification!",
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -374,6 +441,8 @@ Do whatever you need to try and perceive the difference in latency, then choose
|
||||
|
||||
private void loadNextRound()
|
||||
{
|
||||
settings.Show();
|
||||
|
||||
attemptsAtCurrentDifficulty++;
|
||||
statusText.Text = $"Level {DifficultyLevel}\nRound {attemptsAtCurrentDifficulty} of {totalRoundForNextResultsScreen}";
|
||||
|
||||
@ -386,12 +455,14 @@ Do whatever you need to try and perceive the difference in latency, then choose
|
||||
new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : (int?)null)
|
||||
{
|
||||
Width = 0.5f,
|
||||
VisualMode = { BindTarget = VisualMode },
|
||||
IsActiveArea = { Value = true },
|
||||
ReportUserBest = () => recordResult(betterSide == 0),
|
||||
},
|
||||
new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : (int?)null)
|
||||
{
|
||||
Width = 0.5f,
|
||||
VisualMode = { BindTarget = VisualMode },
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
ReportUserBest = () => recordResult(betterSide == 1)
|
||||
|
12
osu.Game/Screens/Utility/LatencyVisualMode.cs
Normal file
12
osu.Game/Screens/Utility/LatencyVisualMode.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable enable
|
||||
namespace osu.Game.Screens.Utility
|
||||
{
|
||||
public enum LatencyVisualMode
|
||||
{
|
||||
CircleGameplay,
|
||||
Simple,
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable enable
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Game.Overlays;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Utility.SampleComponents
|
||||
{
|
||||
public class LatencyCursorContainer : LatencySampleComponent
|
||||
{
|
||||
private Circle cursor = null!;
|
||||
|
||||
[Resolved]
|
||||
private OverlayColourProvider overlayColourProvider { get; set; } = null!;
|
||||
|
||||
public LatencyCursorContainer()
|
||||
{
|
||||
Masking = true;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
InternalChild = cursor = new Circle
|
||||
{
|
||||
Size = new Vector2(40),
|
||||
Origin = Anchor.Centre,
|
||||
Colour = overlayColourProvider.Colour2,
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e) => false;
|
||||
|
||||
protected override void UpdateAtLimitedRate(InputState inputState)
|
||||
{
|
||||
cursor.Colour = inputState.Mouse.IsPressed(MouseButton.Left) ? overlayColourProvider.Content1 : overlayColourProvider.Colour2;
|
||||
|
||||
if (IsActive.Value)
|
||||
{
|
||||
cursor.Position = ToLocalSpace(inputState.Mouse.Position);
|
||||
cursor.Alpha = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor.Alpha = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Input.States;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Utility.SampleComponents
|
||||
{
|
||||
public class LatencyMovableBox : LatencySampleComponent
|
||||
{
|
||||
private Box box = null!;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
InternalChild = box = new Box
|
||||
{
|
||||
Size = new Vector2(40),
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = new Vector2(0.5f),
|
||||
Origin = Anchor.Centre,
|
||||
Colour = OverlayColourProvider.Colour1,
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e) => false;
|
||||
|
||||
private double? lastFrameTime;
|
||||
|
||||
protected override void UpdateAtLimitedRate(InputState inputState)
|
||||
{
|
||||
if (!IsActive.Value)
|
||||
{
|
||||
lastFrameTime = null;
|
||||
box.Colour = OverlayColourProvider.Colour1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastFrameTime != null)
|
||||
{
|
||||
float movementAmount = (float)(Clock.CurrentTime - lastFrameTime) / 400;
|
||||
|
||||
var buttons = inputState.Keyboard.Keys;
|
||||
|
||||
box.Colour = buttons.HasAnyButtonPressed ? OverlayColourProvider.Content1 : OverlayColourProvider.Colour1;
|
||||
|
||||
foreach (var key in buttons)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case Key.F:
|
||||
case Key.Up:
|
||||
box.Y = MathHelper.Clamp(box.Y - movementAmount, 0.1f, 0.9f);
|
||||
break;
|
||||
|
||||
case Key.J:
|
||||
case Key.Down:
|
||||
box.Y = MathHelper.Clamp(box.Y + movementAmount, 0.1f, 0.9f);
|
||||
break;
|
||||
|
||||
case Key.Z:
|
||||
case Key.Left:
|
||||
box.X = MathHelper.Clamp(box.X - movementAmount, 0.1f, 0.9f);
|
||||
break;
|
||||
|
||||
case Key.X:
|
||||
case Key.Right:
|
||||
box.X = MathHelper.Clamp(box.X + movementAmount, 0.1f, 0.9f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastFrameTime = Clock.CurrentTime;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game.Screens.Utility.SampleComponents
|
||||
{
|
||||
public abstract class LatencySampleComponent : CompositeDrawable
|
||||
{
|
||||
protected readonly BindableDouble SampleBPM = new BindableDouble();
|
||||
protected readonly BindableDouble SampleApproachRate = new BindableDouble();
|
||||
protected readonly BindableFloat SampleVisualSpacing = new BindableFloat();
|
||||
|
||||
protected readonly BindableBool IsActive = new BindableBool();
|
||||
|
||||
private InputManager inputManager = null!;
|
||||
|
||||
[Resolved]
|
||||
private LatencyArea latencyArea { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
protected OverlayColourProvider OverlayColourProvider { get; private set; } = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LatencyCertifierScreen latencyCertifierScreen)
|
||||
{
|
||||
SampleBPM.BindTo(latencyCertifierScreen.SampleBPM);
|
||||
SampleApproachRate.BindTo(latencyCertifierScreen.SampleApproachRate);
|
||||
SampleVisualSpacing.BindTo(latencyCertifierScreen.SampleVisualSpacing);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
inputManager = GetContainingInputManager();
|
||||
IsActive.BindTo(latencyArea.IsActiveArea);
|
||||
}
|
||||
|
||||
protected sealed override void Update()
|
||||
{
|
||||
base.Update();
|
||||
UpdateAtLimitedRate(inputManager.CurrentState);
|
||||
}
|
||||
|
||||
protected abstract void UpdateAtLimitedRate(InputState inputState);
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="10.14.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2022.607.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2022.611.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" />
|
||||
<PackageReference Include="Sentry" Version="3.17.1" />
|
||||
<PackageReference Include="SharpCompress" Version="0.31.0" />
|
||||
|
@ -61,7 +61,7 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.607.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.611.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" />
|
||||
</ItemGroup>
|
||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) -->
|
||||
@ -84,7 +84,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.14" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="5.0.14" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2022.607.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2022.611.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.31.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user