Merge remote-tracking branch 'upstream/master' into gamewide-backbutton

This commit is contained in:
Dean Herbert 2019-06-25 20:23:49 +09:00
commit f9dad0f640
5 changed files with 118 additions and 67 deletions

View File

@ -88,7 +88,12 @@ namespace osu.Game.Online.API
if (checkAndScheduleFailure()) if (checkAndScheduleFailure())
return; return;
API.Schedule(delegate { Success?.Invoke(); }); API.Schedule(delegate
{
if (cancelled) return;
Success?.Invoke();
});
} }
public void Cancel() => Fail(new OperationCanceledException(@"Request cancelled")); public void Cancel() => Fail(new OperationCanceledException(@"Request cancelled"));

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -40,6 +39,10 @@ namespace osu.Game.Overlays.BeatmapSet
private readonly FavouriteButton favouriteButton; private readonly FavouriteButton favouriteButton;
private readonly FillFlowContainer fadeContent;
private readonly LoadingAnimation loading;
public Header() public Header()
{ {
ExternalLinkButton externalLink; ExternalLinkButton externalLink;
@ -96,8 +99,7 @@ namespace osu.Game.Overlays.BeatmapSet
}, },
new Container new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.Both,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding Padding = new MarginPadding
{ {
Top = 20, Top = 20,
@ -105,7 +107,9 @@ namespace osu.Game.Overlays.BeatmapSet
Left = BeatmapSetOverlay.X_PADDING, Left = BeatmapSetOverlay.X_PADDING,
Right = BeatmapSetOverlay.X_PADDING + BeatmapSetOverlay.RIGHT_WIDTH, Right = BeatmapSetOverlay.X_PADDING + BeatmapSetOverlay.RIGHT_WIDTH,
}, },
Child = new FillFlowContainer Children = new Drawable[]
{
fadeContent = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
@ -162,6 +166,12 @@ namespace osu.Game.Overlays.BeatmapSet
}, },
}, },
}, },
loading = new LoadingAnimation
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
}
}, },
new FillFlowContainer new FillFlowContainer
{ {
@ -187,8 +197,11 @@ namespace osu.Game.Overlays.BeatmapSet
}, },
}; };
Picker.Beatmap.ValueChanged += b => Details.Beatmap = b.NewValue; Picker.Beatmap.ValueChanged += b =>
Picker.Beatmap.ValueChanged += b => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}"; {
Details.Beatmap = b.NewValue;
externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}";
};
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -201,24 +214,35 @@ namespace osu.Game.Overlays.BeatmapSet
BeatmapSet.BindValueChanged(setInfo => BeatmapSet.BindValueChanged(setInfo =>
{ {
Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = setInfo.NewValue; Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = setInfo.NewValue;
title.Text = setInfo.NewValue?.Metadata.Title ?? string.Empty;
artist.Text = setInfo.NewValue?.Metadata.Artist ?? string.Empty;
onlineStatusPill.Status = setInfo.NewValue?.OnlineInfo.Status ?? BeatmapSetOnlineStatus.None;
cover.BeatmapSet = setInfo.NewValue; cover.BeatmapSet = setInfo.NewValue;
if (setInfo.NewValue != null) if (setInfo.NewValue == null)
{
downloadButtonsContainer.FadeIn(transition_duration);
favouriteButton.FadeIn(transition_duration);
}
else
{ {
onlineStatusPill.FadeTo(0.5f, 500, Easing.OutQuint);
fadeContent.Hide();
loading.Show();
downloadButtonsContainer.FadeOut(transition_duration); downloadButtonsContainer.FadeOut(transition_duration);
favouriteButton.FadeOut(transition_duration); favouriteButton.FadeOut(transition_duration);
} }
else
{
fadeContent.FadeIn(500, Easing.OutQuint);
loading.Hide();
title.Text = setInfo.NewValue.Metadata.Title ?? string.Empty;
artist.Text = setInfo.NewValue.Metadata.Artist ?? string.Empty;
onlineStatusPill.FadeIn(500, Easing.OutQuint);
onlineStatusPill.Status = setInfo.NewValue.OnlineInfo.Status;
downloadButtonsContainer.FadeIn(transition_duration);
favouriteButton.FadeIn(transition_duration);
updateDownloadButtons(); updateDownloadButtons();
}
}, true); }, true);
} }

View File

@ -247,6 +247,7 @@ namespace osu.Game.Screens.Play
public override void OnSuspending(IScreen next) public override void OnSuspending(IScreen next)
{ {
BackgroundBrightnessReduction = false;
base.OnSuspending(next); base.OnSuspending(next);
cancelLoad(); cancelLoad();
} }
@ -258,6 +259,7 @@ namespace osu.Game.Screens.Play
cancelLoad(); cancelLoad();
Background.EnableUserDim.Value = false; Background.EnableUserDim.Value = false;
BackgroundBrightnessReduction = false;
return base.OnExiting(next); return base.OnExiting(next);
} }
@ -273,6 +275,22 @@ namespace osu.Game.Screens.Play
} }
} }
private bool backgroundBrightnessReduction;
protected bool BackgroundBrightnessReduction
{
get => backgroundBrightnessReduction;
set
{
if (value == backgroundBrightnessReduction)
return;
backgroundBrightnessReduction = value;
Background.FadeColour(OsuColour.Gray(backgroundBrightnessReduction ? 0.8f : 1), 200);
}
}
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
@ -287,12 +305,16 @@ namespace osu.Game.Screens.Play
// Preview user-defined background dim and blur when hovered on the visual settings panel. // Preview user-defined background dim and blur when hovered on the visual settings panel.
Background.EnableUserDim.Value = true; Background.EnableUserDim.Value = true;
Background.BlurAmount.Value = 0; Background.BlurAmount.Value = 0;
BackgroundBrightnessReduction = false;
} }
else else
{ {
// Returns background dim and blur to the values specified by PlayerLoader. // Returns background dim and blur to the values specified by PlayerLoader.
Background.EnableUserDim.Value = false; Background.EnableUserDim.Value = false;
Background.BlurAmount.Value = BACKGROUND_BLUR; Background.BlurAmount.Value = BACKGROUND_BLUR;
BackgroundBrightnessReduction = true;
} }
} }

View File

@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.621.0" /> <PackageReference Include="ppy.osu.Framework" Version="2019.625.0" />
<PackageReference Include="SharpCompress" Version="0.23.0" /> <PackageReference Include="SharpCompress" Version="0.23.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />

View File

@ -105,8 +105,8 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.621.0" /> <PackageReference Include="ppy.osu.Framework" Version="2019.625.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.621.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2019.625.0" />
<PackageReference Include="SharpCompress" Version="0.22.0" /> <PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.11.0" /> <PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />