Merge branch 'master' into fix-hit-error-ticks-outside-bounds

This commit is contained in:
Dan Balasescu
2020-03-09 09:16:51 +09:00
committed by GitHub
217 changed files with 3859 additions and 1576 deletions

View File

@ -15,7 +15,6 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Play.HUD;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Play
{
@ -63,15 +62,9 @@ namespace osu.Game.Screens.Play
set
{
if (value)
{
loading.Show();
backgroundSprite.FadeColour(OsuColour.Gray(0.5f), 400, Easing.OutQuint);
}
else
{
loading.Hide();
backgroundSprite.FadeColour(Color4.White, 400, Easing.OutQuint);
}
}
}
@ -138,7 +131,7 @@ namespace osu.Game.Screens.Play
Anchor = Anchor.Centre,
FillMode = FillMode.Fill,
},
loading = new LoadingSpinner { Scale = new Vector2(1.3f) }
loading = new LoadingLayer(backgroundSprite)
}
},
new OsuSpriteText

View File

@ -123,6 +123,10 @@ namespace osu.Game.Screens.Play
public void Restart()
{
// The Reset() call below causes speed adjustments to be reset in an async context, leading to deadlocks.
// The deadlock can be prevented by resetting the track synchronously before entering the async context.
track.ResetSpeedAdjustments();
Task.Run(() =>
{
track.Reset();

View File

@ -12,7 +12,6 @@ using osu.Game.Graphics;
using osu.Framework.Allocation;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics.Shapes;
using osuTK.Input;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Input.Bindings;
@ -204,35 +203,24 @@ namespace osu.Game.Screens.Play
InternalButtons[selectionIndex].Selected.Value = true;
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (!e.Repeat)
{
switch (e.Key)
{
case Key.Up:
if (selectionIndex == -1 || selectionIndex == 0)
setSelected(InternalButtons.Count - 1);
else
setSelected(selectionIndex - 1);
return true;
case Key.Down:
if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1)
setSelected(0);
else
setSelected(selectionIndex + 1);
return true;
}
}
return base.OnKeyDown(e);
}
public bool OnPressed(GlobalAction action)
{
switch (action)
{
case GlobalAction.SelectPrevious:
if (selectionIndex == -1 || selectionIndex == 0)
setSelected(InternalButtons.Count - 1);
else
setSelected(selectionIndex - 1);
return true;
case GlobalAction.SelectNext:
if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1)
setSelected(0);
else
setSelected(selectionIndex + 1);
return true;
case GlobalAction.Back:
BackAction.Invoke();
return true;

View File

@ -13,12 +13,5 @@ namespace osu.Game.Screens.Play.HUD
MinValue = 0,
MaxValue = 1
};
protected HealthDisplay()
{
Current.ValueChanged += health => SetHealth((float)health.NewValue);
}
protected abstract void SetHealth(float value);
}
}

View File

@ -208,11 +208,27 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
private double floatingAverage;
private Container colourBars;
private const int max_concurrent_judgements = 50;
public override void OnNewJudgement(JudgementResult judgement)
{
if (!judgement.IsHit)
return;
if (judgementsContainer.Count > max_concurrent_judgements)
{
const double quick_fade_time = 100;
// check with a bit of lenience to avoid precision error in comparison.
var old = judgementsContainer.FirstOrDefault(j => j.LifetimeEnd > Clock.CurrentTime + quick_fade_time * 1.1);
if (old != null)
{
old.ClearTransforms();
old.FadeOut(quick_fade_time).Expire();
}
}
judgementsContainer.Add(new JudgementLine
{
Y = getRelativeJudgementPosition(judgement.TimeOffset),
@ -229,7 +245,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
private class JudgementLine : CompositeDrawable
{
private const int judgement_fade_duration = 10000;
private const int judgement_fade_duration = 5000;
public JudgementLine()
{
@ -256,7 +272,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
Width = 0;
this.ResizeWidthTo(1, 200, Easing.OutElasticHalf);
this.FadeTo(0.8f, 150).Then().FadeOut(judgement_fade_duration, Easing.OutQuint).Expire();
this.FadeTo(0.8f, 150).Then().FadeOut(judgement_fade_duration).Expire();
}
}
}

View File

@ -12,6 +12,7 @@ using osu.Game.Rulesets.Judgements;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Utils;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Screens.Play.HUD
@ -108,11 +109,23 @@ namespace osu.Game.Screens.Play.HUD
if (result.Type == HitResult.Miss)
return;
Scheduler.AddOnce(flash);
}
private void flash()
{
fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, Easing.OutQuint)
.Delay(glow_fade_delay)
.FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, Easing.OutQuint);
}
protected override void SetHealth(float value) => fill.ResizeTo(new Vector2(value, 1), 200, Easing.OutQuint);
protected override void Update()
{
base.Update();
fill.Width = Interpolation.ValueAt(
Math.Clamp(Clock.ElapsedFrameTime, 0, 200),
fill.Width, (float)Current.Value, 0, 200, Easing.OutQuint);
}
}
}

View File

@ -184,7 +184,7 @@ namespace osu.Game.Screens.Play
foreach (var mod in Mods.Value.OfType<IApplicableToHealthProcessor>())
mod.ApplyToHealthProcessor(HealthProcessor);
BreakOverlay.IsBreakTime.ValueChanged += _ => updatePauseOnFocusLostState();
BreakOverlay.IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
}
private void addUnderlayComponents(Container target)
@ -229,7 +229,11 @@ namespace osu.Game.Screens.Play
IsPaused = { BindTarget = GameplayClockContainer.IsPaused }
},
PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } },
KeyCounter = { AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded } },
KeyCounter =
{
AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded },
IsCounting = false
},
RequestSeek = GameplayClockContainer.Seek,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
@ -286,6 +290,12 @@ namespace osu.Game.Screens.Play
HealthProcessor.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
}
private void onBreakTimeChanged(ValueChangedEvent<bool> isBreakTime)
{
updatePauseOnFocusLostState();
HUDOverlay.KeyCounter.IsCounting = !isBreakTime.NewValue;
}
private void updatePauseOnFocusLostState() =>
HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost
&& !DrawableRuleset.HasReplayLoaded.Value
@ -609,9 +619,9 @@ namespace osu.Game.Screens.Play
{
var score = CreateScore();
if (DrawableRuleset.ReplayScore == null)
scoreManager.Import(score).Wait();
this.Push(CreateResults(score));
scoreManager.Import(score).ContinueWith(_ => Schedule(() => this.Push(CreateResults(score))));
else
this.Push(CreateResults(score));
});
}

View File

@ -116,7 +116,7 @@ namespace osu.Game.Screens.Play
{
base.Update();
var progress = Math.Max(0, 1 - (gameplayClock.CurrentTime - displayTime) / (fadeOutBeginTime - displayTime));
var progress = fadeOutBeginTime <= displayTime ? 1 : Math.Max(0, 1 - (gameplayClock.CurrentTime - displayTime) / (fadeOutBeginTime - displayTime));
remainingTimeBox.Width = (float)Interpolation.Lerp(remainingTimeBox.Width, progress, Math.Clamp(Time.Elapsed / 40, 0, 1));

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using osu.Framework;
using osu.Framework.Caching;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -14,6 +13,7 @@ using osuTK;
using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Allocation;
using osu.Framework.Layout;
using osu.Framework.Threading;
namespace osu.Game.Screens.Play
@ -22,6 +22,11 @@ namespace osu.Game.Screens.Play
{
private BufferedContainer<Column> columns;
public SquareGraph()
{
AddLayout(layout);
}
public int ColumnCount => columns?.Children.Count ?? 0;
private int progress;
@ -68,14 +73,7 @@ namespace osu.Game.Screens.Play
}
}
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
{
if ((invalidation & Invalidation.DrawSize) > 0)
layout.Invalidate();
return base.Invalidate(invalidation, source, shallPropagate);
}
private readonly Cached layout = new Cached();
private readonly LayoutValue layout = new LayoutValue(Invalidation.DrawSize);
private ScheduledDelegate scheduledCreate;
protected override void Update()