Merge branch 'master' into sharpen

This commit is contained in:
Huo Yaoyuan
2019-11-21 23:42:46 +08:00
77 changed files with 752 additions and 223 deletions

View File

@ -452,9 +452,6 @@ namespace osu.Game.Screens.Select
if (!itemsCache.IsValid)
updateItems();
if (!scrollPositionCache.IsValid)
updateScrollPosition();
// Remove all items that should no longer be on-screen
scrollableContent.RemoveAll(p => p.Y < visibleUpperBound - p.DrawHeight || p.Y > visibleBottomBound || !p.IsPresent);
@ -519,6 +516,14 @@ namespace osu.Game.Screens.Select
updateItem(p);
}
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
if (!scrollPositionCache.IsValid)
updateScrollPosition();
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
@ -637,8 +642,11 @@ namespace osu.Game.Screens.Select
private void updateScrollPosition()
{
if (scrollTarget != null) scroll.ScrollTo(scrollTarget.Value);
scrollPositionCache.Validate();
if (scrollTarget != null)
{
scroll.ScrollTo(scrollTarget.Value);
scrollPositionCache.Validate();
}
}
/// <summary>
@ -677,7 +685,7 @@ namespace osu.Game.Screens.Select
// We are applying a multiplicative alpha (which is internally done by nesting an
// additional container and setting that container's alpha) such that we can
// layer transformations on top, with a similar reasoning to the previous comment.
p.SetMultiplicativeAlpha(MathHelper.Clamp(1.75f - 1.5f * dist, 0, 1));
p.SetMultiplicativeAlpha(Math.Clamp(1.75f - 1.5f * dist, 0, 1));
}
private class CarouselRoot : CarouselGroupEagerSelect

View File

@ -1,7 +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 osuTK;
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -35,7 +35,7 @@ namespace osu.Game.Screens.Select.Details
retryGraph.MaxValue = maxValue;
failGraph.Values = fails.Select(f => (float)f);
retryGraph.Values = retries.Zip(fails, (retry, fail) => retry + MathHelper.Clamp(fail, 0, maxValue));
retryGraph.Values = retries.Zip(fails, (retry, fail) => retry + Math.Clamp(fail, 0, maxValue));
}
}

View File

@ -46,48 +46,54 @@ namespace osu.Game.Screens.Select
protected const float BACKGROUND_BLUR = 20;
private const float left_area_padding = 20;
public readonly FilterControl FilterControl;
public FilterControl FilterControl { get; private set; }
protected virtual bool ShowFooter => true;
/// <summary>
/// Can be null if <see cref="ShowFooter"/> is false.
/// </summary>
protected readonly BeatmapOptionsOverlay BeatmapOptions;
protected BeatmapOptionsOverlay BeatmapOptions { get; private set; }
/// <summary>
/// Can be null if <see cref="ShowFooter"/> is false.
/// </summary>
protected readonly Footer Footer;
protected Footer Footer { get; private set; }
/// <summary>
/// Contains any panel which is triggered by a footer button.
/// Helps keep them located beneath the footer itself.
/// </summary>
protected readonly Container FooterPanels;
protected Container FooterPanels { get; private set; }
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
protected readonly BeatmapCarousel Carousel;
private readonly BeatmapInfoWedge beatmapInfoWedge;
protected BeatmapCarousel Carousel { get; private set; }
private BeatmapInfoWedge beatmapInfoWedge;
private DialogOverlay dialogOverlay;
private BeatmapManager beatmaps;
protected readonly ModSelectOverlay ModSelect;
protected ModSelectOverlay ModSelect { get; private set; }
protected SampleChannel SampleConfirm { get; private set; }
protected SampleChannel SampleConfirm;
private SampleChannel sampleChangeDifficulty;
private SampleChannel sampleChangeBeatmap;
protected readonly BeatmapDetailArea BeatmapDetails;
protected BeatmapDetailArea BeatmapDetails { get; private set; }
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
[Resolved(canBeNull: true)]
private MusicController music { get; set; }
protected SongSelect()
[BackgroundDependencyLoader(true)]
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
{
// initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
transferRulesetValue();
AddRangeInternal(new Drawable[]
{
new ParallaxContainer
@ -161,7 +167,7 @@ namespace osu.Game.Screens.Select
{
RelativeSizeAxes = Axes.X,
Height = FilterControl.HEIGHT,
FilterChanged = c => Carousel.Filter(c),
FilterChanged = ApplyFilterToCarousel,
Background = { Width = 2 },
},
}
@ -211,11 +217,7 @@ namespace osu.Game.Screens.Select
}
BeatmapDetails.Leaderboard.ScoreSelected += score => this.Push(new SoloResults(score));
}
[BackgroundDependencyLoader(true)]
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
{
if (Footer != null)
{
Footer.AddButton(new FooterButtonMods { Current = Mods }, ModSelect);
@ -258,6 +260,12 @@ namespace osu.Game.Screens.Select
}
}
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria)
{
if (this.IsCurrentScreen())
Carousel.Filter(criteria);
}
private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
@ -429,6 +437,8 @@ namespace osu.Game.Screens.Select
{
base.OnEntering(last);
Carousel.Filter(FilterControl.CreateCriteria(), false);
this.FadeInFromZero(250);
FilterControl.Activate();
}
@ -624,7 +634,7 @@ namespace osu.Game.Screens.Select
return;
// manual binding to parent ruleset to allow for delayed load in the incoming direction.
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
transferRulesetValue();
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
@ -636,6 +646,11 @@ namespace osu.Game.Screens.Select
boundLocalBindables = true;
}
private void transferRulesetValue()
{
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
}
private void delete(BeatmapSetInfo beatmap)
{
if (beatmap == null || beatmap.ID <= 0) return;