Merge branch 'master' into adjust-hp-increases

This commit is contained in:
Dean Herbert
2020-10-01 16:58:29 +09:00
committed by GitHub
73 changed files with 752 additions and 434 deletions

View File

@ -15,12 +15,12 @@ namespace osu.Game.Rulesets.Judgements
/// <summary>
/// The score awarded for a small bonus.
/// </summary>
public const double SMALL_BONUS_SCORE = 10;
public const int SMALL_BONUS_SCORE = 10;
/// <summary>
/// The score awarded for a large bonus.
/// </summary>
public const double LARGE_BONUS_SCORE = 50;
public const int LARGE_BONUS_SCORE = 50;
/// <summary>
/// The default health increase for a maximum judgement, as a proportion of total health.
@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Judgements
/// <summary>
/// The numeric score representation for the maximum achievable result.
/// </summary>
public double MaxNumericResult => ToNumericResult(MaxResult);
public int MaxNumericResult => ToNumericResult(MaxResult);
/// <summary>
/// The health increase for the maximum achievable result.
@ -82,19 +82,19 @@ namespace osu.Game.Rulesets.Judgements
public double MaxHealthIncrease => HealthIncreaseFor(MaxResult);
/// <summary>
/// Retrieves the numeric score representation of a <see cref="JudgementResult"/>.
/// Retrieves the numeric score representation of a <see cref="HitResult"/>.
/// </summary>
/// <param name="result">The <see cref="JudgementResult"/> to find the numeric score representation for.</param>
/// <param name="result">The <see cref="HitResult"/> to find the numeric score representation for.</param>
/// <returns>The numeric score representation of <paramref name="result"/>.</returns>
[Obsolete("Has no effect. Use ToNumericResult(HitResult) (standardised across all rulesets).")] // Can be removed 20210328
protected virtual int NumericResultFor(HitResult result) => result == HitResult.Miss ? 0 : 1;
[Obsolete("Has no effect. Use ToNumericResult(HitResult) (standardised across all rulesets).")] // Can be made non-virtual 20210328
protected virtual int NumericResultFor(HitResult result) => ToNumericResult(result);
/// <summary>
/// Retrieves the numeric score representation of a <see cref="JudgementResult"/>.
/// </summary>
/// <param name="result">The <see cref="JudgementResult"/> to find the numeric score representation for.</param>
/// <returns>The numeric score representation of <paramref name="result"/>.</returns>
public double NumericResultFor(JudgementResult result) => ToNumericResult(result.Type);
public int NumericResultFor(JudgementResult result) => ToNumericResult(result.Type);
/// <summary>
/// Retrieves the numeric health increase of a <see cref="HitResult"/>.
@ -155,7 +155,7 @@ namespace osu.Game.Rulesets.Judgements
public override string ToString() => $"MaxResult:{MaxResult} MaxScore:{MaxNumericResult}";
public static double ToNumericResult(HitResult result)
public static int ToNumericResult(HitResult result)
{
switch (result)
{
@ -163,25 +163,25 @@ namespace osu.Game.Rulesets.Judgements
return 0;
case HitResult.SmallTickHit:
return 1 / 30d;
return 10;
case HitResult.LargeTickHit:
return 1 / 10d;
return 30;
case HitResult.Meh:
return 1 / 6d;
return 50;
case HitResult.Ok:
return 1 / 3d;
return 100;
case HitResult.Good:
return 2 / 3d;
return 200;
case HitResult.Great:
return 1d;
return 300;
case HitResult.Perfect:
return 7 / 6d;
return 350;
case HitResult.SmallBonus:
return SMALL_BONUS_SCORE;

View File

@ -1,7 +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 osu.Framework.Audio.Sample;
using osu.Framework.Graphics.Audio;
namespace osu.Game.Rulesets.Mods
{
@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Mods
/// </summary>
public interface IApplicableToSample : IApplicableMod
{
void ApplyToSample(SampleChannel sample);
void ApplyToSample(DrawableSample sample);
}
}

View File

@ -52,10 +52,10 @@ namespace osu.Game.Rulesets.Mods
public class NightcoreBeatContainer : BeatSyncedContainer
{
private SkinnableSound hatSample;
private SkinnableSound clapSample;
private SkinnableSound kickSample;
private SkinnableSound finishSample;
private PausableSkinnableSound hatSample;
private PausableSkinnableSound clapSample;
private PausableSkinnableSound kickSample;
private PausableSkinnableSound finishSample;
private int? firstBeat;
@ -69,10 +69,10 @@ namespace osu.Game.Rulesets.Mods
{
InternalChildren = new Drawable[]
{
hatSample = new SkinnableSound(new SampleInfo("nightcore-hat")),
clapSample = new SkinnableSound(new SampleInfo("nightcore-clap")),
kickSample = new SkinnableSound(new SampleInfo("nightcore-kick")),
finishSample = new SkinnableSound(new SampleInfo("nightcore-finish")),
hatSample = new PausableSkinnableSound(new SampleInfo("nightcore-hat")),
clapSample = new PausableSkinnableSound(new SampleInfo("nightcore-clap")),
kickSample = new PausableSkinnableSound(new SampleInfo("nightcore-kick")),
finishSample = new PausableSkinnableSound(new SampleInfo("nightcore-finish")),
};
}

View File

@ -2,9 +2,9 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Audio;
namespace osu.Game.Rulesets.Mods
{
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mods
track.AddAdjustment(AdjustableProperty.Tempo, SpeedChange);
}
public virtual void ApplyToSample(SampleChannel sample)
public virtual void ApplyToSample(DrawableSample sample)
{
sample.AddAdjustment(AdjustableProperty.Frequency, SpeedChange);
}

View File

@ -6,11 +6,11 @@ using System.Linq;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Audio;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.Objects;
using osu.Framework.Audio.Sample;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mods
{
@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Mods
AdjustPitch.TriggerChange();
}
public void ApplyToSample(SampleChannel sample)
public void ApplyToSample(DrawableSample sample)
{
sample.AddAdjustment(AdjustableProperty.Frequency, SpeedChange);
}

View File

@ -10,6 +10,7 @@ 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;
@ -17,7 +18,6 @@ using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
using osu.Game.Configuration;
using osu.Game.Screens.Play;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Objects.Drawables
@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// </summary>
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>(Color4.Gray);
protected SkinnableSound Samples { get; private set; }
protected PausableSkinnableSound Samples { get; private set; }
public virtual IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples;
@ -179,7 +179,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
+ $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}.");
}
Samples = new SkinnableSound(samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)));
Samples = new PausableSkinnableSound(samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)));
AddInternal(Samples);
}
@ -359,9 +359,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
{
}
[Resolved(canBeNull: true)]
private GameplayClock gameplayClock { get; set; }
/// <summary>
/// Calculate the position to be used for sample playback at a specified X position (0..1).
/// </summary>
@ -374,18 +371,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
return balance_adjust_amount * (userPositionalHitSounds.Value ? position - 0.5f : 0);
}
/// <summary>
/// Whether samples should currently be playing. Will be false during seek operations.
/// </summary>
protected bool ShouldPlaySamples => gameplayClock?.IsSeeking != true;
/// <summary>
/// Plays all the hit sounds for this <see cref="DrawableHitObject"/>.
/// This is invoked automatically when this <see cref="DrawableHitObject"/> is hit.
/// </summary>
public virtual void PlaySamples()
{
if (Samples != null && ShouldPlaySamples)
if (Samples != null)
{
Samples.Balance.Value = CalculateSamplePlaybackBalance(SamplePlaybackPosition);
Samples.Play();
@ -476,12 +468,21 @@ namespace osu.Game.Rulesets.Objects.Drawables
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 2020-03-28 onwards.", level: LogLevel.Important);
}
}
if (!Result.Type.IsValidHitResult(Result.Judgement.MinResult, Result.Judgement.MaxResult))

View File

@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Scoring
/// </summary>
[Description(@"")]
[Order(14)]
None = 0,
None,
/// <summary>
/// Indicates that the object has been judged as a miss.
@ -26,15 +26,12 @@ namespace osu.Game.Rulesets.Scoring
/// </remarks>
[Description(@"Miss")]
[Order(5)]
Miss = 64,
Miss,
[Description(@"Meh")]
[Order(4)]
Meh,
/// <summary>
/// Optional judgement.
/// </summary>
[Description(@"OK")]
[Order(3)]
Ok,
@ -47,9 +44,6 @@ namespace osu.Game.Rulesets.Scoring
[Order(1)]
Great,
/// <summary>
/// Optional judgement.
/// </summary>
[Description(@"Perfect")]
[Order(0)]
Perfect,
@ -58,7 +52,7 @@ namespace osu.Game.Rulesets.Scoring
/// Indicates small tick miss.
/// </summary>
[Order(11)]
SmallTickMiss = 128,
SmallTickMiss,
/// <summary>
/// Indicates a small tick hit.
@ -71,7 +65,7 @@ namespace osu.Game.Rulesets.Scoring
/// Indicates a large tick miss.
/// </summary>
[Order(10)]
LargeTickMiss = 192,
LargeTickMiss,
/// <summary>
/// Indicates a large tick hit.
@ -85,20 +79,20 @@ namespace osu.Game.Rulesets.Scoring
/// </summary>
[Description("S Bonus")]
[Order(9)]
SmallBonus = 254,
SmallBonus,
/// <summary>
/// Indicates a large bonus.
/// </summary>
[Description("L Bonus")]
[Order(8)]
LargeBonus = 320,
LargeBonus,
/// <summary>
/// Indicates a miss that should be ignored for scoring purposes.
/// </summary>
[Order(13)]
IgnoreMiss = 384,
IgnoreMiss,
/// <summary>
/// Indicates a hit that should be ignored for scoring purposes.

View File

@ -2,7 +2,10 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Timing;
@ -59,7 +62,7 @@ namespace osu.Game.Rulesets.UI
{
if (clock != null)
{
stabilityGameplayClock.ParentGameplayClock = parentGameplayClock = clock;
parentGameplayClock = stabilityGameplayClock.ParentGameplayClock = clock;
GameplayClock.IsPaused.BindTo(clock.IsPaused);
}
}
@ -215,7 +218,9 @@ namespace osu.Game.Rulesets.UI
private class StabilityGameplayClock : GameplayClock
{
public IFrameBasedClock ParentGameplayClock;
public GameplayClock ParentGameplayClock;
public override IEnumerable<Bindable<double>> NonGameplayAdjustments => ParentGameplayClock?.NonGameplayAdjustments ?? Enumerable.Empty<Bindable<double>>();
public StabilityGameplayClock(FramedClock underlyingClock)
: base(underlyingClock)