public void TestNotificationMessage(IBeatmapSetInfo model) { AddStep("clear recent notification", () => recentNotification = null); AddStep("download beatmap", () => beatmaps.Download(model)); AddUntilStep("wait for notification", () => recentNotification != null); AddUntilStep("notification text correct", () => recentNotification.Text.ToString() == "Downloading test author - test title (mapper)"); }
public void TestCancelDownloadFromRequest() { AddStep("download beatmap", () => beatmaps.Download(test_model)); AddStep("cancel download from request", () => beatmaps.GetExistingDownload(test_model).Cancel()); AddUntilStep("is removed from download list", () => beatmaps.GetExistingDownload(test_model) == null); AddAssert("is notification cancelled", () => recentNotification.State == ProgressNotificationState.Cancelled); }
private void load(OsuGame game, BeatmapManager beatmaps) { if (BeatmapSet.Value?.OnlineInfo?.Availability?.DownloadDisabled ?? false) { button.Enabled.Value = false; button.TooltipText = "this beatmap is currently not available for download."; return; } button.Action = () => { switch (State.Value) { case DownloadState.Downloading: case DownloadState.Downloaded: shakeContainer.Shake(); break; case DownloadState.LocallyAvailable: Predicate <BeatmapInfo> findPredicate = null; if (SelectedBeatmap.Value != null) { findPredicate = b => b.OnlineBeatmapID == SelectedBeatmap.Value.OnlineBeatmapID; } game?.PresentBeatmap(BeatmapSet.Value, findPredicate); break; default: beatmaps.Download(BeatmapSet.Value, noVideo); break; } }; }
private void load(OsuGame game, BeatmapManager beatmaps) { if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false) { button.Enabled.Value = false; button.TooltipText = "该谱面暂时无法下载"; return; } button.Action = () => { switch (State.Value) { case DownloadState.Downloading: case DownloadState.Downloaded: shakeContainer.Shake(); break; case DownloadState.LocallyAvailable: game.PresentBeatmap(BeatmapSet.Value); break; default: beatmaps.Download(BeatmapSet.Value, noVideo); break; } }; }
private void load(OsuColour colours, OsuGame game, BeatmapManager beatmaps) { this.colours = colours; if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false) { button.Enabled.Value = false; button.TooltipText = "This beatmap is currently not available for download."; return; } button.Action = () => { switch (State.Value) { case DownloadState.Downloading: case DownloadState.Downloaded: shakeContainer.Shake(); break; case DownloadState.LocallyAvailable: game.PresentBeatmap(BeatmapSet.Value); break; default: beatmaps.Download(BeatmapSet.Value, noVideo); break; } }; }
/// <summary> /// Begin downloading the associated beatmap set. /// </summary> /// <returns>True if downloading began. False if an existing download is active or completed.</returns> public void Download() { if (DownloadState.Value > DownloadStatus.NotDownloaded) { return; } beatmaps.Download(set, noVideo); DownloadState.Value = DownloadStatus.Downloading; }
/// <summary> /// Begin downloading the associated beatmap set. /// </summary> /// <returns>True if downloading began. False if an existing download is active or completed.</returns> public void Download() { if (DownloadState.Value > DownloadStatus.NotDownloaded) { return; } if (beatmaps.Download(set, noVideo)) { // Only change state if download can happen DownloadState.Value = DownloadStatus.Downloading; } }
private void download(bool noVideo) { if (beatmaps.GetExistingDownload(BeatmapSet) != null) { downloadButtonsContainer.MoveToX(-5, 50, Easing.OutSine).Then() .MoveToX(5, 100, Easing.InOutSine).Then() .MoveToX(-5, 100, Easing.InOutSine).Then() .MoveToX(0, 50, Easing.InSine).Then(); return; } beatmaps.Download(BeatmapSet, noVideo); }
private void load(OsuGame game, BeatmapManager beatmaps, OsuConfigManager osuConfig) { noVideoSetting = osuConfig.GetBindable <bool>(OsuSetting.PreferNoVideo); button.Action = () => { switch (DownloadTracker.State.Value) { case DownloadState.Downloading: case DownloadState.Importing: shakeContainer.Shake(); break; case DownloadState.LocallyAvailable: Predicate <BeatmapInfo> findPredicate = null; if (SelectedBeatmap.Value != null) { findPredicate = b => b.OnlineID == SelectedBeatmap.Value.OnlineID; } game?.PresentBeatmap(beatmapSet, findPredicate); break; default: beatmaps.Download(beatmapSet, noVideoSetting.Value); break; } }; State.BindValueChanged(state => { switch (state.NewValue) { case DownloadState.LocallyAvailable: button.Enabled.Value = true; button.TooltipText = "Go to beatmap"; break; default: if ((beatmapSet as IBeatmapSetOnlineInfo)?.Availability.DownloadDisabled == true) { button.Enabled.Value = false; button.TooltipText = "this beatmap is currently not available for download."; } break; } }, true); }
/// <summary> /// Begin downloading the associated beatmap set. /// </summary> /// <returns>True if downloading began. False if an existing download is active or completed.</returns> public bool Download() { if (Downloaded.Value) { return(false); } if (beatmaps.GetExistingDownload(set) != null) { return(false); } beatmaps.Download(set, noVideo); return(true); }
private void load(OsuColour colours, OsuGame game, BeatmapManager beatmaps) { this.colours = colours; button.Action = () => { switch (State.Value) { case DownloadState.Downloading: case DownloadState.Downloaded: shakeContainer.Shake(); break; case DownloadState.LocallyAvailable: game.PresentBeatmap(BeatmapSet.Value); break; default: beatmaps.Download(BeatmapSet.Value, noVideo); break; } }; }
private void load(IAPIProvider api, BeatmapManager beatmaps) { FillFlowContainer textSprites; AddRangeInternal(new Drawable[] { shakeContainer = new ShakeContainer { Depth = -1, RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = 5, Children = new Drawable[] { button = new HeaderButton { RelativeSizeAxes = Axes.Both }, new Container { // cannot nest inside here due to the structure of button (putting things in its own content). // requires framework fix. Padding = new MarginPadding { Horizontal = 10 }, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { textSprites = new FillFlowContainer { Depth = -1, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, AutoSizeDuration = 500, AutoSizeEasing = Easing.OutQuint, Direction = FillDirection.Vertical, }, new SpriteIcon { Depth = -1, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Icon = FontAwesome.Solid.Download, Size = new Vector2(16), Margin = new MarginPadding { Right = 5 }, }, } }, new DownloadProgressBar(BeatmapSet.Value) { Depth = -2, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }, }, }, }); button.Action = () => { if (State.Value != DownloadState.NotDownloaded) { shakeContainer.Shake(); return; } beatmaps.Download(BeatmapSet.Value, noVideo); }; localUser.BindTo(api.LocalUser); localUser.BindValueChanged(userChanged, true); button.Enabled.BindValueChanged(enabledChanged, true); State.BindValueChanged(state => { switch (state.NewValue) { case DownloadState.Downloading: textSprites.Children = new Drawable[] { new OsuSpriteText { Text = "Downloading...", Font = OsuFont.GetFont(size: 13, weight: FontWeight.Bold) }, }; break; case DownloadState.Downloaded: textSprites.Children = new Drawable[] { new OsuSpriteText { Text = "Importing...", Font = OsuFont.GetFont(size: 13, weight: FontWeight.Bold) }, }; break; case DownloadState.LocallyAvailable: this.FadeOut(200); break; case DownloadState.NotDownloaded: textSprites.Children = new Drawable[] { new OsuSpriteText { Text = "Download", Font = OsuFont.GetFont(size: 13, weight: FontWeight.Bold) }, new OsuSpriteText { Text = BeatmapSet.Value.OnlineInfo.HasVideo && noVideo ? "without Video" : string.Empty, Font = OsuFont.GetFont(size: 11, weight: FontWeight.Bold) }, }; this.FadeIn(200); break; } }, true); }
private void load(IAPIProvider api, BeatmapManager beatmaps) { FillFlowContainer textSprites; AddInternal(shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = 5, Child = button = new HeaderButton { RelativeSizeAxes = Axes.Both }, }); button.AddRange(new Drawable[] { new Container { Padding = new MarginPadding { Horizontal = 10 }, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { textSprites = new FillFlowContainer { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, AutoSizeDuration = 500, AutoSizeEasing = Easing.OutQuint, Direction = FillDirection.Vertical, }, new SpriteIcon { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Icon = FontAwesome.Solid.Download, Size = new Vector2(18), }, } }, new DownloadProgressBar(BeatmapSet.Value) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }, }); button.Action = () => { if (State.Value != DownloadState.NotDownloaded) { shakeContainer.Shake(); return; } beatmaps.Download(BeatmapSet.Value, noVideo); }; localUser.BindTo(api.LocalUser); localUser.BindValueChanged(userChanged, true); button.Enabled.BindValueChanged(enabledChanged, true); State.BindValueChanged(state => { switch (state.NewValue) { case DownloadState.Downloading: textSprites.Children = new Drawable[] { new OsuSpriteText { Text = "Downloading...", Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold) }, }; break; case DownloadState.Importing: textSprites.Children = new Drawable[] { new OsuSpriteText { Text = "Importing...", Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold) }, }; break; case DownloadState.LocallyAvailable: this.FadeOut(200); break; case DownloadState.NotDownloaded: textSprites.Children = new Drawable[] { new OsuSpriteText { Text = "Download", Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold) }, new OsuSpriteText { Text = getVideoSuffixText(), Font = OsuFont.GetFont(size: text_size - 2, weight: FontWeight.Bold) }, }; this.FadeIn(200); break; } }, true); }