Merge remote-tracking branch 'refs/remotes/ppy/master' into beatmap-mod-selector

This commit is contained in:
Andrei Zavatski
2019-09-04 02:46:23 +03:00
90 changed files with 564 additions and 171 deletions

View File

@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Judgements
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText
Child = new SkinnableDrawable(new GameplaySkinComponent<HitResult>(Result.Type), _ => JudgementText = new OsuSpriteText
{
Text = Result.Type.GetDescription().ToUpperInvariant(),
Font = OsuFont.Numeric.With(size: 12),

View File

@ -1,6 +1,8 @@
// 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 JetBrains.Annotations;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
@ -16,9 +18,16 @@ namespace osu.Game.Rulesets.Judgements
/// </summary>
public HitResult Type;
/// <summary>
/// The <see cref="HitObject"/> which was judged.
/// </summary>
[NotNull]
public readonly HitObject HitObject;
/// <summary>
/// The <see cref="Judgement"/> which this <see cref="JudgementResult"/> applies for.
/// </summary>
[NotNull]
public readonly Judgement Judgement;
/// <summary>
@ -55,9 +64,11 @@ namespace osu.Game.Rulesets.Judgements
/// <summary>
/// Creates a new <see cref="JudgementResult"/>.
/// </summary>
/// <param name="hitObject">The <see cref="HitObject"/> which was judged.</param>
/// <param name="judgement">The <see cref="Judgement"/> to refer to for scoring information.</param>
public JudgementResult(Judgement judgement)
public JudgementResult([NotNull] HitObject hitObject, [NotNull] Judgement judgement)
{
HitObject = hitObject;
Judgement = judgement;
}

View File

@ -410,7 +410,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// Creates the <see cref="JudgementResult"/> that represents the scoring result for this <see cref="DrawableHitObject"/>.
/// </summary>
/// <param name="judgement">The <see cref="Judgement"/> that provides the scoring information.</param>
protected virtual JudgementResult CreateResult(Judgement judgement) => new JudgementResult(judgement);
protected virtual JudgementResult CreateResult(Judgement judgement) => new JudgementResult(HitObject, judgement);
}
public abstract class DrawableHitObject<TObject> : DrawableHitObject

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using JetBrains.Annotations;
using Newtonsoft.Json;
using osu.Game.Audio;
using osu.Game.Beatmaps;
@ -56,6 +57,7 @@ namespace osu.Game.Rulesets.Objects
/// <summary>
/// The hit windows for this <see cref="HitObject"/>.
/// </summary>
[CanBeNull]
public HitWindows HitWindows { get; set; }
private readonly List<HitObject> nestedHitObjects = new List<HitObject>();
@ -111,11 +113,12 @@ namespace osu.Game.Rulesets.Objects
/// <summary>
/// Creates the <see cref="HitWindows"/> for this <see cref="HitObject"/>.
/// This can be null to indicate that the <see cref="HitObject"/> has no <see cref="HitWindows"/>.
/// This can be null to indicate that the <see cref="HitObject"/> has no <see cref="HitWindows"/> and timing errors should not be displayed to the user.
/// <para>
/// This will only be invoked if <see cref="HitWindows"/> hasn't been set externally (e.g. from a <see cref="BeatmapConverter{T}"/>.
/// </para>
/// </summary>
[CanBeNull]
protected virtual HitWindows CreateHitWindows() => new HitWindows();
}
}

View File

@ -275,7 +275,7 @@ namespace osu.Game.Rulesets.Scoring
if (judgement == null)
return;
var result = CreateResult(judgement);
var result = CreateResult(obj, judgement);
if (result == null)
throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}.");
@ -441,8 +441,9 @@ namespace osu.Game.Rulesets.Scoring
/// <summary>
/// Creates the <see cref="JudgementResult"/> that represents the scoring result for a <see cref="HitObject"/>.
/// </summary>
/// <param name="hitObject">The <see cref="HitObject"/> which was judged.</param>
/// <param name="judgement">The <see cref="Judgement"/> that provides the scoring information.</param>
protected virtual JudgementResult CreateResult(Judgement judgement) => new JudgementResult(judgement);
protected virtual JudgementResult CreateResult(HitObject hitObject, Judgement judgement) => new JudgementResult(hitObject, judgement);
}
public enum ScoringMode

View File

@ -13,6 +13,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using JetBrains.Annotations;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Input;
@ -390,6 +391,28 @@ namespace osu.Game.Rulesets.UI
/// </summary>
public ResumeOverlay ResumeOverlay { get; protected set; }
/// <summary>
/// Returns first available <see cref="HitWindows"/> provided by a <see cref="HitObject"/>.
/// </summary>
[CanBeNull]
public HitWindows FirstAvailableHitWindows
{
get
{
foreach (var h in Objects)
{
if (h.HitWindows != null)
return h.HitWindows;
foreach (var n in h.NestedHitObjects)
if (n.HitWindows != null)
return n.HitWindows;
}
return null;
}
}
protected virtual ResumeOverlay CreateResumeOverlay() => null;
/// <summary>