mirror of
https://github.com/ppy/osu
synced 2025-01-09 23:59:44 +00:00
Merge remote-tracking branch 'upstream/master' into fix-checkbox-sounds
This commit is contained in:
commit
d771c271a3
@ -17,6 +17,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
private bool exitAction;
|
||||
|
||||
protected override double TimePerAction => 100; // required for the early exit test, since hold-to-confirm delay is 200ms
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Screens.Menu;
|
||||
|
||||
@ -12,7 +13,13 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestSceneHoldToConfirmOverlay : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ExitConfirmOverlay) };
|
||||
protected override double TimePerAction => 100; // required for the early exit test, since hold-to-confirm delay is 200ms
|
||||
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(ExitConfirmOverlay),
|
||||
typeof(HoldToConfirmContainer),
|
||||
};
|
||||
|
||||
public TestSceneHoldToConfirmOverlay()
|
||||
{
|
||||
|
@ -12,9 +12,11 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
public Action Action;
|
||||
|
||||
private const int activate_delay = 400;
|
||||
private const int default_activation_delay = 200;
|
||||
private const int fadeout_delay = 200;
|
||||
|
||||
private readonly double activationDelay;
|
||||
|
||||
private bool fired;
|
||||
private bool confirming;
|
||||
|
||||
@ -25,13 +27,22 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
public Bindable<double> Progress = new BindableDouble();
|
||||
|
||||
/// <summary>
|
||||
/// Create a new instance.
|
||||
/// </summary>
|
||||
/// <param name="activationDelay">The time requried before an action is confirmed.</param>
|
||||
protected HoldToConfirmContainer(double activationDelay = default_activation_delay)
|
||||
{
|
||||
this.activationDelay = activationDelay;
|
||||
}
|
||||
|
||||
protected void BeginConfirm()
|
||||
{
|
||||
if (confirming || (!AllowMultipleFires && fired)) return;
|
||||
|
||||
confirming = true;
|
||||
|
||||
this.TransformBindableTo(Progress, 1, activate_delay * (1 - Progress.Value), Easing.Out).OnComplete(_ => Confirm());
|
||||
this.TransformBindableTo(Progress, 1, activationDelay * (1 - Progress.Value), Easing.Out).OnComplete(_ => Confirm());
|
||||
}
|
||||
|
||||
protected virtual void Confirm()
|
||||
|
@ -140,6 +140,9 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
{
|
||||
if (string.IsNullOrEmpty(content)) return;
|
||||
|
||||
// newlines could be contained in API returned user content.
|
||||
content = content.Replace("\n", " ");
|
||||
|
||||
bottomLinkContainer.AddIcon(icon, text =>
|
||||
{
|
||||
text.Font = text.Font.With(size: 10);
|
||||
|
@ -24,7 +24,7 @@ using osu.Game.Screens.Select.Carousel;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class BeatmapCarousel : OsuScrollContainer
|
||||
public class BeatmapCarousel : CompositeDrawable
|
||||
{
|
||||
private const float bleed_top = FilterControl.HEIGHT;
|
||||
private const float bleed_bottom = Footer.HEIGHT;
|
||||
@ -61,6 +61,8 @@ namespace osu.Game.Screens.Select
|
||||
/// </summary>
|
||||
public bool BeatmapSetsLoaded { get; private set; }
|
||||
|
||||
private readonly OsuScrollContainer scroll;
|
||||
|
||||
private IEnumerable<CarouselBeatmapSet> beatmapSets => root.Children.OfType<CarouselBeatmapSet>();
|
||||
|
||||
public IEnumerable<BeatmapSetInfo> BeatmapSets
|
||||
@ -110,13 +112,17 @@ namespace osu.Game.Screens.Select
|
||||
public BeatmapCarousel()
|
||||
{
|
||||
root = new CarouselRoot(this);
|
||||
Child = new OsuContextMenuContainer
|
||||
InternalChild = new OsuContextMenuContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = scrollableContent = new Container<DrawableCarouselItem>
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = scroll = new CarouselScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Masking = false,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = scrollableContent = new Container<DrawableCarouselItem>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -127,7 +133,7 @@ namespace osu.Game.Screens.Select
|
||||
config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm);
|
||||
config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled);
|
||||
|
||||
RightClickScrollingEnabled.ValueChanged += enabled => RightMouseScrollbar = enabled.NewValue;
|
||||
RightClickScrollingEnabled.ValueChanged += enabled => scroll.RightMouseScrollbar = enabled.NewValue;
|
||||
RightClickScrollingEnabled.TriggerChange();
|
||||
|
||||
loadBeatmapSets(beatmaps.GetAllUsableBeatmapSetsEnumerable());
|
||||
@ -351,12 +357,12 @@ namespace osu.Game.Screens.Select
|
||||
/// <summary>
|
||||
/// The position of the lower visible bound with respect to the current scroll position.
|
||||
/// </summary>
|
||||
private float visibleBottomBound => Current + DrawHeight + bleed_bottom;
|
||||
private float visibleBottomBound => scroll.Current + DrawHeight + bleed_bottom;
|
||||
|
||||
/// <summary>
|
||||
/// The position of the upper visible bound with respect to the current scroll position.
|
||||
/// </summary>
|
||||
private float visibleUpperBound => Current - bleed_top;
|
||||
private float visibleUpperBound => scroll.Current - bleed_top;
|
||||
|
||||
public void FlushPendingFilterOperations()
|
||||
{
|
||||
@ -628,7 +634,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void updateScrollPosition()
|
||||
{
|
||||
if (scrollTarget != null) ScrollTo(scrollTarget.Value);
|
||||
if (scrollTarget != null) scroll.ScrollTo(scrollTarget.Value);
|
||||
scrollPositionCache.Validate();
|
||||
}
|
||||
|
||||
@ -688,5 +694,35 @@ namespace osu.Game.Screens.Select
|
||||
base.PerformSelection();
|
||||
}
|
||||
}
|
||||
|
||||
private class CarouselScrollContainer : OsuScrollContainer
|
||||
{
|
||||
private bool rightMouseScrollBlocked;
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
if (e.Button == MouseButton.Right)
|
||||
{
|
||||
// we need to block right click absolute scrolling when hovering a carousel item so context menus can display.
|
||||
// this can be reconsidered when we have an alternative to right click scrolling.
|
||||
if (GetContainingInputManager().HoveredDrawables.OfType<DrawableCarouselItem>().Any())
|
||||
{
|
||||
rightMouseScrollBlocked = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
rightMouseScrollBlocked = false;
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override bool OnDragStart(DragStartEvent e)
|
||||
{
|
||||
if (rightMouseScrollBlocked)
|
||||
return false;
|
||||
|
||||
return base.OnDragStart(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,6 @@ namespace osu.Game.Screens.Select
|
||||
},
|
||||
Child = Carousel = new BeatmapCarousel
|
||||
{
|
||||
Masking = false,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(1 - wedged_container_size.X, 1),
|
||||
Anchor = Anchor.CentreRight,
|
||||
|
Loading…
Reference in New Issue
Block a user