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;
                }
            };
        }
Exemple #2
0
        private void load(OsuColour colours, OsuGame game)
        {
            this.colours = colours;

            Action = () =>
            {
                switch (downloader.DownloadState.Value)
                {
                case BeatmapSetDownloader.DownloadStatus.Downloading:
                    // todo: replace with ShakeContainer after https://github.com/ppy/osu/pull/2909 is merged.
                    Content.MoveToX(-5, 50, Easing.OutSine).Then()
                    .MoveToX(5, 100, Easing.InOutSine).Then()
                    .MoveToX(-5, 100, Easing.InOutSine).Then()
                    .MoveToX(0, 50, Easing.InSine);
                    break;

                case BeatmapSetDownloader.DownloadStatus.Downloaded:
                    game.PresentBeatmap(beatmapSet);
                    break;

                default:
                    downloader.Download();
                    break;
                }
            };
        }
Exemple #3
0
        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;
                }
            };
        }
Exemple #4
0
        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;
                }
            };
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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;
                }
            };
        }
Exemple #7
0
 private void load(OsuGame?game)
 {
     Action = () => game?.PresentBeatmap(beatmapSet);
 }