diff --git a/osu.Game/Screens/Select/Filter/GroupMode.cs b/osu.Game/Screens/Select/Filter/GroupMode.cs
index 6a48a21bf5..9ce5b36202 100644
--- a/osu.Game/Screens/Select/Filter/GroupMode.cs
+++ b/osu.Game/Screens/Select/Filter/GroupMode.cs
@@ -41,8 +41,8 @@ namespace osu.Game.Screens.Select.Filter
[LocalisableDescription(typeof(SongSelectStrings), nameof(SongSelectStrings.Length))]
Length,
- // [LocalisableDescription(typeof(SongSelectStrings), nameof(SongSelectStrings.MyMaps))]
- // MyMaps,
+ [LocalisableDescription(typeof(SongSelectStrings), nameof(SongSelectStrings.MyMaps))]
+ MyMaps,
// [LocalisableDescription(typeof(SongSelectStrings), nameof(SongSelectStrings.RankAchieved))]
// RankAchieved,
diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs
index 05c36a43cf..ce7d624e2a 100644
--- a/osu.Game/Screens/Select/FilterCriteria.cs
+++ b/osu.Game/Screens/Select/FilterCriteria.cs
@@ -118,6 +118,18 @@ namespace osu.Game.Screens.Select
public IRulesetFilterCriteria? RulesetCriteria { get; set; }
+ ///
+ /// The user ID of the current local user, used to filter to own maps when is selected.
+ /// Or null if the user is not logged in.
+ ///
+ public int? LocalUserId { get; set; }
+
+ ///
+ /// The username of the current local user, used to filter to own maps when is selected.
+ /// Or null if the user is not logged in.
+ ///
+ public string? LocalUserUsername { get; set; }
+
public readonly struct OptionalSet : IEquatable>
where T : struct, Enum
{
diff --git a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs
index cba1d36ba7..cd025a1cc6 100644
--- a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs
+++ b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs
@@ -220,13 +220,13 @@ namespace osu.Game.Screens.SelectV2
var collections = getCollections?.Invoke() ?? Enumerable.Empty();
return getGroupsBy(b => defineGroupByCollection(b, collections), items);
+ case GroupMode.MyMaps:
+ return getGroupsBy(b => defineGroupByOwnMaps(b, criteria.LocalUserId, criteria.LocalUserUsername), items);
+
// TODO: need implementation
// case GroupMode.Favourites:
// goto case GroupMode.None;
//
- // case GroupMode.MyMaps:
- // goto case GroupMode.None;
- //
// case GroupMode.RankAchieved:
// goto case GroupMode.None;
@@ -395,6 +395,16 @@ namespace osu.Game.Screens.SelectV2
return new GroupDefinition(1, "Not in collection");
}
+ private GroupDefinition defineGroupByOwnMaps(BeatmapInfo beatmap, int? localUserId, string? localUserUsername)
+ {
+ var author = beatmap.BeatmapSet!.Metadata.Author;
+
+ if (author.OnlineID == localUserId || author.Username == localUserUsername)
+ return new GroupDefinition(0, "My maps");
+
+ return new GroupDefinition(1, "Not my maps");
+ }
+
private static T? aggregateMax(BeatmapInfo b, Func func)
{
var beatmaps = b.BeatmapSet!.Beatmaps.Where(bb => !bb.Hidden);
diff --git a/osu.Game/Screens/SelectV2/FilterControl.cs b/osu.Game/Screens/SelectV2/FilterControl.cs
index 54702d2c84..96ede88c7c 100644
--- a/osu.Game/Screens/SelectV2/FilterControl.cs
+++ b/osu.Game/Screens/SelectV2/FilterControl.cs
@@ -19,6 +19,8 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Localisation;
+using osu.Game.Online.API;
+using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select;
@@ -54,6 +56,11 @@ namespace osu.Game.Screens.SelectV2
[Resolved]
private RealmAccess realm { get; set; } = null!;
+ [Resolved]
+ private IAPIProvider api { get; set; } = null!;
+
+ private IBindable? localUser;
+
public LocalisableString StatusText
{
get => searchTextBox.StatusText;
@@ -229,6 +236,10 @@ namespace osu.Game.Screens.SelectV2
if (changeSet != null && groupDropdown.Current.Value == GroupMode.Collections)
updateCriteria();
});
+
+ localUser = api.LocalUser.GetBoundCopy();
+ localUser.BindValueChanged(_ => updateCriteria());
+
updateCriteria();
}
@@ -244,6 +255,7 @@ namespace osu.Game.Screens.SelectV2
public FilterCriteria CreateCriteria()
{
string query = searchTextBox.Current.Value;
+ bool isValidUser = api.LocalUser.Value.Id > 1;
var criteria = new FilterCriteria
{
@@ -252,7 +264,9 @@ namespace osu.Game.Screens.SelectV2
AllowConvertedBeatmaps = showConvertedBeatmapsButton.Active.Value,
Ruleset = ruleset.Value,
Mods = mods.Value,
- CollectionBeatmapMD5Hashes = collectionDropdown.Current.Value?.Collection?.PerformRead(c => c.BeatmapMD5Hashes).ToImmutableHashSet()
+ CollectionBeatmapMD5Hashes = collectionDropdown.Current.Value?.Collection?.PerformRead(c => c.BeatmapMD5Hashes).ToImmutableHashSet(),
+ LocalUserId = isValidUser ? api.LocalUser.Value.Id : null,
+ LocalUserUsername = isValidUser ? api.LocalUser.Value.Username : null,
};
if (!difficultyRangeSlider.LowerBound.IsDefault)