Skip to content

Commit

Permalink
Make download buttons disappear instead of closing overlay.
Browse files Browse the repository at this point in the history
- Also unbind event handlers
  • Loading branch information
naoey committed Nov 16, 2017
1 parent df53b88 commit d8aaf81
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
15 changes: 15 additions & 0 deletions osu.Game/Overlays/BeatmapSet/Header.cs
Expand Up @@ -51,6 +51,7 @@ public BeatmapSetInfo 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);

Expand Down Expand Up @@ -224,6 +225,20 @@ private void load(OsuColour colours, BeatmapManager beatmaps)
{
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)
Expand Down
8 changes: 1 addition & 7 deletions osu.Game/Overlays/BeatmapSetOverlay.cs
Expand Up @@ -87,16 +87,10 @@ public BeatmapSetOverlay()
}

[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()
Expand Down
6 changes: 6 additions & 0 deletions osu.Game/Overlays/Direct/DirectPanel.cs
Expand Up @@ -107,6 +107,12 @@ private void load(BeatmapManager beatmaps, OsuColour colours, BeatmapSetOverlay
beatmaps.BeatmapDownloadBegan += attachDownload;
}

protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
beatmaps.BeatmapDownloadBegan -= attachDownload;
}

protected override void Update()
{
base.Update();
Expand Down

0 comments on commit d8aaf81

Please sign in to comment.