1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:52:56 +08:00

Don't recreate header buttons on beatmap change.

This commit is contained in:
DrabWeb 2017-09-12 23:55:48 -03:00
parent d36fc13487
commit 0e9dc6fb85
2 changed files with 15 additions and 10 deletions

View File

@ -103,7 +103,7 @@ namespace osu.Desktop.Tests.Visual
OnlineInfo = new BeatmapOnlineInfo
{
Length = 118000,
HasVideo = false,
HasVideo = true,
CircleCount = 592,
SliderCount = 62,
PlayCount = 162021,

View File

@ -18,6 +18,7 @@ namespace osu.Game.Overlays.OnlineBeatmapSet
{
public class Header : Container
{
private const float transition_duration = 250;
private const float tabs_height = 50;
private readonly Box tabsBg;
@ -37,7 +38,7 @@ namespace osu.Game.Overlays.OnlineBeatmapSet
Offset = new Vector2(0f, 1f),
};
FillFlowContainer buttons;
DownloadButton noVideo, withVideo, withoutVideo;
Details details;
Children = new Drawable[]
{
@ -126,15 +127,20 @@ namespace osu.Game.Overlays.OnlineBeatmapSet
Margin = new MarginPadding { Top = 20 },
Child = new AuthorInfo(set.OnlineInfo),
},
buttons = new FillFlowContainer
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
Height = 45,
Spacing = new Vector2(5f),
Margin = new MarginPadding { Top = 10 },
LayoutDuration = transition_duration,
LayoutEasing = Easing.Out,
Children = new HeaderButton[]
{
new FavouriteButton(),
noVideo = new DownloadButton("Download", @""),
withVideo = new DownloadButton("Download", "with Video"),
withoutVideo = new DownloadButton("Download", "without Video"),
},
},
},
@ -154,18 +160,17 @@ namespace osu.Game.Overlays.OnlineBeatmapSet
{
details.Beatmap = b;
buttons.Child = new FavouriteButton();
if (b.OnlineInfo.HasVideo)
{
buttons.AddRange(new[]
{
new DownloadButton("Download", "with Video"),
new DownloadButton("Download", "without Video"),
});
noVideo.FadeOut(transition_duration);
withVideo.FadeIn(transition_duration);
withoutVideo.FadeIn(transition_duration);
}
else
{
buttons.Add(new DownloadButton("Download", @""));
noVideo.FadeIn(transition_duration);
withVideo.FadeOut(transition_duration);
withoutVideo.FadeOut(transition_duration);
}
};
}