1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 14:13:18 +08:00

Minor code reformatting

This commit is contained in:
Dean Herbert 2021-12-09 17:48:09 +09:00
parent 0963b00453
commit dfe19f3509
2 changed files with 41 additions and 22 deletions

View File

@ -62,7 +62,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Test]
public void TestEditable()
{
createPlaylist(p => p.AllowReordering = p.AllowDeletion = true);
createPlaylist(p =>
{
p.AllowReordering = true;
p.AllowDeletion = true;
});
moveToItem(0);
assertHandleVisibility(0, true);
@ -75,7 +79,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Test]
public void TestMarkInvalid()
{
createPlaylist(p => p.AllowReordering = p.AllowDeletion = p.AllowSelection = true);
createPlaylist(p =>
{
p.AllowReordering = true;
p.AllowDeletion = true;
p.AllowSelection = true;
});
AddStep("mark item 0 as invalid", () => playlist.Items[0].MarkInvalid());
@ -102,7 +111,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Test]
public void TestEditableSelectable()
{
createPlaylist(p => p.AllowReordering = p.AllowDeletion = p.AllowSelection = true);
createPlaylist(p =>
{
p.AllowReordering = true;
p.AllowDeletion = true;
p.AllowSelection = true;
});
moveToItem(0);
assertHandleVisibility(0, true);
@ -116,7 +130,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Test]
public void TestSelectionNotLostAfterRearrangement()
{
createPlaylist(p => p.AllowReordering = p.AllowDeletion = p.AllowSelection = true);
createPlaylist(p =>
{
p.AllowReordering = true;
p.AllowDeletion = true;
p.AllowSelection = true;
});
moveToItem(0);
AddStep("click", () => InputManager.Click(MouseButton.Left));

View File

@ -38,7 +38,8 @@ namespace osu.Game.Screens.OnlinePlay
public class DrawableRoomPlaylistItem : OsuRearrangeableListItem<PlaylistItem>
{
public const float HEIGHT = 50;
public const float ICON_HEIGHT = 34;
private const float icon_height = 34;
/// <summary>
/// Invoked when this item requests to be deleted.
@ -238,7 +239,7 @@ namespace osu.Game.Screens.OnlinePlay
}
if (Item.Beatmap.Value != null)
difficultyIconContainer.Child = new DifficultyIcon(Item.Beatmap.Value, ruleset.Value, requiredMods, performBackgroundDifficultyLookup: false) { Size = new Vector2(ICON_HEIGHT) };
difficultyIconContainer.Child = new DifficultyIcon(Item.Beatmap.Value, ruleset.Value, requiredMods, performBackgroundDifficultyLookup: false) { Size = new Vector2(icon_height) };
else
difficultyIconContainer.Clear();
@ -392,7 +393,7 @@ namespace osu.Game.Screens.OnlinePlay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(ICON_HEIGHT),
Size = new Vector2(icon_height),
Margin = new MarginPadding { Right = 8 },
Masking = true,
CornerRadius = 4,
@ -405,22 +406,21 @@ namespace osu.Game.Screens.OnlinePlay
};
}
private IEnumerable<Drawable> createButtons() =>
new[]
private IEnumerable<Drawable> createButtons() => new[]
{
showResultsButton = new ShowResultsButton
{
showResultsButton = new ShowResultsButton
{
Action = () => RequestResults?.Invoke(Item),
Alpha = AllowShowingResults ? 1 : 0,
},
Item.Beatmap.Value == null ? Empty() : new PlaylistDownloadButton(Item),
removeButton = new PlaylistRemoveButton
{
Size = new Vector2(30, 30),
Alpha = AllowDeletion ? 1 : 0,
Action = () => RequestDeletion?.Invoke(Item),
},
};
Action = () => RequestResults?.Invoke(Item),
Alpha = AllowShowingResults ? 1 : 0,
},
Item.Beatmap.Value == null ? Empty() : new PlaylistDownloadButton(Item),
removeButton = new PlaylistRemoveButton
{
Size = new Vector2(30, 30),
Alpha = AllowDeletion ? 1 : 0,
Action = () => RequestDeletion?.Invoke(Item),
},
};
public class PlaylistRemoveButton : GrayButton
{