Merge branch 'master' into applydefaults-cancellation

This commit is contained in:
smoogipoo
2020-05-25 16:45:30 +09:00
250 changed files with 1607 additions and 1982 deletions

View File

@ -257,7 +257,8 @@ namespace osu.Game.Rulesets.Edit
{
EditorBeatmap.Add(hitObject);
adjustableClock.Seek(hitObject.GetEndTime());
if (adjustableClock.CurrentTime < hitObject.StartTime)
adjustableClock.Seek(hitObject.StartTime);
}
showGridFor(Enumerable.Empty<HitObject>());

View File

@ -11,10 +11,11 @@ namespace osu.Game.Rulesets.Mods
/// <summary>
/// Whether we should allow failing at the current point in time.
/// </summary>
bool AllowFail { get; }
/// <returns>Whether the fail should be allowed to proceed. Return false to block.</returns>
bool PerformFail();
/// <summary>
/// Whether we want to restart on fail. Only used if <see cref="AllowFail"/> is true.
/// Whether we want to restart on fail. Only used if <see cref="PerformFail"/> returns true.
/// </summary>
bool RestartOnFail { get; }
}

View File

@ -27,7 +27,8 @@ namespace osu.Game.Rulesets.Mods
public override string Description => "Watch a perfect automated play through the song.";
public override double ScoreMultiplier => 1;
public bool AllowFail => false;
public bool PerformFail() => false;
public bool RestartOnFail => false;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };

View File

@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Mods
/// <summary>
/// We never fail, 'yo.
/// </summary>
public bool AllowFail => false;
public bool PerformFail() => false;
public bool RestartOnFail => false;

View File

@ -48,17 +48,14 @@ namespace osu.Game.Rulesets.Mods
retries = Retries.Value;
}
public bool AllowFail
public bool PerformFail()
{
get
{
if (retries == 0) return true;
if (retries == 0) return true;
health.Value = health.MaxValue;
retries--;
health.Value = health.MaxValue;
retries--;
return false;
}
return false;
}
public bool RestartOnFail => false;

View File

@ -20,7 +20,8 @@ namespace osu.Game.Rulesets.Mods
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) };
public bool AllowFail => true;
public bool PerformFail() => true;
public bool RestartOnFail => true;
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)

View File

@ -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;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Utils;
@ -46,6 +47,16 @@ namespace osu.Game.Rulesets.Objects
for (double t = currentTimingPoint.Time; Precision.DefinitelyBigger(endTime, t); t += barLength, currentBeat++)
{
var roundedTime = Math.Round(t, MidpointRounding.AwayFromZero);
// in the case of some bar lengths, rounding errors can cause t to be slightly less than
// the expected whole number value due to floating point inaccuracies.
// if this is the case, apply rounding.
if (Precision.AlmostEquals(t, roundedTime))
{
t = roundedTime;
}
BarLines.Add(new TBarLine
{
StartTime = t,

View File

@ -11,13 +11,13 @@ using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Threading;
using osu.Framework.Audio;
using osu.Game.Audio;
using osu.Game.Rulesets.Judgements;
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
@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
protected SkinnableSound Samples { get; private set; }
protected virtual IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples;
public virtual IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples;
private readonly Lazy<List<DrawableHitObject>> nestedHitObjects = new Lazy<List<DrawableHitObject>>();
public IReadOnlyList<DrawableHitObject> NestedHitObjects => nestedHitObjects.IsValueCreated ? nestedHitObjects.Value : (IReadOnlyList<DrawableHitObject>)Array.Empty<DrawableHitObject>();
@ -96,8 +96,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// </remarks>
protected virtual float SamplePlaybackPosition => 0.5f;
private readonly BindableDouble balanceAdjust = new BindableDouble();
private BindableList<HitSampleInfo> samplesBindable;
private Bindable<double> startTimeBindable;
private Bindable<bool> userPositionalHitSounds;
@ -173,7 +171,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
}
Samples = new SkinnableSound(samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)));
Samples.AddAdjustment(AdjustableProperty.Balance, balanceAdjust);
AddInternal(Samples);
}
@ -352,6 +349,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
{
}
[Resolved(canBeNull: true)]
private GameplayClock gameplayClock { get; set; }
/// <summary>
/// Plays all the hit sounds for this <see cref="DrawableHitObject"/>.
/// This is invoked automatically when this <see cref="DrawableHitObject"/> is hit.
@ -360,8 +360,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
{
const float balance_adjust_amount = 0.4f;
balanceAdjust.Value = balance_adjust_amount * (userPositionalHitSounds.Value ? SamplePlaybackPosition - 0.5f : 0);
Samples?.Play();
if (Samples != null && gameplayClock?.IsSeeking != true)
{
Samples.Balance.Value = balance_adjust_amount * (userPositionalHitSounds.Value ? SamplePlaybackPosition - 0.5f : 0);
Samples.Play();
}
}
protected override void Update()

View File

@ -29,14 +29,16 @@ namespace osu.Game.Rulesets.UI
/// </summary>
internal bool FrameStablePlayback = true;
[Cached]
public GameplayClock GameplayClock { get; }
public GameplayClock GameplayClock => stabilityGameplayClock;
[Cached(typeof(GameplayClock))]
private readonly StabilityGameplayClock stabilityGameplayClock;
public FrameStabilityContainer(double gameplayStartTime = double.MinValue)
{
RelativeSizeAxes = Axes.Both;
GameplayClock = new GameplayClock(framedClock = new FramedClock(manualClock = new ManualClock()));
stabilityGameplayClock = new StabilityGameplayClock(framedClock = new FramedClock(manualClock = new ManualClock()));
this.gameplayStartTime = gameplayStartTime;
}
@ -57,7 +59,7 @@ namespace osu.Game.Rulesets.UI
{
if (clock != null)
{
parentGameplayClock = clock;
stabilityGameplayClock.ParentGameplayClock = parentGameplayClock = clock;
GameplayClock.IsPaused.BindTo(clock.IsPaused);
}
}
@ -187,5 +189,17 @@ namespace osu.Game.Rulesets.UI
}
public ReplayInputHandler ReplayInputHandler { get; set; }
private class StabilityGameplayClock : GameplayClock
{
public IFrameBasedClock ParentGameplayClock;
public StabilityGameplayClock(FramedClock underlyingClock)
: base(underlyingClock)
{
}
public override bool IsSeeking => ParentGameplayClock != null && Math.Abs(CurrentTime - ParentGameplayClock.CurrentTime) > 200;
}
}
}

View File

@ -22,8 +22,7 @@ namespace osu.Game.Rulesets.UI.Scrolling.Algorithms
public double GetDisplayStartTime(double originTime, float offset, double timeRange, float scrollLength)
{
double adjustedTime = TimeAt(-offset, originTime, timeRange, scrollLength);
return adjustedTime - timeRange - 1000;
return TimeAt(-(scrollLength + offset), originTime, timeRange, scrollLength);
}
public float GetLength(double startTime, double endTime, double timeRange, float scrollLength)