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
- Remove unused field
  • Loading branch information
naoey committed Nov 16, 2017
1 parent df53b88 commit 97c5956
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 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
12 changes: 2 additions & 10 deletions osu.Game/Overlays/BeatmapSetOverlay.cs
Expand Up @@ -24,8 +24,6 @@ public class BeatmapSetOverlay : WaveOverlayContainer
public const float X_PADDING = 40;
public const float RIGHT_WIDTH = 275;

private BeatmapSetInfo currentBeatmap;

private readonly Header header;
private readonly Info info;

Expand Down Expand Up @@ -87,16 +85,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 Expand Up @@ -128,7 +120,7 @@ public void ShowBeatmapSet(int beatmapSetId)

public void ShowBeatmapSet(BeatmapSetInfo set)
{
currentBeatmap = header.BeatmapSet = info.BeatmapSet = set;
header.BeatmapSet = info.BeatmapSet = set;
Show();
scroll.ScrollTo(0);
}
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 97c5956

Please sign in to comment.