mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 10:03:05 +08:00
clean up
This commit is contained in:
parent
3decadaf51
commit
164f61f590
@ -7,6 +7,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
@ -30,21 +31,12 @@ namespace osu.Game.Database
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private ScoreManager scoreManager { get; set; } = null!;
|
private ScoreManager scoreManager { get; set; } = null!;
|
||||||
|
|
||||||
[Cached]
|
|
||||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private BeatmapSetOverlay? beatmapSetOverlay { get; set; }
|
|
||||||
|
|
||||||
private Container beatmapPanelContainer = null!;
|
|
||||||
|
|
||||||
private readonly MemoryStream scoreStream;
|
private readonly MemoryStream scoreStream;
|
||||||
|
|
||||||
private readonly APIBeatmapSet beatmapSetInfo;
|
private readonly APIBeatmapSet beatmapSetInfo;
|
||||||
|
|
||||||
private BeatmapDownloadTracker? downloadTracker;
|
|
||||||
|
|
||||||
private Bindable<bool> autodownloadConfig = null!;
|
private Bindable<bool> autodownloadConfig = null!;
|
||||||
|
private Bindable<bool> noVideoSetting = null!;
|
||||||
|
|
||||||
public MissingBeatmapNotification(APIBeatmap beatmap, MemoryStream scoreStream)
|
public MissingBeatmapNotification(APIBeatmap beatmap, MemoryStream scoreStream)
|
||||||
{
|
{
|
||||||
@ -54,35 +46,25 @@ namespace osu.Game.Database
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, OsuConfigManager config)
|
private void load(OsuConfigManager config, BeatmapSetOverlay? beatmapSetOverlay)
|
||||||
{
|
{
|
||||||
|
BeatmapDownloadTracker downloadTracker = new BeatmapDownloadTracker(beatmapSetInfo);
|
||||||
|
downloadTracker.State.BindValueChanged(downloadStatusChanged);
|
||||||
|
|
||||||
autodownloadConfig = config.GetBindable<bool>(OsuSetting.AutomaticallyDownloadWhenSpectating);
|
autodownloadConfig = config.GetBindable<bool>(OsuSetting.AutomaticallyDownloadWhenSpectating);
|
||||||
|
noVideoSetting = config.GetBindable<bool>(OsuSetting.PreferNoVideo);
|
||||||
|
|
||||||
Text = "You do not have the required beatmap for this replay";
|
Text = "You do not have the required beatmap for this replay";
|
||||||
|
|
||||||
Content.Add(beatmapPanelContainer = new ClickableContainer
|
Content.Add(new ClickableContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 70,
|
Height = 70,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
Action = () => beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmapSetInfo.OnlineID)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
downloadTracker = new BeatmapDownloadTracker(beatmapSetInfo);
|
|
||||||
downloadTracker.State.BindValueChanged(downloadStatusChanged, true);
|
|
||||||
|
|
||||||
beatmapPanelContainer.Clear();
|
|
||||||
beatmapPanelContainer.Child = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Masking = true,
|
|
||||||
CornerRadius = 4,
|
CornerRadius = 4,
|
||||||
|
Masking = true,
|
||||||
|
Action = () => beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmapSetInfo.OnlineID),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
downloadTracker,
|
downloadTracker,
|
||||||
@ -125,7 +107,7 @@ namespace osu.Game.Database
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new DownloadButton
|
new BeatmapDownloadButton(beatmapSetInfo)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
@ -134,15 +116,18 @@ namespace osu.Game.Database
|
|||||||
Margin = new MarginPadding
|
Margin = new MarginPadding
|
||||||
{
|
{
|
||||||
Bottom = 1f
|
Bottom = 1f
|
||||||
},
|
}
|
||||||
Action = () => beatmapDownloader.Download(beatmapSetInfo),
|
|
||||||
State = { BindTarget = downloadTracker.State }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
if (autodownloadConfig.Value)
|
if (autodownloadConfig.Value)
|
||||||
beatmapDownloader.Download(beatmapSetInfo);
|
beatmapDownloader.Download(beatmapSetInfo, noVideoSetting.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void downloadStatusChanged(ValueChangedEvent<DownloadState> status)
|
private void downloadStatusChanged(ValueChangedEvent<DownloadState> status)
|
||||||
|
Loading…
Reference in New Issue
Block a user