Merge remote-tracking branch 'refs/remotes/ppy/master' into rankings-tables

This commit is contained in:
Andrei Zavatski 2019-11-28 20:08:41 +03:00
commit da01f0ee5a
5 changed files with 23 additions and 11 deletions

View File

@ -129,6 +129,9 @@ private void readBracket()
ladder = new LadderInfo();
}
if (ladder.Ruleset.Value == null)
ladder.Ruleset.Value = RulesetStore.AvailableRulesets.First();
Ruleset.BindTo(ladder.Ruleset);
dependencies.Cache(ladder);

View File

@ -19,14 +19,8 @@ public LinkFlowContainer(Action<SpriteText> defaultCreationParameters = null)
{
}
private OsuGame game;
[BackgroundDependencyLoader(true)]
private void load(OsuGame game)
{
// will be null in tests
this.game = game;
}
[Resolved(CanBeNull = true)]
private OsuGame game { get; set; }
public void AddLinks(string text, List<Link> links)
{
@ -82,7 +76,7 @@ private void createLink(IEnumerable<Drawable> drawables, LinkDetails link, strin
if (action != null)
action();
else
game.HandleLink(link);
game?.HandleLink(link);
},
});
}

View File

@ -1,4 +1,4 @@
// 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.
using System.Linq;

View File

@ -9,6 +9,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Framework.Threading;
namespace osu.Game.Graphics.UserInterface
{
@ -20,6 +21,11 @@ public class HoverSounds : CompositeDrawable
{
private SampleChannel sampleHover;
/// <summary>
/// Length of debounce for hover sound playback, in milliseconds. Default is 50ms.
/// </summary>
public double HoverDebounceTime { get; set; } = 50;
protected readonly HoverSampleSet SampleSet;
public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
@ -28,9 +34,17 @@ public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
RelativeSizeAxes = Axes.Both;
}
private ScheduledDelegate playDelegate;
protected override bool OnHover(HoverEvent e)
{
sampleHover?.Play();
playDelegate?.Cancel();
if (HoverDebounceTime <= 0)
sampleHover?.Play();
else
playDelegate = Scheduler.AddDelayed(() => sampleHover?.Play(), HoverDebounceTime);
return base.OnHover(e);
}

View File

@ -42,5 +42,6 @@ public enum BeatmapApproval
Ranked,
Approved,
Qualified,
Loved
}
}