mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Merge branch 'master' into add-slider-whistle
This commit is contained in:
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,
|
droppedObjectContainer,
|
||||||
CatcherArea.MovableCatcher.CreateProxiedContent(),
|
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,
|
CatcherArea,
|
||||||
|
HitObjectContainer,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,8 +27,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public IBeatmap Beatmap { get; }
|
public IBeatmap Beatmap { get; }
|
||||||
|
|
||||||
private CancellationToken cancellationToken;
|
|
||||||
|
|
||||||
protected BeatmapConverter(IBeatmap beatmap, Ruleset ruleset)
|
protected BeatmapConverter(IBeatmap beatmap, Ruleset ruleset)
|
||||||
{
|
{
|
||||||
Beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
@ -41,8 +39,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public IBeatmap Convert(CancellationToken cancellationToken = default)
|
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
|
// We always operate on a clone of the original beatmap, to not modify it game-wide
|
||||||
return ConvertBeatmap(Beatmap.Clone(), cancellationToken);
|
return ConvertBeatmap(Beatmap.Clone(), cancellationToken);
|
||||||
}
|
}
|
||||||
@ -55,19 +51,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <returns>The converted Beatmap.</returns>
|
/// <returns>The converted Beatmap.</returns>
|
||||||
protected virtual Beatmap<T> ConvertBeatmap(IBeatmap original, CancellationToken cancellationToken)
|
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();
|
var beatmap = CreateBeatmap();
|
||||||
|
|
||||||
beatmap.BeatmapInfo = original.BeatmapInfo;
|
beatmap.BeatmapInfo = original.BeatmapInfo;
|
||||||
@ -121,21 +104,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <param name="beatmap">The un-converted Beatmap.</param>
|
/// <param name="beatmap">The un-converted Beatmap.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>The converted hit object.</returns>
|
/// <returns>The converted hit object.</returns>
|
||||||
protected virtual IEnumerable<T> ConvertHitObject(HitObject original, IBeatmap beatmap, CancellationToken cancellationToken)
|
protected virtual IEnumerable<T> ConvertHitObject(HitObject original, IBeatmap beatmap, CancellationToken cancellationToken) => Enumerable.Empty<T>();
|
||||||
{
|
|
||||||
#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>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,11 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
public class BeatmapStatistic
|
public class BeatmapStatistic
|
||||||
{
|
{
|
||||||
[Obsolete("Use CreateIcon instead")] // can be removed 20210203
|
|
||||||
public IconUsage Icon = FontAwesome.Regular.QuestionCircle;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A function to create the icon for display purposes. Use default icons available via <see cref="BeatmapStatisticIcon"/> whenever possible for conformity.
|
/// A function to create the icon for display purposes. Use default icons available via <see cref="BeatmapStatisticIcon"/> whenever possible for conformity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -20,12 +15,5 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public string Content;
|
public string Content;
|
||||||
public string Name;
|
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.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Globalization;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using osu.Framework.IO.Network;
|
using osu.Framework.IO.Network;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
@ -11,11 +12,13 @@ namespace osu.Game.Online.Solo
|
|||||||
public class CreateSoloScoreRequest : APIRequest<APIScoreToken>
|
public class CreateSoloScoreRequest : APIRequest<APIScoreToken>
|
||||||
{
|
{
|
||||||
private readonly int beatmapId;
|
private readonly int beatmapId;
|
||||||
|
private readonly int rulesetId;
|
||||||
private readonly string versionHash;
|
private readonly string versionHash;
|
||||||
|
|
||||||
public CreateSoloScoreRequest(int beatmapId, string versionHash)
|
public CreateSoloScoreRequest(int beatmapId, int rulesetId, string versionHash)
|
||||||
{
|
{
|
||||||
this.beatmapId = beatmapId;
|
this.beatmapId = beatmapId;
|
||||||
|
this.rulesetId = rulesetId;
|
||||||
this.versionHash = versionHash;
|
this.versionHash = versionHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,6 +27,7 @@ namespace osu.Game.Online.Solo
|
|||||||
var req = base.CreateWebRequest();
|
var req = base.CreateWebRequest();
|
||||||
req.Method = HttpMethod.Post;
|
req.Method = HttpMethod.Post;
|
||||||
req.AddParameter("version_hash", versionHash);
|
req.AddParameter("version_hash", versionHash);
|
||||||
|
req.AddParameter("ruleset_id", rulesetId.ToString(CultureInfo.InvariantCulture));
|
||||||
return req;
|
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
|
public virtual Bindable<T> Current
|
||||||
{
|
{
|
||||||
get => controlWithCurrent.Current;
|
get => controlWithCurrent.Current;
|
||||||
|
@ -28,18 +28,6 @@ namespace osu.Game.Rulesets.Judgements
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected const double DEFAULT_MAX_HEALTH_INCREASE = 0.05;
|
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>
|
/// <summary>
|
||||||
/// The maximum <see cref="HitResult"/> that can be achieved.
|
/// The maximum <see cref="HitResult"/> that can be achieved.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -11,7 +11,6 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Extensions.TypeExtensions;
|
using osu.Framework.Extensions.TypeExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Logging;
|
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
@ -736,24 +735,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
if (!Result.HasResult)
|
if (!Result.HasResult)
|
||||||
throw new InvalidOperationException($"{GetType().ReadableName()} applied a {nameof(JudgementResult)} but did not update {nameof(JudgementResult.Type)}.");
|
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))
|
if (!Result.Type.IsValidHitResult(Result.Judgement.MinResult, Result.Judgement.MaxResult))
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
|
@ -139,15 +139,6 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void CreateNestedHitObjects(CancellationToken cancellationToken)
|
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;
|
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
|
public enum ScoringMode
|
||||||
|
@ -17,7 +17,10 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!(Beatmap.Value.BeatmapInfo.OnlineBeatmapID is int beatmapId))
|
if (!(Beatmap.Value.BeatmapInfo.OnlineBeatmapID is int beatmapId))
|
||||||
return null;
|
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;
|
protected override bool HandleTokenRetrievalFailure(Exception exception) => false;
|
||||||
|
Reference in New Issue
Block a user