mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
Add a dialog offering to import beatmaps from stable
This commit is contained in:
parent
45e4c09cb8
commit
3c8d30f8e6
@ -697,10 +697,12 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool StableInstallationAvailable => GetStableStorage?.Invoke() != null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future.
|
/// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ImportFromStable()
|
public async Task ImportFromStable()
|
||||||
{
|
{
|
||||||
var stable = GetStableStorage?.Invoke();
|
var stable = GetStableStorage?.Invoke();
|
||||||
|
|
||||||
@ -710,7 +712,7 @@ namespace osu.Game.Beatmaps
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Import(stable.GetDirectories("Songs"));
|
await Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs")), TaskCreationOptions.LongRunning);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteAll()
|
public void DeleteAll()
|
||||||
|
@ -30,8 +30,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
|||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
importButton.Enabled.Value = false;
|
importButton.Enabled.Value = false;
|
||||||
Task.Factory.StartNew(beatmaps.ImportFromStable)
|
beatmaps.ImportFromStable().ContinueWith(t => Schedule(() => importButton.Enabled.Value = true));
|
||||||
.ContinueWith(t => Schedule(() => importButton.Enabled.Value = true), TaskContinuationOptions.LongRunning);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deleteButton = new DangerousSettingsButton
|
deleteButton = new DangerousSettingsButton
|
||||||
|
33
osu.Game/Screens/Select/ImportFromStablePopup.cs
Normal file
33
osu.Game/Screens/Select/ImportFromStablePopup.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Overlays.Dialog;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select
|
||||||
|
{
|
||||||
|
public class ImportFromStablePopup : PopupDialog
|
||||||
|
{
|
||||||
|
public ImportFromStablePopup(Action importFromStable)
|
||||||
|
{
|
||||||
|
HeaderText = @"You have no beatmaps!";
|
||||||
|
BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps?";
|
||||||
|
|
||||||
|
Icon = FontAwesome.fa_trash_o;
|
||||||
|
|
||||||
|
Buttons = new PopupDialogButton[]
|
||||||
|
{
|
||||||
|
new PopupDialogOkButton
|
||||||
|
{
|
||||||
|
Text = @"Yes please!",
|
||||||
|
Action = importFromStable
|
||||||
|
},
|
||||||
|
new PopupDialogCancelButton
|
||||||
|
{
|
||||||
|
Text = @"No, I'd like to start from scratch",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
@ -45,8 +46,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private SampleChannel sampleConfirm;
|
private SampleChannel sampleConfirm;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuColour colours, AudioManager audio)
|
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay)
|
||||||
{
|
{
|
||||||
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
|
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
|
||||||
|
|
||||||
@ -59,6 +60,16 @@ namespace osu.Game.Screens.Select
|
|||||||
ValidForResume = false;
|
ValidForResume = false;
|
||||||
Push(new Editor());
|
Push(new Editor());
|
||||||
}, Key.Number3);
|
}, 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()));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateBeatmap(WorkingBeatmap beatmap)
|
protected override void UpdateBeatmap(WorkingBeatmap beatmap)
|
||||||
|
@ -310,6 +310,7 @@
|
|||||||
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableTotalScore.cs" />
|
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableTotalScore.cs" />
|
||||||
<Compile Include="Overlays\Profile\Sections\Ranks\ScoreModsContainer.cs" />
|
<Compile Include="Overlays\Profile\Sections\Ranks\ScoreModsContainer.cs" />
|
||||||
<Compile Include="Overlays\Settings\Sections\Maintenance\DeleteAllBeatmapsDialog.cs" />
|
<Compile Include="Overlays\Settings\Sections\Maintenance\DeleteAllBeatmapsDialog.cs" />
|
||||||
|
<Compile Include="Screens\Select\ImportFromStablePopup.cs" />
|
||||||
<Compile Include="Overlays\Settings\SettingsButton.cs" />
|
<Compile Include="Overlays\Settings\SettingsButton.cs" />
|
||||||
<Compile Include="Rulesets\Edit\Layers\Selection\OriginHandle.cs" />
|
<Compile Include="Rulesets\Edit\Layers\Selection\OriginHandle.cs" />
|
||||||
<Compile Include="Rulesets\Edit\Layers\Selection\HitObjectSelectionBox.cs" />
|
<Compile Include="Rulesets\Edit\Layers\Selection\HitObjectSelectionBox.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user