1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 15:33:05 +08:00

A bit of cleanup + xmldocs on classes/members

This commit is contained in:
Dan Balasescu 2021-12-09 01:29:45 +09:00
parent be2dbf42c3
commit 3b4833ca8e
6 changed files with 71 additions and 21 deletions

View File

@ -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<PlaylistItem, RearrangeableListItem<PlaylistItem>> ItemMap => base.ItemMap;

View File

@ -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,

View File

@ -12,8 +12,15 @@ using osuTK;
namespace osu.Game.Screens.OnlinePlay
{
/// <summary>
/// A list scrollable list which displays the <see cref="PlaylistItem"/>s in a <see cref="Room"/>.
/// </summary>
public class DrawableRoomPlaylist : OsuRearrangeableListContainer<PlaylistItem>
{
/// <summary>
/// The currently-selected item, used to show a border around items.
/// May be updated by playlist items if <see cref="AllowSelection"/> is <c>true</c>.
/// </summary>
public readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
/// <summary>
@ -22,12 +29,15 @@ namespace osu.Game.Screens.OnlinePlay
public Action<PlaylistItem> DeletionRequested;
/// <summary>
/// Invoked to request showing the results for an item.
/// Invoked when an item requests its results to be shown.
/// </summary>
public Action<PlaylistItem> ShowResultsRequested;
private bool allowReordering;
/// <summary>
/// Whether to allow reordering items in the playlist.
/// </summary>
public bool AllowReordering
{
get => allowReordering;
@ -42,6 +52,10 @@ namespace osu.Game.Screens.OnlinePlay
private bool allowDeletion;
/// <summary>
/// Whether to allow deleting items from the playlist.
/// If <c>true</c>, requests to delete items may be satisfied via <see cref="DeletionRequested"/>.
/// </summary>
public bool AllowDeletion
{
get => allowDeletion;
@ -56,6 +70,10 @@ namespace osu.Game.Screens.OnlinePlay
private bool allowSelection;
/// <summary>
/// Whether to allow selecting items from the playlist.
/// If <c>true</c>, clicking on items in the playlist will change the value of <see cref="SelectedItem"/>.
/// </summary>
public bool AllowSelection
{
get => allowSelection;
@ -70,6 +88,10 @@ namespace osu.Game.Screens.OnlinePlay
private bool allowShowingResults;
/// <summary>
/// Whether to allow items to request their results to be shown.
/// If <c>true</c>, requests to show the results may be satisfied via <see cref="ShowResultsRequested"/>.
/// </summary>
public bool AllowShowingResults
{
get => allowShowingResults;
@ -84,6 +106,9 @@ namespace osu.Game.Screens.OnlinePlay
private bool showItemOwners;
/// <summary>
/// Whether to show the avatar of users which own each playlist item.
/// </summary>
public bool ShowItemOwners
{
get => showItemOwners;

View File

@ -40,11 +40,30 @@ namespace osu.Game.Screens.OnlinePlay
public const float HEIGHT = 50;
public const float ICON_HEIGHT = 34;
/// <summary>
/// Invoked when this item requests to be deleted.
/// </summary>
public Action<PlaylistItem> RequestDeletion;
/// <summary>
/// Invoked when this item requests its results to be shown.
/// </summary>
public Action<PlaylistItem> ShowResultsRequested;
/// <summary>
/// The currently-selected item, used to show a border around this item.
/// May be updated by this item if <see cref="AllowSelection"/> is <c>true</c>.
/// </summary>
public readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
public readonly PlaylistItem Item;
private readonly DelayedLoadWrapper onScreenLoader = new DelayedLoadWrapper(Empty) { RelativeSizeAxes = Axes.Both };
private readonly IBindable<bool> valid = new Bindable<bool>();
private readonly Bindable<IBeatmapInfo> beatmap = new Bindable<IBeatmapInfo>();
private readonly Bindable<IRulesetInfo> ruleset = new Bindable<IRulesetInfo>();
private readonly BindableList<Mod> requiredMods = new BindableList<Mod>();
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<bool> valid = new Bindable<bool>();
private readonly Bindable<IBeatmapInfo> beatmap = new Bindable<IBeatmapInfo>();
private readonly Bindable<IRulesetInfo> ruleset = new Bindable<IRulesetInfo>();
private readonly BindableList<Mod> requiredMods = new BindableList<Mod>();
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();
}
/// <summary>
/// Whether this item can be selected.
/// </summary>
public bool AllowSelection { get; set; }
/// <summary>
/// Whether this item can be reordered in the playlist.
/// </summary>
public bool AllowReordering
{
get => ShowDragHandle.Value;
@ -167,6 +180,9 @@ namespace osu.Game.Screens.OnlinePlay
private bool allowDeletion;
/// <summary>
/// Whether this item can be deleted.
/// </summary>
public bool AllowDeletion
{
get => allowDeletion;
@ -181,6 +197,9 @@ namespace osu.Game.Screens.OnlinePlay
private bool allowShowingResults;
/// <summary>
/// Whether this item can have results shown.
/// </summary>
public bool AllowShowingResults
{
get => allowShowingResults;
@ -195,6 +214,9 @@ namespace osu.Game.Screens.OnlinePlay
private bool showItemOwner;
/// <summary>
/// Whether to display the avatar of the user which owns this playlist item.
/// </summary>
public bool ShowItemOwner
{
get => showItemOwner;

View File

@ -205,7 +205,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
{
new Drawable[]
{
playlist = new PlaylistsRoomPlaylist
playlist = new PlaylistsRoomSettingsPlaylist
{
RelativeSizeAxes = Axes.Both,
}

View File

@ -6,9 +6,12 @@ using osu.Framework.Extensions.IEnumerableExtensions;
namespace osu.Game.Screens.OnlinePlay.Playlists
{
public class PlaylistsRoomPlaylist : DrawableRoomPlaylist
/// <summary>
/// A <see cref="DrawableRoomPlaylist"/> which is displayed during the setup stage of a playlists room.
/// </summary>
public class PlaylistsRoomSettingsPlaylist : DrawableRoomPlaylist
{
public PlaylistsRoomPlaylist()
public PlaylistsRoomSettingsPlaylist()
{
AllowReordering = true;
AllowDeletion = true;