1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:47:29 +08:00

Make download buttons disappear instead of closing overlay.

- Also unbind event handlers
- Remove unused field
This commit is contained in:
naoey 2017-11-16 15:36:22 +05:30
parent df53b884ea
commit 97c5956083
3 changed files with 23 additions and 10 deletions

View File

@ -51,6 +51,7 @@ namespace osu.Game.Overlays.BeatmapSet
title.Text = BeatmapSet.Metadata.Title;
artist.Text = BeatmapSet.Metadata.Artist;
downloadButtonsContainer.FadeIn();
noVideoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 0 : 1, transition_duration);
videoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 1 : 0, transition_duration);
@ -224,6 +225,20 @@ namespace osu.Game.Overlays.BeatmapSet
{
tabsBg.Colour = colours.Gray3;
this.beatmaps = beatmaps;
beatmaps.BeatmapSetAdded += handleBeatmapAdd;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
beatmaps.BeatmapSetAdded -= handleBeatmapAdd;
}
private void handleBeatmapAdd(BeatmapSetInfo beatmap)
{
if (beatmap.OnlineBeatmapSetID == BeatmapSet.OnlineBeatmapSetID)
downloadButtonsContainer.FadeOut(transition_duration);
}
private void download(bool noVideo)

View File

@ -24,8 +24,6 @@ namespace osu.Game.Overlays
public const float X_PADDING = 40;
public const float RIGHT_WIDTH = 275;
private BeatmapSetInfo currentBeatmap;
private readonly Header header;
private readonly Info info;
@ -87,16 +85,10 @@ namespace osu.Game.Overlays
}
[BackgroundDependencyLoader]
private void load(APIAccess api, RulesetStore rulesets, BeatmapManager manager)
private void load(APIAccess api, RulesetStore rulesets)
{
this.api = api;
this.rulesets = rulesets;
manager.BeatmapSetAdded += beatmap =>
{
if (beatmap.OnlineBeatmapSetID == currentBeatmap.OnlineBeatmapSetID)
Hide();
};
}
protected override void PopIn()
@ -128,7 +120,7 @@ namespace osu.Game.Overlays
public void ShowBeatmapSet(BeatmapSetInfo set)
{
currentBeatmap = header.BeatmapSet = info.BeatmapSet = set;
header.BeatmapSet = info.BeatmapSet = set;
Show();
scroll.ScrollTo(0);
}

View File

@ -107,6 +107,12 @@ namespace osu.Game.Overlays.Direct
beatmaps.BeatmapDownloadBegan += attachDownload;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
beatmaps.BeatmapDownloadBegan -= attachDownload;
}
protected override void Update()
{
base.Update();