1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:42:54 +08:00

Create InitialPath property.

This commit is contained in:
Lucas A 2021-05-05 22:13:25 +02:00
parent 9a061ad80b
commit 4bb0e6b7d5
2 changed files with 7 additions and 6 deletions

View File

@ -34,6 +34,8 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
protected virtual bool IsValidDirectory(DirectoryInfo info) => info != null;
protected virtual DirectoryInfo InitialPath => null;
public override bool AllowExternalScreenChange => false;
public override bool DisallowExternalBeatmapRulesetChanges => true;
@ -101,6 +103,9 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
protected override void LoadComplete()
{
if (InitialPath != null)
DirectorySelector.CurrentPath.Value = InitialPath;
DirectorySelector.CurrentPath.BindValueChanged(e => selectionButton.Enabled.Value = IsValidDirectory(e.NewValue), true);
base.LoadComplete();
}

View File

@ -17,6 +17,8 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
[Resolved]
private Storage storage { get; set; }
protected override DirectoryInfo InitialPath => new DirectoryInfo(storage.GetFullPath(string.Empty)).Parent;
protected override OsuSpriteText CreateHeader() => new OsuSpriteText
{
Text = "Please select a new location",
@ -42,12 +44,6 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
BeginMigration(target);
}
protected override void LoadComplete()
{
DirectorySelector.CurrentPath.Value = new DirectoryInfo(storage.GetFullPath(string.Empty)).Parent;
base.LoadComplete();
}
protected virtual void BeginMigration(DirectoryInfo target) => this.Push(new MigrationRunScreen(target));
}
}