From 3b4833ca8eba289957601cab070d86703a74d1ae Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 9 Dec 2021 01:29:45 +0900 Subject: [PATCH] A bit of cleanup + xmldocs on classes/members --- ...TestScenePlaylistsRoomSettingsPlaylist.cs} | 4 +- .../Components/MatchBeatmapDetailArea.cs | 2 +- .../OnlinePlay/DrawableRoomPlaylist.cs | 27 +++++++++- .../OnlinePlay/DrawableRoomPlaylistItem.cs | 50 +++++++++++++------ .../Playlists/PlaylistsRoomSettingsOverlay.cs | 2 +- ...st.cs => PlaylistsRoomSettingsPlaylist.cs} | 7 ++- 6 files changed, 71 insertions(+), 21 deletions(-) rename osu.Game.Tests/Visual/Multiplayer/{TestScenePlaylistsRoomPlaylist.cs => TestScenePlaylistsRoomSettingsPlaylist.cs} (97%) rename osu.Game/Screens/OnlinePlay/Playlists/{PlaylistsRoomPlaylist.cs => PlaylistsRoomSettingsPlaylist.cs} (69%) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsRoomPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsRoomSettingsPlaylist.cs similarity index 97% rename from osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsRoomPlaylist.cs rename to osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsRoomSettingsPlaylist.cs index 264f6aa2c5..93ccd5f1e1 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsRoomPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsRoomSettingsPlaylist.cs @@ -24,7 +24,7 @@ using osuTK.Input; namespace osu.Game.Tests.Visual.Multiplayer { - public class TestScenePlaylistsRoomPlaylist : OsuManualInputManagerTestScene + public class TestScenePlaylistsRoomSettingsPlaylist : OsuManualInputManagerTestScene { private TestPlaylist playlist; @@ -175,7 +175,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for items to load", () => playlist.ItemMap.Values.All(i => i.IsLoaded)); } - private class TestPlaylist : PlaylistsRoomPlaylist + private class TestPlaylist : PlaylistsRoomSettingsPlaylist { public new IReadOnlyDictionary> ItemMap => base.ItemMap; diff --git a/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs b/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs index d56acff8c7..c29b8db26c 100644 --- a/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs +++ b/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens.OnlinePlay.Components { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Bottom = 10 }, - Child = playlist = new PlaylistsRoomPlaylist + Child = playlist = new PlaylistsRoomSettingsPlaylist { RelativeSizeAxes = Axes.Both, AllowSelection = true, diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs index e76d905849..5e58514705 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs @@ -12,8 +12,15 @@ using osuTK; namespace osu.Game.Screens.OnlinePlay { + /// + /// A list scrollable list which displays the s in a . + /// public class DrawableRoomPlaylist : OsuRearrangeableListContainer { + /// + /// The currently-selected item, used to show a border around items. + /// May be updated by playlist items if is true. + /// public readonly Bindable SelectedItem = new Bindable(); /// @@ -22,12 +29,15 @@ namespace osu.Game.Screens.OnlinePlay public Action DeletionRequested; /// - /// Invoked to request showing the results for an item. + /// Invoked when an item requests its results to be shown. /// public Action ShowResultsRequested; private bool allowReordering; + /// + /// Whether to allow reordering items in the playlist. + /// public bool AllowReordering { get => allowReordering; @@ -42,6 +52,10 @@ namespace osu.Game.Screens.OnlinePlay private bool allowDeletion; + /// + /// Whether to allow deleting items from the playlist. + /// If true, requests to delete items may be satisfied via . + /// public bool AllowDeletion { get => allowDeletion; @@ -56,6 +70,10 @@ namespace osu.Game.Screens.OnlinePlay private bool allowSelection; + /// + /// Whether to allow selecting items from the playlist. + /// If true, clicking on items in the playlist will change the value of . + /// public bool AllowSelection { get => allowSelection; @@ -70,6 +88,10 @@ namespace osu.Game.Screens.OnlinePlay private bool allowShowingResults; + /// + /// Whether to allow items to request their results to be shown. + /// If true, requests to show the results may be satisfied via . + /// public bool AllowShowingResults { get => allowShowingResults; @@ -84,6 +106,9 @@ namespace osu.Game.Screens.OnlinePlay private bool showItemOwners; + /// + /// Whether to show the avatar of users which own each playlist item. + /// public bool ShowItemOwners { get => showItemOwners; diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index 28b4997b63..fca944e9b6 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -40,11 +40,30 @@ namespace osu.Game.Screens.OnlinePlay public const float HEIGHT = 50; public const float ICON_HEIGHT = 34; + /// + /// Invoked when this item requests to be deleted. + /// public Action RequestDeletion; + + /// + /// Invoked when this item requests its results to be shown. + /// public Action ShowResultsRequested; + /// + /// The currently-selected item, used to show a border around this item. + /// May be updated by this item if is true. + /// public readonly Bindable SelectedItem = new Bindable(); + public readonly PlaylistItem Item; + + private readonly DelayedLoadWrapper onScreenLoader = new DelayedLoadWrapper(Empty) { RelativeSizeAxes = Axes.Both }; + private readonly IBindable valid = new Bindable(); + private readonly Bindable beatmap = new Bindable(); + private readonly Bindable ruleset = new Bindable(); + private readonly BindableList requiredMods = new BindableList(); + private Container maskingContainer; private Container difficultyIconContainer; private LinkFlowContainer beatmapText; @@ -55,14 +74,8 @@ namespace osu.Game.Screens.OnlinePlay private UpdateableAvatar ownerAvatar; private Drawable removeButton; private Drawable showResultsButton; - - private readonly IBindable valid = new Bindable(); - - private readonly Bindable beatmap = new Bindable(); - private readonly Bindable ruleset = new Bindable(); - private readonly BindableList requiredMods = new BindableList(); - - public readonly PlaylistItem Item; + private PanelBackground panelBackground; + private FillFlowContainer mainFillFlow; [Resolved] private OsuColour colours { get; set; } @@ -73,12 +86,6 @@ namespace osu.Game.Screens.OnlinePlay [Resolved] private BeatmapLookupCache beatmapLookupCache { get; set; } - private PanelBackground panelBackground; - - private readonly DelayedLoadWrapper onScreenLoader = new DelayedLoadWrapper(Empty) { RelativeSizeAxes = Axes.Both }; - - private FillFlowContainer mainFillFlow; - protected override bool ShouldBeConsideredForInput(Drawable child) => AllowReordering || AllowDeletion || !AllowSelection || SelectedItem.Value == Model; public DrawableRoomPlaylistItem(PlaylistItem item) @@ -157,8 +164,14 @@ namespace osu.Game.Screens.OnlinePlay refresh(); } + /// + /// Whether this item can be selected. + /// public bool AllowSelection { get; set; } + /// + /// Whether this item can be reordered in the playlist. + /// public bool AllowReordering { get => ShowDragHandle.Value; @@ -167,6 +180,9 @@ namespace osu.Game.Screens.OnlinePlay private bool allowDeletion; + /// + /// Whether this item can be deleted. + /// public bool AllowDeletion { get => allowDeletion; @@ -181,6 +197,9 @@ namespace osu.Game.Screens.OnlinePlay private bool allowShowingResults; + /// + /// Whether this item can have results shown. + /// public bool AllowShowingResults { get => allowShowingResults; @@ -195,6 +214,9 @@ namespace osu.Game.Screens.OnlinePlay private bool showItemOwner; + /// + /// Whether to display the avatar of the user which owns this playlist item. + /// public bool ShowItemOwner { get => showItemOwner; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs index 915ec356d5..8f31422add 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs @@ -205,7 +205,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists { new Drawable[] { - playlist = new PlaylistsRoomPlaylist + playlist = new PlaylistsRoomSettingsPlaylist { RelativeSizeAxes = Axes.Both, } diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsPlaylist.cs similarity index 69% rename from osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomPlaylist.cs rename to osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsPlaylist.cs index d8c316b642..bbe67e76e3 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsPlaylist.cs @@ -6,9 +6,12 @@ using osu.Framework.Extensions.IEnumerableExtensions; namespace osu.Game.Screens.OnlinePlay.Playlists { - public class PlaylistsRoomPlaylist : DrawableRoomPlaylist + /// + /// A which is displayed during the setup stage of a playlists room. + /// + public class PlaylistsRoomSettingsPlaylist : DrawableRoomPlaylist { - public PlaylistsRoomPlaylist() + public PlaylistsRoomSettingsPlaylist() { AllowReordering = true; AllowDeletion = true;