Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion osu.Game/Screens/Edit/Components/FormSampleSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public Bindable<EditorBeatmapSkin.SampleSet?> Current

private readonly BindableWithCurrent<EditorBeatmapSkin.SampleSet?> current = new BindableWithCurrent<EditorBeatmapSkin.SampleSet?>();
private readonly Dictionary<(string name, string bank), SampleButton> buttons = new Dictionary<(string, string), SampleButton>();
private readonly Bindable<DirectoryInfo?> lastSelectedFileDirectory = new Bindable<DirectoryInfo?>();

private FormControlBackground background = null!;
private FormFieldCaption caption = null!;
Expand Down Expand Up @@ -125,6 +126,7 @@ private IEnumerable<Drawable[]> createTableContent()
Margin = new MarginPadding(5),
SampleAddRequested = SampleAddRequested,
SampleRemoveRequested = SampleRemoveRequested,
LastSelectedFileDirectory = { BindTarget = lastSelectedFileDirectory },
};

protected override void LoadComplete()
Expand Down Expand Up @@ -197,6 +199,7 @@ public partial class SampleButton : OsuButton, IHasPopover, IHasContextMenu
public Action<string>? SampleRemoveRequested { get; init; }

private Bindable<FileInfo?> selectedFile { get; } = new Bindable<FileInfo?>();
public Bindable<DirectoryInfo?> LastSelectedFileDirectory { get; } = new Bindable<DirectoryInfo?>();

private TrianglesV2? triangles { get; set; }

Expand Down Expand Up @@ -313,6 +316,7 @@ private void addSample()

this.HidePopover();
ActualFilename.Value = SampleAddRequested?.Invoke(selectedFile.Value, ExpectedFilename.Value) ?? selectedFile.Value.ToString();
LastSelectedFileDirectory.Value = selectedFile.Value.Directory;
}

private void deleteSample()
Expand All @@ -324,7 +328,9 @@ private void deleteSample()
ActualFilename.Value = null;
}

public Popover? GetPopover() => ActualFilename.Value == null ? new FormFileSelector.FileChooserPopover(SupportedExtensions.AUDIO_EXTENSIONS, selectedFile, null) : null;
public Popover? GetPopover() => ActualFilename.Value == null
? new FormFileSelector.FileChooserPopover(SupportedExtensions.AUDIO_EXTENSIONS, selectedFile, LastSelectedFileDirectory.Value?.FullName)
: null;

public MenuItem[]? ContextMenuItems =>
ActualFilename.Value != null
Expand Down
Loading