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:
parent
d36fc13487
commit
0e9dc6fb85
@ -103,7 +103,7 @@ namespace osu.Desktop.Tests.Visual
|
||||
OnlineInfo = new BeatmapOnlineInfo
|
||||
{
|
||||
Length = 118000,
|
||||
HasVideo = false,
|
||||
HasVideo = true,
|
||||
CircleCount = 592,
|
||||
SliderCount = 62,
|
||||
PlayCount = 162021,
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user