Merge branch 'master' into fix-select-new-from-sub-screen

This commit is contained in:
smoogipoo
2020-04-21 14:36:53 +09:00
58 changed files with 1293 additions and 340 deletions

View File

@ -28,8 +28,15 @@ namespace osu.Game.Screens.Select
{
public class BeatmapCarousel : CompositeDrawable, IKeyBindingHandler<GlobalAction>
{
private const float bleed_top = FilterControl.HEIGHT;
private const float bleed_bottom = Footer.HEIGHT;
/// <summary>
/// Height of the area above the carousel that should be treated as visible due to transparency of elements in front of it.
/// </summary>
public float BleedTop { get; set; }
/// <summary>
/// Height of the area below the carousel that should be treated as visible due to transparency of elements in front of it.
/// </summary>
public float BleedBottom { get; set; }
/// <summary>
/// Triggered when the <see cref="BeatmapSets"/> loaded change and are completely loaded.
@ -376,17 +383,17 @@ namespace osu.Game.Screens.Select
/// the beatmap carousel bleeds into the <see cref="FilterControl"/> and the <see cref="Footer"/>
/// </remarks>
/// </summary>
private float visibleHalfHeight => (DrawHeight + bleed_bottom + bleed_top) / 2;
private float visibleHalfHeight => (DrawHeight + BleedBottom + BleedTop) / 2;
/// <summary>
/// The position of the lower visible bound with respect to the current scroll position.
/// </summary>
private float visibleBottomBound => scroll.Current + DrawHeight + bleed_bottom;
private float visibleBottomBound => scroll.Current + DrawHeight + BleedBottom;
/// <summary>
/// The position of the upper visible bound with respect to the current scroll position.
/// </summary>
private float visibleUpperBound => scroll.Current - bleed_top;
private float visibleUpperBound => scroll.Current - BleedTop;
public void FlushPendingFilterOperations()
{
@ -644,7 +651,11 @@ namespace osu.Game.Screens.Select
case DrawableCarouselBeatmap beatmap:
{
if (beatmap.Item.State.Value == CarouselItemState.Selected)
scrollTarget = currentY + beatmap.DrawHeight / 2 - DrawHeight / 2;
// scroll position at currentY makes the set panel appear at the very top of the carousel's screen space
// move down by half of visible height (height of the carousel's visible extent, including semi-transparent areas)
// then reapply the top semi-transparent area (because carousel's screen space starts below it)
// and finally add half of the panel's own height to achieve vertical centering of the panel itself
scrollTarget = currentY - visibleHalfHeight + BleedTop + beatmap.DrawHeight / 2;
void performMove(float y, float? startY = null)
{

View File

@ -153,6 +153,8 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.Both,
BleedTop = FilterControl.HEIGHT,
BleedBottom = Footer.HEIGHT,
SelectionChanged = updateSelectedBeatmap,
BeatmapSetsChanged = carouselBeatmapsLoaded,
GetRecommendedBeatmap = recommender.GetRecommendedBeatmap,
@ -426,7 +428,7 @@ namespace osu.Game.Screens.Select
}
/// <summary>
/// selection has been changed as the result of a user interaction.
/// Selection has been changed as the result of a user interaction.
/// </summary>
private void performUpdateSelected()
{
@ -435,7 +437,7 @@ namespace osu.Game.Screens.Select
selectionChangedDebounce?.Cancel();
if (beatmap == null)
if (beatmapNoDebounce == null)
run();
else
selectionChangedDebounce = Scheduler.AddDelayed(run, 200);
@ -448,9 +450,11 @@ namespace osu.Game.Screens.Select
{
Mods.Value = Array.Empty<Mod>();
// required to return once in order to have the carousel in a good state.
// if the ruleset changed, the rest of the selection update will happen via updateSelectedRuleset.
return;
// transferRulesetValue() may trigger a refilter. If the current selection does not match the new ruleset, we want to switch away from it.
// The default logic on WorkingBeatmap change is to switch to a matching ruleset (see workingBeatmapChanged()), but we don't want that here.
// We perform an early selection attempt and clear out the beatmap selection to avoid a second ruleset change (revert).
if (beatmap != null && !Carousel.SelectBeatmap(beatmap, false))
beatmap = null;
}
// We may be arriving here due to another component changing the bindable Beatmap.
@ -714,7 +718,7 @@ namespace osu.Game.Screens.Select
if (decoupledRuleset.Value?.Equals(Ruleset.Value) == true)
return false;
Logger.Log($"decoupled ruleset transferred (\"{decoupledRuleset.Value}\" -> \"{Ruleset.Value}\"");
Logger.Log($"decoupled ruleset transferred (\"{decoupledRuleset.Value}\" -> \"{Ruleset.Value}\")");
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
// if we have a pending filter operation, we want to run it now.