mirror of
https://github.com/ppy/osu
synced 2025-01-12 00:59:35 +00:00
Merge branch 'master' into add-slider-whistle
This commit is contained in:
commit
1dbc7e821e
53
osu.Game.Rulesets.Catch.Tests/TestSceneCatchReplay.cs
Normal file
53
osu.Game.Rulesets.Catch.Tests/TestSceneCatchReplay.cs
Normal file
@ -0,0 +1,53 @@
|
||||
// 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.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
public class TestSceneCatchReplay : TestSceneCatchPlayer
|
||||
{
|
||||
protected override bool Autoplay => true;
|
||||
|
||||
private const int object_count = 10;
|
||||
|
||||
[Test]
|
||||
public void TestReplayCatcherPositionIsFramePerfect()
|
||||
{
|
||||
AddUntilStep("caught all fruits", () => Player.ScoreProcessor.Combo.Value == object_count);
|
||||
}
|
||||
|
||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
||||
{
|
||||
var beatmap = new Beatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = ruleset,
|
||||
}
|
||||
};
|
||||
|
||||
beatmap.ControlPointInfo.Add(0, new TimingControlPoint());
|
||||
|
||||
for (int i = 0; i < object_count / 2; i++)
|
||||
{
|
||||
beatmap.HitObjects.Add(new Fruit
|
||||
{
|
||||
StartTime = (i + 1) * 1000,
|
||||
X = 0
|
||||
});
|
||||
beatmap.HitObjects.Add(new Fruit
|
||||
{
|
||||
StartTime = (i + 1) * 1000 + 1,
|
||||
X = CatchPlayfield.WIDTH
|
||||
});
|
||||
}
|
||||
|
||||
return beatmap;
|
||||
}
|
||||
}
|
||||
}
|
@ -51,8 +51,11 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
droppedObjectContainer,
|
||||
CatcherArea.MovableCatcher.CreateProxiedContent(),
|
||||
HitObjectContainer,
|
||||
HitObjectContainer.CreateProxy(),
|
||||
// This ordering (`CatcherArea` before `HitObjectContainer`) is important to
|
||||
// make sure the up-to-date catcher position is used for the catcher catching logic of hit objects.
|
||||
CatcherArea,
|
||||
HitObjectContainer,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,6 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public IBeatmap Beatmap { get; }
|
||||
|
||||
private CancellationToken cancellationToken;
|
||||
|
||||
protected BeatmapConverter(IBeatmap beatmap, Ruleset ruleset)
|
||||
{
|
||||
Beatmap = beatmap;
|
||||
@ -41,8 +39,6 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public IBeatmap Convert(CancellationToken cancellationToken = default)
|
||||
{
|
||||
this.cancellationToken = cancellationToken;
|
||||
|
||||
// We always operate on a clone of the original beatmap, to not modify it game-wide
|
||||
return ConvertBeatmap(Beatmap.Clone(), cancellationToken);
|
||||
}
|
||||
@ -55,19 +51,6 @@ namespace osu.Game.Beatmaps
|
||||
/// <returns>The converted Beatmap.</returns>
|
||||
protected virtual Beatmap<T> ConvertBeatmap(IBeatmap original, CancellationToken cancellationToken)
|
||||
{
|
||||
#pragma warning disable 618
|
||||
return ConvertBeatmap(original);
|
||||
#pragma warning restore 618
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs the conversion of a Beatmap using this Beatmap Converter.
|
||||
/// </summary>
|
||||
/// <param name="original">The un-converted Beatmap.</param>
|
||||
/// <returns>The converted Beatmap.</returns>
|
||||
[Obsolete("Use the cancellation-supporting override")] // Can be removed 20210318
|
||||
protected virtual Beatmap<T> ConvertBeatmap(IBeatmap original)
|
||||
{
|
||||
var beatmap = CreateBeatmap();
|
||||
|
||||
beatmap.BeatmapInfo = original.BeatmapInfo;
|
||||
@ -121,21 +104,6 @@ namespace osu.Game.Beatmaps
|
||||
/// <param name="beatmap">The un-converted Beatmap.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The converted hit object.</returns>
|
||||
protected virtual IEnumerable<T> ConvertHitObject(HitObject original, IBeatmap beatmap, CancellationToken cancellationToken)
|
||||
{
|
||||
#pragma warning disable 618
|
||||
return ConvertHitObject(original, beatmap);
|
||||
#pragma warning restore 618
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs the conversion of a hit object.
|
||||
/// This method is generally executed sequentially for all objects in a beatmap.
|
||||
/// </summary>
|
||||
/// <param name="original">The hit object to convert.</param>
|
||||
/// <param name="beatmap">The un-converted Beatmap.</param>
|
||||
/// <returns>The converted hit object.</returns>
|
||||
[Obsolete("Use the cancellation-supporting override")] // Can be removed 20210318
|
||||
protected virtual IEnumerable<T> ConvertHitObject(HitObject original, IBeatmap beatmap) => Enumerable.Empty<T>();
|
||||
protected virtual IEnumerable<T> ConvertHitObject(HitObject original, IBeatmap beatmap, CancellationToken cancellationToken) => Enumerable.Empty<T>();
|
||||
}
|
||||
}
|
||||
|
@ -3,16 +3,11 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
public class BeatmapStatistic
|
||||
{
|
||||
[Obsolete("Use CreateIcon instead")] // can be removed 20210203
|
||||
public IconUsage Icon = FontAwesome.Regular.QuestionCircle;
|
||||
|
||||
/// <summary>
|
||||
/// A function to create the icon for display purposes. Use default icons available via <see cref="BeatmapStatisticIcon"/> whenever possible for conformity.
|
||||
/// </summary>
|
||||
@ -20,12 +15,5 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public string Content;
|
||||
public string Name;
|
||||
|
||||
public BeatmapStatistic()
|
||||
{
|
||||
#pragma warning disable 618
|
||||
CreateIcon = () => new SpriteIcon { Icon = Icon, Scale = new Vector2(0.7f) };
|
||||
#pragma warning restore 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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.
|
||||
|
||||
using System.Globalization;
|
||||
using System.Net.Http;
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Game.Online.API;
|
||||
@ -11,11 +12,13 @@ namespace osu.Game.Online.Solo
|
||||
public class CreateSoloScoreRequest : APIRequest<APIScoreToken>
|
||||
{
|
||||
private readonly int beatmapId;
|
||||
private readonly int rulesetId;
|
||||
private readonly string versionHash;
|
||||
|
||||
public CreateSoloScoreRequest(int beatmapId, string versionHash)
|
||||
public CreateSoloScoreRequest(int beatmapId, int rulesetId, string versionHash)
|
||||
{
|
||||
this.beatmapId = beatmapId;
|
||||
this.rulesetId = rulesetId;
|
||||
this.versionHash = versionHash;
|
||||
}
|
||||
|
||||
@ -24,6 +27,7 @@ namespace osu.Game.Online.Solo
|
||||
var req = base.CreateWebRequest();
|
||||
req.Method = HttpMethod.Post;
|
||||
req.AddParameter("version_hash", versionHash);
|
||||
req.AddParameter("ruleset_id", rulesetId.ToString(CultureInfo.InvariantCulture));
|
||||
return req;
|
||||
}
|
||||
|
||||
|
@ -57,13 +57,6 @@ namespace osu.Game.Overlays.Settings
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Use Current instead")] // Can be removed 20210406
|
||||
public Bindable<T> Bindable
|
||||
{
|
||||
get => Current;
|
||||
set => Current = value;
|
||||
}
|
||||
|
||||
public virtual Bindable<T> Current
|
||||
{
|
||||
get => controlWithCurrent.Current;
|
||||
|
@ -28,18 +28,6 @@ namespace osu.Game.Rulesets.Judgements
|
||||
/// </summary>
|
||||
protected const double DEFAULT_MAX_HEALTH_INCREASE = 0.05;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this <see cref="Judgement"/> should affect the current combo.
|
||||
/// </summary>
|
||||
[Obsolete("Has no effect. Use HitResult members instead (e.g. use small-tick or bonus to not affect combo).")] // Can be removed 20210328
|
||||
public virtual bool AffectsCombo => true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this <see cref="Judgement"/> should be counted as base (combo) or bonus score.
|
||||
/// </summary>
|
||||
[Obsolete("Has no effect. Use HitResult members instead (e.g. use small-tick or bonus to not affect combo).")] // Can be removed 20210328
|
||||
public virtual bool IsBonus => !AffectsCombo;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum <see cref="HitResult"/> that can be achieved.
|
||||
/// </summary>
|
||||
|
@ -11,7 +11,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.TypeExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
@ -736,24 +735,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
if (!Result.HasResult)
|
||||
throw new InvalidOperationException($"{GetType().ReadableName()} applied a {nameof(JudgementResult)} but did not update {nameof(JudgementResult.Type)}.");
|
||||
|
||||
// Some (especially older) rulesets use scorable judgements instead of the newer ignorehit/ignoremiss judgements.
|
||||
// Can be removed 20210328
|
||||
if (Result.Judgement.MaxResult == HitResult.IgnoreHit)
|
||||
{
|
||||
HitResult originalType = Result.Type;
|
||||
|
||||
if (Result.Type == HitResult.Miss)
|
||||
Result.Type = HitResult.IgnoreMiss;
|
||||
else if (Result.Type >= HitResult.Meh && Result.Type <= HitResult.Perfect)
|
||||
Result.Type = HitResult.IgnoreHit;
|
||||
|
||||
if (Result.Type != originalType)
|
||||
{
|
||||
Logger.Log($"{GetType().ReadableName()} applied an invalid hit result ({originalType}) when {nameof(HitResult.IgnoreMiss)} or {nameof(HitResult.IgnoreHit)} is expected.\n"
|
||||
+ $"This has been automatically adjusted to {Result.Type}, and support will be removed from 2021-03-28 onwards.", level: LogLevel.Important);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Result.Type.IsValidHitResult(Result.Judgement.MinResult, Result.Judgement.MaxResult))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
|
@ -139,15 +139,6 @@ namespace osu.Game.Rulesets.Objects
|
||||
}
|
||||
|
||||
protected virtual void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||
{
|
||||
// ReSharper disable once MethodSupportsCancellation (https://youtrack.jetbrains.com/issue/RIDER-44520)
|
||||
#pragma warning disable 618
|
||||
CreateNestedHitObjects();
|
||||
#pragma warning restore 618
|
||||
}
|
||||
|
||||
[Obsolete("Use the cancellation-supporting override")] // Can be removed 20210318
|
||||
protected virtual void CreateNestedHitObjects()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -346,12 +346,6 @@ namespace osu.Game.Rulesets.Scoring
|
||||
|
||||
score.HitEvents = hitEvents;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a <see cref="HitWindows"/> for this processor.
|
||||
/// </summary>
|
||||
[Obsolete("Method is now unused.")] // Can be removed 20210328
|
||||
public virtual HitWindows CreateHitWindows() => new HitWindows();
|
||||
}
|
||||
|
||||
public enum ScoringMode
|
||||
|
@ -17,7 +17,10 @@ namespace osu.Game.Screens.Play
|
||||
if (!(Beatmap.Value.BeatmapInfo.OnlineBeatmapID is int beatmapId))
|
||||
return null;
|
||||
|
||||
return new CreateSoloScoreRequest(beatmapId, Game.VersionHash);
|
||||
if (!(Ruleset.Value.ID is int rulesetId))
|
||||
return null;
|
||||
|
||||
return new CreateSoloScoreRequest(beatmapId, rulesetId, Game.VersionHash);
|
||||
}
|
||||
|
||||
protected override bool HandleTokenRetrievalFailure(Exception exception) => false;
|
||||
|
Loading…
Reference in New Issue
Block a user