Merge remote-tracking branch 'nekodex/master' into update-beatmap-scores-design

# Conflicts:
#	osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs
#	osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs
#	osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs
#	osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs
This commit is contained in:
smoogipoo
2019-03-07 18:48:23 +09:00
647 changed files with 8541 additions and 4176 deletions

View File

@ -3,7 +3,7 @@
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
@ -74,7 +74,7 @@ namespace osu.Game.Graphics.Containers
}
[BackgroundDependencyLoader]
private void load(IBindableBeatmap beatmap)
private void load(IBindable<WorkingBeatmap> beatmap)
{
Beatmap.BindTo(beatmap);
}

View File

@ -15,15 +15,9 @@ namespace osu.Game.Graphics.Containers
{
public Drawable Icon
{
get
{
return InternalChild;
}
get => InternalChild;
set
{
InternalChild = value;
}
set => InternalChild = value;
}
/// <summary>
@ -33,8 +27,8 @@ namespace osu.Game.Graphics.Containers
/// </summary>
public new EdgeEffectParameters EdgeEffect
{
get { return base.EdgeEffect; }
set { base.EdgeEffect = value; }
get => base.EdgeEffect;
set => base.EdgeEffect = value;
}
protected override void Update()

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

View File

@ -4,9 +4,9 @@
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
using osuTK;
using osu.Framework.Configuration;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Audio;
@ -24,7 +24,17 @@ namespace osu.Game.Graphics.Containers
protected override bool BlockNonPositionalInput => true;
private PreviewTrackManager previewTrackManager;
/// <summary>
/// Temporary to allow for overlays in the main screen content to not dim theirselves.
/// Should be eventually replaced by dimming which is aware of the target dim container (traverse parent for certain interface type?).
/// </summary>
protected virtual bool DimMainContent => true;
[Resolved(CanBeNull = true)]
private OsuGame osuGame { get; set; }
[Resolved]
private PreviewTrackManager previewTrackManager { get; set; }
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
@ -36,10 +46,8 @@ namespace osu.Game.Graphics.Containers
}
[BackgroundDependencyLoader(true)]
private void load(OsuGame osuGame, AudioManager audio, PreviewTrackManager previewTrackManager)
private void load(AudioManager audio)
{
this.previewTrackManager = previewTrackManager;
if (osuGame != null)
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
@ -90,15 +98,18 @@ namespace osu.Game.Graphics.Containers
switch (visibility)
{
case Visibility.Visible:
if (OverlayActivationMode != OverlayActivation.Disabled)
if (OverlayActivationMode.Value != OverlayActivation.Disabled)
{
if (PlaySamplesOnStateChange) samplePopIn?.Play();
if (BlockScreenWideMouse && DimMainContent) osuGame?.AddBlockingOverlay(this);
}
else
State = Visibility.Hidden;
break;
case Visibility.Hidden:
if (PlaySamplesOnStateChange) samplePopOut?.Play();
if (BlockScreenWideMouse) osuGame?.RemoveBlockingOverlay(this);
break;
}
}
@ -108,5 +119,11 @@ namespace osu.Game.Graphics.Containers
base.PopOut();
previewTrackManager.StopAnyPlaying(this);
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
osuGame?.RemoveBlockingOverlay(this);
}
}
}

View File

@ -12,7 +12,8 @@ namespace osu.Game.Graphics.Containers
{
public class OsuTextFlowContainer : TextFlowContainer
{
public OsuTextFlowContainer(Action<SpriteText> defaultCreationParameters = null) : base(defaultCreationParameters)
public OsuTextFlowContainer(Action<SpriteText> defaultCreationParameters = null)
: base(defaultCreationParameters)
{
}

View File

@ -6,8 +6,8 @@ using osu.Framework.Graphics;
using osu.Framework.Input;
using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Configuration;
using osu.Framework.Configuration;
using osu.Framework.MathUtils;
namespace osu.Game.Graphics.Containers
@ -45,7 +45,7 @@ namespace osu.Game.Graphics.Containers
parallaxEnabled = config.GetBindable<bool>(OsuSetting.MenuParallax);
parallaxEnabled.ValueChanged += delegate
{
if (!parallaxEnabled)
if (!parallaxEnabled.Value)
{
content.MoveTo(Vector2.Zero, firstUpdate ? 0 : 1000, Easing.OutQuint);
content.Scale = new Vector2(1 + System.Math.Abs(ParallaxAmount));
@ -65,7 +65,7 @@ namespace osu.Game.Graphics.Containers
{
base.Update();
if (parallaxEnabled)
if (parallaxEnabled.Value)
{
Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.Position) - DrawSize / 2) * ParallaxAmount;

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
@ -74,10 +74,10 @@ namespace osu.Game.Graphics.Containers
}
}
private void scaleChanged(float value)
private void scaleChanged(ValueChangedEvent<float> args)
{
this.ScaleTo(new Vector2(value), 500, Easing.Out);
this.ResizeTo(new Vector2(1 / value), 500, Easing.Out);
this.ScaleTo(new Vector2(args.NewValue), 500, Easing.Out);
this.ResizeTo(new Vector2(1 / args.NewValue), 500, Easing.Out);
}
}
@ -108,7 +108,7 @@ namespace osu.Game.Graphics.Containers
sizableContainer.FinishTransforms();
}
private bool requiresBackgroundVisible => (scalingMode == ScalingMode.Everything || scalingMode == ScalingMode.ExcludeOverlays) && (sizeX.Value != 1 || sizeY.Value != 1);
private bool requiresBackgroundVisible => (scalingMode.Value == ScalingMode.Everything || scalingMode.Value == ScalingMode.ExcludeOverlays) && (sizeX.Value != 1 || sizeY.Value != 1);
private void updateSize()
{
@ -137,8 +137,8 @@ namespace osu.Game.Graphics.Containers
bool scaling = targetMode == null || scalingMode.Value == targetMode;
var targetSize = scaling ? new Vector2(sizeX, sizeY) : Vector2.One;
var targetPosition = scaling ? new Vector2(posX, posY) * (Vector2.One - targetSize) : Vector2.Zero;
var targetSize = scaling ? new Vector2(sizeX.Value, sizeY.Value) : Vector2.One;
var targetPosition = scaling ? new Vector2(posX.Value, posY.Value) * (Vector2.One - targetSize) : Vector2.Zero;
bool requiresMasking = scaling && targetSize != Vector2.One;
if (requiresMasking)

View File

@ -3,7 +3,7 @@
using System;
using System.Linq;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -24,7 +24,7 @@ namespace osu.Game.Graphics.Containers
public Drawable ExpandableHeader
{
get { return expandableHeader; }
get => expandableHeader;
set
{
if (value == expandableHeader) return;
@ -40,7 +40,7 @@ namespace osu.Game.Graphics.Containers
public Drawable FixedHeader
{
get { return fixedHeader; }
get => fixedHeader;
set
{
if (value == fixedHeader) return;
@ -56,7 +56,7 @@ namespace osu.Game.Graphics.Containers
public Drawable Footer
{
get { return footer; }
get => footer;
set
{
if (value == footer) return;
@ -75,7 +75,7 @@ namespace osu.Game.Graphics.Containers
public Drawable HeaderBackground
{
get { return headerBackground; }
get => headerBackground;
set
{
if (value == headerBackground) return;
@ -110,6 +110,7 @@ namespace osu.Game.Graphics.Containers
private float headerHeight, footerHeight;
private readonly MarginPadding originalSectionsMargin;
private void updateSectionsMargin()
{
if (!Children.Any()) return;
@ -142,6 +143,7 @@ namespace osu.Game.Graphics.Containers
public void ScrollToTop() => scrollContainer.ScrollTo(0);
private float lastKnownScroll;
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();

View File

@ -0,0 +1,88 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
using osuTK.Graphics;
namespace osu.Game.Graphics.Containers
{
/// <summary>
/// A container that applies user-configured dim levels to its contents.
/// This container specifies behavior that applies to both Storyboards and Backgrounds.
/// </summary>
public class UserDimContainer : Container
{
private const float background_fade_duration = 800;
private Bindable<double> dimLevel { get; set; }
private Bindable<bool> showStoryboard { get; set; }
/// <summary>
/// Whether or not user-configured dim levels should be applied to the container.
/// </summary>
public readonly Bindable<bool> EnableUserDim = new Bindable<bool>();
/// <summary>
/// Whether or not the storyboard loaded should completely hide the background behind it.
/// </summary>
public readonly Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
protected Container DimContainer { get; }
protected override Container<Drawable> Content => DimContainer;
private readonly bool isStoryboard;
/// <summary>
/// Creates a new <see cref="UserDimContainer"/>.
/// </summary>
/// <param name="isStoryboard"> Whether or not this instance of UserDimContainer contains a storyboard.
/// <remarks>
/// While both backgrounds and storyboards allow user dim levels to be applied, storyboards can be toggled via <see cref="showStoryboard"/>
/// and can cause backgrounds to become hidden via <see cref="StoryboardReplacesBackground"/>.
/// </remarks>
/// </param>
public UserDimContainer(bool isStoryboard = false)
{
this.isStoryboard = isStoryboard;
AddInternal(DimContainer = new Container { RelativeSizeAxes = Axes.Both });
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
EnableUserDim.ValueChanged += _ => updateBackgroundDim();
dimLevel.ValueChanged += _ => updateBackgroundDim();
showStoryboard.ValueChanged += _ => updateBackgroundDim();
StoryboardReplacesBackground.ValueChanged += _ => updateBackgroundDim();
}
protected override void LoadComplete()
{
base.LoadComplete();
updateBackgroundDim();
}
private void updateBackgroundDim()
{
if (isStoryboard)
{
DimContainer.FadeTo(!showStoryboard.Value || dimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint);
}
else
{
// The background needs to be hidden in the case of it being replaced by the storyboard
DimContainer.FadeTo(showStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, background_fade_duration, Easing.OutQuint);
}
DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)dimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint);
}
}
}