Beispiel #1
0
        public override void Reset()
        {
            base.Reset();

            Add(overlay = new DialogOverlay());

            AddButton("dialog #1", () => overlay.Push(new PopupDialog
            {
                Icon       = FontAwesome.fa_trash_o,
                HeaderText = @"Confirm deletion of",
                BodyText   = @"Ayase Rie - Yuima-ru*World TVver.",
                Buttons    = new PopupDialogButton[]
                {
                    new PopupDialogOkButton
                    {
                        Text   = @"I never want to see this again.",
                        Action = () => System.Console.WriteLine(@"OK"),
                    },
                    new PopupDialogCancelButton
                    {
                        Text   = @"Firetruck, I still want quick ranks!",
                        Action = () => System.Console.WriteLine(@"Cancel"),
                    },
                },
            }));

            AddButton("dialog #2", () => overlay.Push(new PopupDialog
            {
                Icon       = FontAwesome.fa_gear,
                HeaderText = @"What do you want to do with",
                BodyText   = "Camellia as \"Bang Riot\" - Blastix Riotz",
                Buttons    = new PopupDialogButton[]
                {
                    new PopupDialogOkButton
                    {
                        Text = @"Manage collections",
                    },
                    new PopupDialogOkButton
                    {
                        Text = @"Delete...",
                    },
                    new PopupDialogOkButton
                    {
                        Text = @"Remove from unplayed",
                    },
                    new PopupDialogOkButton
                    {
                        Text = @"Clear local scores",
                    },
                    new PopupDialogOkButton
                    {
                        Text = @"Edit",
                    },
                    new PopupDialogCancelButton
                    {
                        Text = @"Cancel",
                    },
                },
            }));
        }
Beispiel #2
0
 public KyzerMiscellaneous(DialogOverlay dialogOverlay)
 {
     Children = new Drawable[]
     {
         kyzerValues = new DangerousSettingsButton
         {
             Text   = "Operate Kyzer Values",
             Action = () =>
             {
                 dialogOverlay?.Push(new KyzerPopup(kyzerValues.Text, "This will selectively perform an action. What would you like to do?", "Restore Defaults", "Randomize Values", true, () =>
                 {
                     KyzerMain.KyzerBindables.ForEach(b =>
                     {
                         valueTask <BindableBool>(b, _ => { _.Value = _.Default; });
                         valueTask <BindableDouble>(b, _ => { _.Value = _.Default; });
                     });
                 }, () =>
                 {
                     KyzerMain.KyzerBindables.ForEach(b =>
                     {
                         valueTask <BindableBool>(b, _ => { _.Value = RNG.NextBool(); });
                         valueTask <BindableDouble>(b, _ => { _.Value = RNG.NextDouble(_.MinValue, _.MaxValue); });
                     });
                 }));
             },
         },
     };
 }
Beispiel #3
0
 private void promptDelete()
 {
     if (Beatmap != null)
     {
         dialogOverlay?.Push(new BeatmapDeleteDialog(Beatmap));
     }
 }
Beispiel #4
0
        private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay)
        {
            sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");

            Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue);

            BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1);
            BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2);
            BeatmapOptions.AddButton(@"Edit", @"Beatmap", FontAwesome.fa_pencil, colours.Yellow, () =>
            {
                ValidForResume = false;
                Push(new Editor());
            }, Key.Number3);

            if (dialogOverlay != null)
            {
                Schedule(() =>
                {
                    // if we have no beatmaps but osu-stable is found, let's prompt the user to import.
                    if (!beatmaps.GetAllUsableBeatmapSets().Any() && beatmaps.StableInstallationAvailable)
                    {
                        dialogOverlay.Push(new ImportFromStablePopup(() => beatmaps.ImportFromStable()));
                    }
                });
            }
        }
 public void OpenUrlExternally(string url)
 {
     if (externalLinkWarning.Value)
     {
         dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url)));
     }
     else
     {
         host.OpenUrlExternally(url);
     }
 }
Beispiel #6
0
 private void load(BeatmapManager beatmaps, DialogOverlay dialogOverlay)
 {
     Children = new Drawable[]
     {
         importButton = new SettingsButton
         {
             Text   = "Import beatmaps from stable",
             Action = () =>
             {
                 importButton.Enabled.Value = false;
                 Task.Factory.StartNew(beatmaps.ImportFromStable)
                 .ContinueWith(t => Schedule(() => importButton.Enabled.Value = true), TaskContinuationOptions.LongRunning);
             }
         },
         deleteButton = new DangerousSettingsButton
         {
             Text   = "Delete ALL beatmaps",
             Action = () =>
             {
                 dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                 {
                     deleteButton.Enabled.Value = false;
                     Task.Run(() => beatmaps.DeleteAll()).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true));
                 }));
             }
         },
         restoreButton = new SettingsButton
         {
             Text   = "Restore all hidden difficulties",
             Action = () =>
             {
                 restoreButton.Enabled.Value = false;
                 Task.Run(() =>
                 {
                     foreach (var b in beatmaps.QueryBeatmaps(b => b.Hidden).ToList())
                     {
                         beatmaps.Restore(b);
                     }
                 }).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true));
             }
         },
         undeleteButton = new SettingsButton
         {
             Text   = "Restore all recently deleted beatmaps",
             Action = () =>
             {
                 undeleteButton.Enabled.Value = false;
                 Task.Run(() => beatmaps.UndeleteAll()).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true));
             }
         },
     };
 }
Beispiel #7
0
        private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, Bindable <IEnumerable <Mod> > selectedMods)
        {
            if (selectedMods != null)
            {
                SelectedMods.BindTo(selectedMods);
            }

            if (Footer != null)
            {
                Footer.AddButton(@"mods", colours.Yellow, ModSelect, Key.F1);
                Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2);
                Footer.AddButton(@"options", colours.Blue, BeatmapOptions, Key.F3);

                BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue);
                BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1);
                BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2);
            }

            if (this.beatmaps == null)
            {
                this.beatmaps = beatmaps;
            }

            this.beatmaps.ItemAdded       += onBeatmapSetAdded;
            this.beatmaps.ItemRemoved     += onBeatmapSetRemoved;
            this.beatmaps.BeatmapHidden   += onBeatmapHidden;
            this.beatmaps.BeatmapRestored += onBeatmapRestored;

            dialogOverlay = dialog;

            sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Sample.Get(@"SongSelect/select-expand");
            SampleConfirm          = audio.Sample.Get(@"SongSelect/confirm-selection");

            Carousel.LoadBeatmapSetsFromManager(this.beatmaps);

            if (dialogOverlay != null)
            {
                Schedule(() =>
                {
                    // if we have no beatmaps but osu-stable is found, let's prompt the user to import.
                    if (!beatmaps.GetAllUsableBeatmapSets().Any() && beatmaps.StableInstallationAvailable)
                    {
                        dialogOverlay.Push(new ImportFromStablePopup(() =>
                        {
                            beatmaps.ImportFromStableAsync();
                            skins.ImportFromStableAsync();
                        }));
                    }
                });
            }
        }
        internal void AskForAutoAssignLanguage()
        {
            DialogOverlay.Push(new UseLanguageDetectorPopupDialog(ok =>
            {
                if (!ok)
                {
                    return;
                }

                LyricManager.AutoDetectLyricLanguage();
                Navigation.State = NavigationState.Done;
            }));
        }
Beispiel #9
0
        internal void AskForAutoGenerateRomaji()
        {
            DialogOverlay.Push(new UseAutoGenerateRomajiPopupDialog(ok =>
            {
                if (!ok)
                {
                    return;
                }

                RubyRomajiManager.AutoGenerateRomaji();
                Navigation.State = NavigationState.Done;
            }));
        }
Beispiel #10
0
        private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins)
        {
            mods.BindTo(Mods);

            if (Footer != null)
            {
                Footer.AddButton(new FooterButtonMods(mods), ModSelect);
                Footer.AddButton(new FooterButtonRandom {
                    Action = triggerRandom
                });
                Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);

                BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue);
                BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null, Key.Number1);
                BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number2);
            }

            if (this.beatmaps == null)
            {
                this.beatmaps = beatmaps;
            }

            this.beatmaps.ItemAdded       += onBeatmapSetAdded;
            this.beatmaps.ItemRemoved     += onBeatmapSetRemoved;
            this.beatmaps.BeatmapHidden   += onBeatmapHidden;
            this.beatmaps.BeatmapRestored += onBeatmapRestored;

            dialogOverlay = dialog;

            sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Samples.Get(@"SongSelect/select-expand");
            SampleConfirm          = audio.Samples.Get(@"SongSelect/confirm-selection");

            Carousel.LoadBeatmapSetsFromManager(this.beatmaps);

            if (dialogOverlay != null)
            {
                Schedule(() =>
                {
                    // if we have no beatmaps but osu-stable is found, let's prompt the user to import.
                    if (!beatmaps.GetAllUsableBeatmapSets().Any() && beatmaps.StableInstallationAvailable)
                    {
                        dialogOverlay.Push(new ImportFromStablePopup(() =>
                        {
                            Task.Run(beatmaps.ImportFromStableAsync);
                            Task.Run(skins.ImportFromStableAsync);
                        }));
                    }
                });
            }
        }
Beispiel #11
0
        public void ImportLyricFile(FileInfo fileInfo)
        {
            Schedule(() =>
            {
                // Check file is exist
                if (!fileInfo.Exists)
                {
                    DialogOverlay.Push(createFileNotFoundDialog());
                    return;
                }

                // Check format is match
                if (!ImportLyricManager.LyricFormatExtensions.Contains(fileInfo.Extension))
                {
                    DialogOverlay.Push(createFormatNotMatchDialog());
                    return;
                }

                DialogOverlay.Push(new ImportLyricDialog(execute =>
                {
                    if (!execute)
                    {
                        return;
                    }

                    try
                    {
                        importManager.ImportLrcFile(fileInfo);
                        DialogOverlay.Push(createCompleteDialog());
                    }
                    catch (Exception ex)
                    {
                        switch (ex)
                        {
                        case FileNotFoundException _:
                            DialogOverlay.Push(createFileNotFoundDialog());
                            break;

                        case FileLoadException loadException:
                            DialogOverlay.Push(createLoadExceptionDialog(loadException));
                            break;

                        default:
                            DialogOverlay.Push(createUnknownExceptionDialog());
                            break;
                        }
                    }
                }));
            });
        }
Beispiel #12
0
        private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
        {
            if (Footer != null)
            {
                Footer.AddButton(new FooterButtonMods {
                    Current = mods
                }, ModSelect);
                Footer.AddButton(new FooterButtonRandom {
                    Action = triggerRandom
                });
                Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);

                BeatmapOptions.AddButton(@"从", @"未玩过的谱面中移除", FontAwesome.Regular.TimesCircle, colours.Purple, null, Key.Number1);
                BeatmapOptions.AddButton(@"清除", @"本地成绩", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number2);
                BeatmapOptions.AddButton(@"删除", @"所有的难度", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number3);
            }

            if (this.beatmaps == null)
            {
                this.beatmaps = beatmaps;
            }

            this.beatmaps.ItemAdded       += onBeatmapSetAdded;
            this.beatmaps.ItemRemoved     += onBeatmapSetRemoved;
            this.beatmaps.BeatmapHidden   += onBeatmapHidden;
            this.beatmaps.BeatmapRestored += onBeatmapRestored;

            dialogOverlay = dialog;

            sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Samples.Get(@"SongSelect/select-expand");
            SampleConfirm          = audio.Samples.Get(@"SongSelect/confirm-selection");

            if (dialogOverlay != null)
            {
                Schedule(() =>
                {
                    // if we have no beatmaps but osu-stable is found, let's prompt the user to import.
                    if (!beatmaps.GetAllUsableBeatmapSetsEnumerable().Any() && beatmaps.StableInstallationAvailable)
                    {
                        dialogOverlay.Push(new ImportFromStablePopup(() =>
                        {
                            Task.Run(beatmaps.ImportFromStableAsync).ContinueWith(_ => scores.ImportFromStableAsync(), TaskContinuationOptions.OnlyOnRanToCompletion);
                            Task.Run(skins.ImportFromStableAsync);
                        }));
                    }
                });
            }
        }
Beispiel #13
0
        protected virtual void AutoDetect()
        {
            var fileBasedIpc = ipc as FileBasedIPC;

            if (!fileBasedIpc?.AutoDetectIPCLocation() ?? true)
            {
                overlay = new DialogOverlay();
                overlay.Push(new IPCErrorDialog("Failed to auto detect", "An osu! stable cutting-edge installation could not be auto detected.\nPlease try and manually point to the directory."));
                AddInternal(overlay);
            }
            else
            {
                sceneManager?.SetScreen(typeof(SetupScreen));
            }
        }
Beispiel #14
0
        protected virtual void ChangePath()
        {
            string target = directorySelector.CurrentPath.Value.FullName;
            var fileBasedIpc = ipc as FileBasedIPC;
            Logger.Log($"Changing Stable CE location to {target}");

            if (!fileBasedIpc?.SetIPCLocation(target) ?? true)
            {
                overlay = new DialogOverlay();
                overlay.Push(new IPCErrorDialog("This is an invalid IPC Directory", "Select a directory that contains an osu! stable cutting edge installation and make sure it has an empty ipc.txt file in it."));
                AddInternal(overlay);
                Logger.Log("Folder is not an osu! stable CE directory");
                return;
            }

            sceneManager?.SetScreen(typeof(SetupScreen));
        }
Beispiel #15
0
        protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
        {
            switch (args.Key)
            {
            case Key.Enter:
                footer.StartButton.TriggerClick();
                return(true);

            case Key.Delete:
                if (state.Keyboard.ShiftPressed)
                {
                    if (Beatmap != null)
                    {
                        dialogOverlay?.Push(new BeatmapDeleteDialog(Beatmap));
                    }

                    return(true);
                }
                break;
            }

            return(base.OnKeyDown(state, args));
        }
        internal void AskForAutoGenerateTimeTag()
        {
            if (LyricManager.HasTimedTimeTags())
            {
                // do not touch user's lyric if already contains valid time-tag with time.
                DialogOverlay.Push(new AlreadyContainTimeTagPopupDialog(ok =>
                {
                    Navigation.State = NavigationState.Done;
                }));
            }
            else
            {
                DialogOverlay.Push(new UseAutoGenerateTimeTagPopupDialog(ok =>
                {
                    if (!ok)
                    {
                        return;
                    }

                    LyricManager.AutoGenerateTimeTags();
                    Navigation.State = NavigationState.Done;
                }));
            }
        }
Beispiel #17
0
        private void load(AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores, CollectionManager collections, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender)
        {
            // initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
            transferRulesetValue();

            LoadComponentAsync(Carousel = new BeatmapCarousel
            {
                AllowSelection        = false, // delay any selection until our bindables are ready to make a good choice.
                Anchor                = Anchor.CentreRight,
                Origin                = Anchor.CentreRight,
                RelativeSizeAxes      = Axes.Both,
                BleedTop              = FilterControl.HEIGHT,
                BleedBottom           = Footer.HEIGHT,
                SelectionChanged      = updateSelectedBeatmap,
                BeatmapSetsChanged    = carouselBeatmapsLoaded,
                GetRecommendedBeatmap = s => recommender?.GetRecommendedBeatmap(s),
            }, c => carouselContainer.Child = c);

            AddRangeInternal(new Drawable[]
            {
                new ResetScrollContainer(() => Carousel.ScrollToSelected())
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 250,
                },
                new VerticalMaskingContainer
                {
                    Children = new Drawable[]
                    {
                        new GridContainer // used for max width implementation
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColumnDimensions = new[]
                            {
                                new Dimension(),
                                new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 850),
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new ParallaxContainer
                                    {
                                        ParallaxAmount   = 0.005f,
                                        RelativeSizeAxes = Axes.Both,
                                        Child            = new WedgeBackground
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Padding          = new MarginPadding {
                                                Right = -150
                                            },
                                        },
                                    },
                                    carouselContainer = new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding
                                        {
                                            Top    = FilterControl.HEIGHT,
                                            Bottom = Footer.HEIGHT
                                        },
                                        Child = new LoadingSpinner(true)
                                        {
                                            State = { Value = Visibility.Visible }
                                        }
                                    }
                                },
                            }
                        },
                        FilterControl = new FilterControl
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = FilterControl.HEIGHT,
                            FilterChanged    = ApplyFilterToCarousel,
                        },
                        new GridContainer // used for max width implementation
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColumnDimensions = new[]
                            {
                                new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 650),
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new Container
                                    {
                                        Origin           = Anchor.BottomLeft,
                                        Anchor           = Anchor.BottomLeft,
                                        RelativeSizeAxes = Axes.Both,

                                        Children = new Drawable[]
                                        {
                                            beatmapInfoWedge = new BeatmapInfoWedge
                                            {
                                                Height           = WEDGE_HEIGHT,
                                                RelativeSizeAxes = Axes.X,
                                                Margin           = new MarginPadding
                                                {
                                                    Top   = left_area_padding,
                                                    Right = left_area_padding,
                                                },
                                            },
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding
                                                {
                                                    Bottom = Footer.HEIGHT,
                                                    Top    = WEDGE_HEIGHT + left_area_padding,
                                                    Left   = left_area_padding,
                                                    Right  = left_area_padding * 2,
                                                },
                                                Child = BeatmapDetails = CreateBeatmapDetailArea().With(d =>
                                                {
                                                    d.RelativeSizeAxes = Axes.Both;
                                                    d.Padding          = new MarginPadding {
                                                        Top = 10, Right = 5
                                                    };
                                                })
                                            },
                                        }
                                    },
                                },
                            }
                        }
                    }
                },
            });

            if (ShowFooter)
            {
                AddRangeInternal(new Drawable[]
                {
                    new GridContainer // used for max height implementation
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.Relative, 1f, maxSize: ModSelectOverlay.HEIGHT + Footer.HEIGHT),
                        },
                        Content = new[]
                        {
                            null,
                            new Drawable[]
                            {
                                FooterPanels = new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding {
                                        Bottom = Footer.HEIGHT
                                    },
                                    Children = new Drawable[]
                                    {
                                        BeatmapOptions = new BeatmapOptionsOverlay(),
                                        ModSelect      = CreateModSelectOverlay()
                                    }
                                }
                            }
                        }
                    },
                    Footer = new Footer()
                });
            }

            if (Footer != null)
            {
                foreach (var(button, overlay) in CreateFooterButtons())
                {
                    Footer.AddButton(button, overlay);
                }

                BeatmapOptions.AddButton(@"Manage", @"collections", FontAwesome.Solid.Book, colours.Green, () => manageCollectionsDialog?.Show());
                BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo));
                BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null);
                BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo));
            }

            dialogOverlay = dialog;

            sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Samples.Get(@"SongSelect/select-expand");
            SampleConfirm          = audio.Samples.Get(@"SongSelect/confirm-selection");

            if (dialogOverlay != null)
            {
                Schedule(() =>
                {
                    // if we have no beatmaps but osu-stable is found, let's prompt the user to import.
                    if (!beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.Minimal).Any() && beatmaps.StableInstallationAvailable)
                    {
                        dialogOverlay.Push(new ImportFromStablePopup(() =>
                        {
                            Task.Run(beatmaps.ImportFromStableAsync)
                            .ContinueWith(_ =>
                            {
                                Task.Run(scores.ImportFromStableAsync);
                                Task.Run(collections.ImportFromStableAsync);
                            }, TaskContinuationOptions.OnlyOnRanToCompletion);
                            Task.Run(skins.ImportFromStableAsync);
                        }));
                    }
                });
            }
        }
Beispiel #18
0
        private void load(Storage storage, DialogOverlay dialog, OsuGame game)
        {
            var config = Config as GamebosuConfigManager;

            lockClockRate = config.GetBindable <bool>(GamebosuSetting.LockClockRate);

            Children = new Drawable[]
            {
                clockRate = new SettingsSlider <double>
                {
                    LabelText = "Gameboy Clock rate",
                    Current   = config.GetBindable <double>(GamebosuSetting.ClockRate)
                },
                new SettingsCheckbox
                {
                    LabelText = "Lock gameboy clock rate",
                    Current   = lockClockRate
                },
                new SettingsCheckbox
                {
                    LabelText = "Prefer Gameboy Color mode when launching original gameboy ROMs",
                    Current   = config.GetBindable <bool>(GamebosuSetting.PreferGBCMode)
                },
                new SettingsSlider <float>
                {
                    LabelText = "Gameboy Scale",
                    Current   = config.GetBindable <float>(GamebosuSetting.GameboyScale)
                },
                new SettingsButton
                {
                    Text   = "Open ROMs folder",
                    Action = () => storage.GetStorageForDirectory("roms")?.PresentExternally()
                },
                new DangerousSettingsButton
                {
                    Text   = "Delete ROM save data",
                    Action = () =>
                    {
                        Action deleteAction = delegate
                        {
                            var saves = storage.GetStorageForDirectory("roms/saves");
                            var files = saves.GetFiles(".");
                            try
                            {
                                files.ForEach(file => saves.Delete(file));
                            }
                            catch (Exception)
                            {
                                dialog.Push(new DeleteDataErrorDialog
                                {
                                    BodyText = $"Couldn't delete ROM save data (save data may be used by the currently loaded ROM). Try deleting save data from the main menu"
                                });
                            }
                        };

                        dialog.Push(new DeleteDataDialog(deleteAction));
                    }
                },
                new SettingsCheckbox
                {
                    LabelText = "Enable Sound Playback (VERY EXPERIMENTAL)",
                    Current   = config.GetBindable <bool>(GamebosuSetting.EnableSoundPlayback)
                },
                new SettingsCheckbox
                {
                    LabelText = "Disable that annoying disclaimer when launching gamebosu!",
                    Current   = config.GetBindable <bool>(GamebosuSetting.DisableDisplayingThatAnnoyingDisclaimer)
                },
                new YellowSettingsButton
                {
                    Text   = "Open ROM listing",
                    Action = () => game?.PerformFromScreen(scr => scr.Push(new GamebosuMainScreen(ruleset)))
                },
            };

            lockClockRate.BindValueChanged(e => clockRate.Current.Disabled = e.NewValue, true);
        }
Beispiel #19
0
        private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, [CanBeNull] CollectionManager collectionManager, [CanBeNull] LegacyImportManager legacyImportManager, DialogOverlay dialogOverlay)
        {
            if (legacyImportManager?.SupportsImportFromStable == true)
            {
                Add(importBeatmapsButton = new SettingsButton
                {
                    Text   = MaintenanceSettingsStrings.ImportBeatmapsFromStable,
                    Action = () =>
                    {
                        importBeatmapsButton.Enabled.Value = false;
                        legacyImportManager.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true));
                    }
                });
            }

            Add(deleteBeatmapsButton = new DangerousSettingsButton
            {
                Text   = MaintenanceSettingsStrings.DeleteAllBeatmaps,
                Action = () =>
                {
                    dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                    {
                        deleteBeatmapsButton.Enabled.Value = false;
                        Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
                    }));
                }
            });

            if (legacyImportManager?.SupportsImportFromStable == true)
            {
                Add(importScoresButton = new SettingsButton
                {
                    Text   = MaintenanceSettingsStrings.ImportScoresFromStable,
                    Action = () =>
                    {
                        importScoresButton.Enabled.Value = false;
                        legacyImportManager.ImportFromStableAsync(StableContent.Scores).ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true));
                    }
                });
            }

            Add(deleteScoresButton = new DangerousSettingsButton
            {
                Text   = MaintenanceSettingsStrings.DeleteAllScores,
                Action = () =>
                {
                    dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                    {
                        deleteScoresButton.Enabled.Value = false;
                        Task.Run(() => scores.Delete(scores.GetAllUsableScores())).ContinueWith(t => Schedule(() => deleteScoresButton.Enabled.Value = true));
                    }));
                }
            });

            if (legacyImportManager?.SupportsImportFromStable == true)
            {
                Add(importSkinsButton = new SettingsButton
                {
                    Text   = MaintenanceSettingsStrings.ImportSkinsFromStable,
                    Action = () =>
                    {
                        importSkinsButton.Enabled.Value = false;
                        legacyImportManager.ImportFromStableAsync(StableContent.Skins).ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true));
                    }
                });
            }

            Add(deleteSkinsButton = new DangerousSettingsButton
            {
                Text   = MaintenanceSettingsStrings.DeleteAllSkins,
                Action = () =>
                {
                    dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                    {
                        deleteSkinsButton.Enabled.Value = false;
                        Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true));
                    }));
                }
            });

            if (collectionManager != null)
            {
                if (legacyImportManager?.SupportsImportFromStable == true)
                {
                    Add(importCollectionsButton = new SettingsButton
                    {
                        Text   = MaintenanceSettingsStrings.ImportCollectionsFromStable,
                        Action = () =>
                        {
                            importCollectionsButton.Enabled.Value = false;
                            legacyImportManager.ImportFromStableAsync(StableContent.Collections).ContinueWith(t => Schedule(() => importCollectionsButton.Enabled.Value = true));
                        }
                    });
                }

                Add(new DangerousSettingsButton
                {
                    Text   = MaintenanceSettingsStrings.DeleteAllCollections,
                    Action = () =>
                    {
                        dialogOverlay?.Push(new DeleteAllBeatmapsDialog(collectionManager.DeleteAll));
                    }
                });
            }

            AddRange(new Drawable[]
            {
                restoreButton = new SettingsButton
                {
                    Text   = MaintenanceSettingsStrings.RestoreAllHiddenDifficulties,
                    Action = () =>
                    {
                        restoreButton.Enabled.Value = false;
                        Task.Run(() =>
                        {
                            foreach (var b in beatmaps.QueryBeatmaps(b => b.Hidden).ToList())
                            {
                                beatmaps.Restore(b);
                            }
                        }).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true));
                    }
                },
                undeleteButton = new SettingsButton
                {
                    Text   = MaintenanceSettingsStrings.RestoreAllRecentlyDeletedBeatmaps,
                    Action = () =>
                    {
                        undeleteButton.Enabled.Value = false;
                        Task.Run(() => beatmaps.Undelete(beatmaps.QueryBeatmapSets(b => b.DeletePending).ToList())).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true));
                    }
                },
            });
        }
Beispiel #20
0
        public TranslateEditSection()
        {
            Padding = new MarginPadding(10);

            var columnDimensions = new[]
            {
                new Dimension(GridSizeMode.Absolute, 200),
                new Dimension(GridSizeMode.Absolute, column_spacing),
                new Dimension(GridSizeMode.Absolute, 400),
                new Dimension(GridSizeMode.Absolute, column_spacing),
                new Dimension()
            };

            Child = new FillFlowContainer
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Children         = new Drawable[]
                {
                    new GridContainer
                    {
                        Name          = "LanguageSelection",
                        RowDimensions = new[]
                        {
                            new Dimension(GridSizeMode.AutoSize)
                        },
                        ColumnDimensions = columnDimensions,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Content          = new Drawable[][]
                        {
                            new[]
                            {
                                null,
                                null,
                                null,
                                null,
                                new GridContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    ColumnDimensions = new[]
                                    {
                                        new Dimension(GridSizeMode.Distributed),
                                        new Dimension(GridSizeMode.Absolute, column_spacing),
                                        new Dimension(GridSizeMode.Absolute, 50),
                                        new Dimension(GridSizeMode.Absolute, column_spacing),
                                        new Dimension(GridSizeMode.Absolute, 50),
                                    },
                                    RowDimensions = new[]
                                    {
                                        new Dimension(GridSizeMode.AutoSize),
                                    },
                                    Content = new[]
                                    {
                                        new Drawable[]
                                        {
                                            languageDropdown = new LanguageDropdown
                                            {
                                                RelativeSizeAxes = Axes.X,
                                            },
                                            null,
                                            new IconButton
                                            {
                                                Y      = 5,
                                                Icon   = FontAwesome.Solid.Plus,
                                                Action = () =>
                                                {
                                                    LanguageSelectionDialog.Show();
                                                }
                                            },
                                            null,
                                            new IconButton
                                            {
                                                Y      = 5,
                                                Icon   = FontAwesome.Solid.Trash,
                                                Action = () =>
                                                {
                                                    var currentLanguage = languageDropdown.Current.Value;

                                                    if (translateManager.LanguageContainsTranslateAmount(currentLanguage) > 0)
                                                    {
                                                        DialogOverlay.Push(new DeleteLanguagePopupDialog(currentLanguage, isOk =>
                                                        {
                                                            if (isOk)
                                                            {
                                                                translateManager.RemoveLanguage(currentLanguage);
                                                            }
                                                        }));
                                                    }
                                                    else
                                                    {
                                                        translateManager.RemoveLanguage(currentLanguage);
                                                    }
                                                }
                                            },
                                        }
                                    }
                                }
                            },
                        }
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Children         = new[]
                        {
                            new GridContainer
                            {
                                Name          = "Background",
                                RowDimensions = new[]
                                {
                                    new Dimension(GridSizeMode.AutoSize)
                                },
                                ColumnDimensions = columnDimensions,
                                RelativeSizeAxes = Axes.Both,
                                Content          = new[]
                                {
                                    new[]
                                    {
                                        new CornerBackground
                                        {
                                            Alpha = 0,
                                        },
                                        null,
                                        null,
                                        null,
                                        null,
                                    },
                                    new[]
                                    {
                                        timeSectionBackground = new CornerBackground
                                        {
                                            RelativeSizeAxes = Axes.Both
                                        },
                                        null,
                                        lyricSectionBackground = new CornerBackground
                                        {
                                            RelativeSizeAxes = Axes.Both
                                        },
                                        null,
                                        null,
                                    },
                                }
                            },
                            translateGrid = new GridContainer
                            {
                                Name             = "Translates",
                                ColumnDimensions = columnDimensions,
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                            }
                        }
                    }
                },
            };

            NewLanguage.BindValueChanged(e =>
            {
                translateManager.AddLanguage(e.NewValue);
            });
        }
Beispiel #21
0
        private void load(BeatmapManager beatmaps, SkinManager skins, DialogOverlay dialogOverlay)
        {
            if (beatmaps.SupportsImportFromStable)
            {
                Add(importBeatmapsButton = new SettingsButton
                {
                    Text   = "Import beatmaps from stable",
                    Action = () =>
                    {
                        importBeatmapsButton.Enabled.Value = false;
                        beatmaps.ImportFromStableAsync().ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true));
                    }
                });
            }

            Add(deleteBeatmapsButton = new DangerousSettingsButton
            {
                Text   = "Delete ALL beatmaps",
                Action = () =>
                {
                    dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                    {
                        deleteBeatmapsButton.Enabled.Value = false;
                        Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
                    }));
                }
            });

            if (skins.SupportsImportFromStable)
            {
                Add(importSkinsButton = new SettingsButton
                {
                    Text   = "Import skins from stable",
                    Action = () =>
                    {
                        importSkinsButton.Enabled.Value = false;
                        skins.ImportFromStableAsync().ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true));
                    }
                });
            }

            AddRange(new Drawable[]
            {
                deleteSkinsButton = new DangerousSettingsButton
                {
                    Text   = "Delete ALL skins",
                    Action = () =>
                    {
                        dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                        {
                            deleteSkinsButton.Enabled.Value = false;
                            Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true));
                        }));
                    }
                },
                restoreButton = new SettingsButton
                {
                    Text   = "Restore all hidden difficulties",
                    Action = () =>
                    {
                        restoreButton.Enabled.Value = false;
                        Task.Run(() =>
                        {
                            foreach (var b in beatmaps.QueryBeatmaps(b => b.Hidden).ToList())
                            {
                                beatmaps.Restore(b);
                            }
                        }).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true));
                    }
                },
                undeleteButton = new SettingsButton
                {
                    Text   = "Restore all recently deleted beatmaps",
                    Action = () =>
                    {
                        undeleteButton.Enabled.Value = false;
                        Task.Run(() => beatmaps.Undelete(beatmaps.QueryBeatmapSets(b => b.DeletePending).ToList())).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true));
                    }
                },
            });
        }
Beispiel #22
0
        private void load(AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
        {
            // initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
            transferRulesetValue();

            AddRangeInternal(new Drawable[]
            {
                new ResetScrollContainer(() => Carousel.ScrollToSelected())
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 250,
                },
                new VerticalMaskingContainer
                {
                    Children = new Drawable[]
                    {
                        new GridContainer // used for max width implementation
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColumnDimensions = new[]
                            {
                                new Dimension(),
                                new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 850),
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new ParallaxContainer
                                    {
                                        ParallaxAmount   = 0.005f,
                                        RelativeSizeAxes = Axes.Both,
                                        Child            = new WedgeBackground
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Padding          = new MarginPadding {
                                                Right = -150
                                            },
                                        },
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding
                                        {
                                            Top    = FilterControl.HEIGHT,
                                            Bottom = Footer.HEIGHT
                                        },
                                        Child = Carousel = new BeatmapCarousel
                                        {
                                            Anchor             = Anchor.CentreRight,
                                            Origin             = Anchor.CentreRight,
                                            RelativeSizeAxes   = Axes.Both,
                                            SelectionChanged   = updateSelectedBeatmap,
                                            BeatmapSetsChanged = carouselBeatmapsLoaded,
                                        },
                                    }
                                },
                            }
                        },
                        FilterControl = new FilterControl
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = FilterControl.HEIGHT,
                            FilterChanged    = ApplyFilterToCarousel,
                            Background       = { Width = 2 },
                        },
                        new GridContainer // used for max width implementation
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColumnDimensions = new[]
                            {
                                new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 650),
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new Container
                                    {
                                        Origin           = Anchor.BottomLeft,
                                        Anchor           = Anchor.BottomLeft,
                                        RelativeSizeAxes = Axes.Both,

                                        Children = new Drawable[]
                                        {
                                            beatmapInfoWedge = new BeatmapInfoWedge
                                            {
                                                Height           = WEDGE_HEIGHT,
                                                RelativeSizeAxes = Axes.X,
                                                Margin           = new MarginPadding
                                                {
                                                    Top   = left_area_padding,
                                                    Right = left_area_padding,
                                                },
                                            },
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding
                                                {
                                                    Bottom = Footer.HEIGHT,
                                                    Top    = WEDGE_HEIGHT + left_area_padding,
                                                    Left   = left_area_padding,
                                                    Right  = left_area_padding * 2,
                                                },
                                                Child = BeatmapDetails = new BeatmapDetailArea
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Padding          = new MarginPadding {
                                                        Top = 10, Right = 5
                                                    },
                                                },
                                            },
                                        }
                                    },
                                },
                            }
                        }
                    }
                },
            });

            if (ShowFooter)
            {
                AddRangeInternal(new Drawable[]
                {
                    new GridContainer // used for max height implementation
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.Relative, 1f, maxSize: ModSelectOverlay.HEIGHT + Footer.HEIGHT),
                        },
                        Content = new[]
                        {
                            null,
                            new Drawable[]
                            {
                                FooterPanels = new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding {
                                        Bottom = Footer.HEIGHT
                                    },
                                    Children = new Drawable[]
                                    {
                                        BeatmapOptions = new BeatmapOptionsOverlay(),
                                        ModSelect      = new ModSelectOverlay
                                        {
                                            Origin = Anchor.BottomCentre,
                                            Anchor = Anchor.BottomCentre,
                                        }
                                    }
                                }
                            }
                        }
                    },
                    Footer = new Footer()
                });
            }

            BeatmapDetails.Leaderboard.ScoreSelected += score => this.Push(new SoloResults(score));

            if (Footer != null)
            {
                Footer.AddButton(new FooterButtonMods {
                    Current = Mods
                }, ModSelect);
                Footer.AddButton(new FooterButtonRandom {
                    Action = triggerRandom
                });
                Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);

                BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null, Key.Number1);
                BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number2);
                BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number3);
            }

            dialogOverlay = dialog;

            sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Samples.Get(@"SongSelect/select-expand");
            SampleConfirm          = audio.Samples.Get(@"SongSelect/confirm-selection");

            if (dialogOverlay != null)
            {
                Schedule(() =>
                {
                    // if we have no beatmaps but osu-stable is found, let's prompt the user to import.
                    if (!beatmaps.GetAllUsableBeatmapSetsEnumerable().Any() && beatmaps.StableInstallationAvailable)
                    {
                        dialogOverlay.Push(new ImportFromStablePopup(() =>
                        {
                            Task.Run(beatmaps.ImportFromStableAsync).ContinueWith(_ => scores.ImportFromStableAsync(), TaskContinuationOptions.OnlyOnRanToCompletion);
                            Task.Run(skins.ImportFromStableAsync);
                        }));
                    }
                });
            }
        }
Beispiel #23
0
        private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, DialogOverlay dialogOverlay)
        {
            if (beatmaps.SupportsImportFromStable)
            {
                Add(importBeatmapsButton = new SettingsButton
                {
                    Text   = "从osu!stable中导入谱面",
                    Action = () =>
                    {
                        importBeatmapsButton.Enabled.Value = false;
                        beatmaps.ImportFromStableAsync().ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true));
                    }
                });
            }

            Add(deleteBeatmapsButton = new DangerousSettingsButton
            {
                Text   = "删除所有谱面",
                Action = () =>
                {
                    dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                    {
                        deleteBeatmapsButton.Enabled.Value = false;
                        Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
                    }));
                }
            });

            if (scores.SupportsImportFromStable)
            {
                Add(importScoresButton = new SettingsButton
                {
                    Text   = "从osu!stable中导入分数",
                    Action = () =>
                    {
                        importScoresButton.Enabled.Value = false;
                        scores.ImportFromStableAsync().ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true));
                    }
                });
            }

            Add(deleteScoresButton = new DangerousSettingsButton
            {
                Text   = "删除所有分数",
                Action = () =>
                {
                    dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                    {
                        deleteScoresButton.Enabled.Value = false;
                        Task.Run(() => scores.Delete(scores.GetAllUsableScores())).ContinueWith(t => Schedule(() => deleteScoresButton.Enabled.Value = true));
                    }));
                }
            });

            if (skins.SupportsImportFromStable)
            {
                Add(importSkinsButton = new SettingsButton
                {
                    Text   = "从osu!stable中导入皮肤",
                    Action = () =>
                    {
                        importSkinsButton.Enabled.Value = false;
                        skins.ImportFromStableAsync().ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true));
                    }
                });
            }

            AddRange(new Drawable[]
            {
                deleteSkinsButton = new DangerousSettingsButton
                {
                    Text   = "删除所有皮肤",
                    Action = () =>
                    {
                        dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                        {
                            deleteSkinsButton.Enabled.Value = false;
                            Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true));
                        }));
                    }
                },
                restoreButton = new SettingsButton
                {
                    Text   = "恢复所有被隐藏的难度",
                    Action = () =>
                    {
                        restoreButton.Enabled.Value = false;
                        Task.Run(() =>
                        {
                            foreach (var b in beatmaps.QueryBeatmaps(b => b.Hidden).ToList())
                            {
                                beatmaps.Restore(b);
                            }
                        }).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true));
                    }
                },
                undeleteButton = new SettingsButton
                {
                    Text   = "恢复所有最近删除的谱面",
                    Action = () =>
                    {
                        undeleteButton.Enabled.Value = false;
                        Task.Run(() => beatmaps.Undelete(beatmaps.QueryBeatmapSets(b => b.DeletePending).ToList())).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true));
                    }
                },
            });
        }
Beispiel #24
0
        private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, [CanBeNull] CollectionManager collectionManager, DialogOverlay dialogOverlay)
        {
            if (beatmaps.SupportsImportFromStable)
            {
                Add(importBeatmapsButton = new SettingsButton
                {
                    Text   = "從正常版匯入所有圖譜",
                    Action = () =>
                    {
                        importBeatmapsButton.Enabled.Value = false;
                        beatmaps.ImportFromStableAsync().ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true));
                    }
                });
            }

            Add(deleteBeatmapsButton = new DangerousSettingsButton
            {
                Text   = "清除所有已安裝的圖譜",
                Action = () =>
                {
                    dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                    {
                        deleteBeatmapsButton.Enabled.Value = false;
                        Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
                    }));
                }
            });

            if (scores.SupportsImportFromStable)
            {
                Add(importScoresButton = new SettingsButton
                {
                    Text   = "從正常版匯入成績",
                    Action = () =>
                    {
                        importScoresButton.Enabled.Value = false;
                        scores.ImportFromStableAsync().ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true));
                    }
                });
            }

            Add(deleteScoresButton = new DangerousSettingsButton
            {
                Text   = "清除所有本地成績",
                Action = () =>
                {
                    dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                    {
                        deleteScoresButton.Enabled.Value = false;
                        Task.Run(() => scores.Delete(scores.GetAllUsableScores())).ContinueWith(t => Schedule(() => deleteScoresButton.Enabled.Value = true));
                    })
                    {
                        BodyText = "所有本地成績嗎?"
                    });
                }
            });

            if (skins.SupportsImportFromStable)
            {
                Add(importSkinsButton = new SettingsButton
                {
                    Text   = "從正常版匯入皮膚",
                    Action = () =>
                    {
                        importSkinsButton.Enabled.Value = false;
                        skins.ImportFromStableAsync().ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true));
                    }
                });
            }

            Add(deleteSkinsButton = new DangerousSettingsButton
            {
                Text   = "清除所有已安裝的皮膚",
                Action = () =>
                {
                    dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
                    {
                        deleteSkinsButton.Enabled.Value = false;
                        Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true));
                    })
                    {
                        BodyText = "所有已安裝的皮膚嗎?"
                    });
                }
            });

            if (collectionManager != null)
            {
                if (collectionManager.SupportsImportFromStable)
                {
                    Add(importCollectionsButton = new SettingsButton
                    {
                        Text   = "從正常版匯入圖譜收藏",
                        Action = () =>
                        {
                            importCollectionsButton.Enabled.Value = false;
                            collectionManager.ImportFromStableAsync().ContinueWith(t => Schedule(() => importCollectionsButton.Enabled.Value = true));
                        }
                    });
                }

                Add(new DangerousSettingsButton
                {
                    Text   = "清除所有的圖譜收藏",
                    Action = () =>
                    {
                        dialogOverlay?.Push(new DeleteAllBeatmapsDialog(collectionManager.DeleteAll)
                        {
                            BodyText = "所有的圖譜收藏嗎?"
                        });
                    }
                });
            }

            AddRange(new Drawable[]
            {
                restoreButton = new SettingsButton
                {
                    Text   = "復原已隱藏的難度",
                    Action = () =>
                    {
                        restoreButton.Enabled.Value = false;
                        Task.Run(() =>
                        {
                            foreach (var b in beatmaps.QueryBeatmaps(b => b.Hidden).ToList())
                            {
                                beatmaps.Restore(b);
                            }
                        }).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true));
                    }
                },
                undeleteButton = new SettingsButton
                {
                    Text   = "復原最近刪除的圖譜",
                    Action = () =>
                    {
                        undeleteButton.Enabled.Value = false;
                        Task.Run(() => beatmaps.Undelete(beatmaps.QueryBeatmapSets(b => b.DeletePending).ToList())).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true));
                    }
                },
            });
        }