mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 16:52:54 +08:00
Merge pull request #16019 from smoogipoo/cleanup-playlist-item-buttons
Cleanup duplicated classes in DrawableRoomPlaylistItem
This commit is contained in:
commit
1952819db2
@ -248,6 +248,16 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddAssert("owner visible", () => playlist.ChildrenOfType<UpdateableAvatar>().All(a => a.IsPresent == withOwner));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestWithAllButtonsEnabled()
|
||||
{
|
||||
createPlaylist(p =>
|
||||
{
|
||||
p.AllowDeletion = true;
|
||||
p.AllowShowingResults = true;
|
||||
});
|
||||
}
|
||||
|
||||
private void moveToItem(int index, Vector2? offset = null)
|
||||
=> AddStep($"move mouse to item {index}", () => InputManager.MoveMouseTo(playlist.ChildrenOfType<DifficultyIcon>().ElementAt(index), offset));
|
||||
|
||||
|
@ -73,8 +73,8 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
private ModDisplay modDisplay;
|
||||
private FillFlowContainer buttonsFlow;
|
||||
private UpdateableAvatar ownerAvatar;
|
||||
private Drawable removeButton;
|
||||
private Drawable showResultsButton;
|
||||
private Drawable removeButton;
|
||||
private PanelBackground panelBackground;
|
||||
private FillFlowContainer mainFillFlow;
|
||||
|
||||
@ -408,10 +408,12 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
|
||||
private IEnumerable<Drawable> createButtons() => new[]
|
||||
{
|
||||
showResultsButton = new ShowResultsButton
|
||||
showResultsButton = new GrayButton(FontAwesome.Solid.ChartPie)
|
||||
{
|
||||
Size = new Vector2(30, 30),
|
||||
Action = () => RequestResults?.Invoke(Item),
|
||||
Alpha = AllowShowingResults ? 1 : 0,
|
||||
TooltipText = "View results"
|
||||
},
|
||||
Item.Beatmap.Value == null ? Empty() : new PlaylistDownloadButton(Item),
|
||||
removeButton = new PlaylistRemoveButton
|
||||
@ -419,24 +421,10 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
Size = new Vector2(30, 30),
|
||||
Alpha = AllowDeletion ? 1 : 0,
|
||||
Action = () => RequestDeletion?.Invoke(Item),
|
||||
TooltipText = "Remove from playlist"
|
||||
},
|
||||
};
|
||||
|
||||
public class PlaylistRemoveButton : GrayButton
|
||||
{
|
||||
public PlaylistRemoveButton()
|
||||
: base(FontAwesome.Solid.MinusSquare)
|
||||
{
|
||||
TooltipText = "Remove from playlist";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Icon.Scale = new Vector2(0.8f);
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (AllowSelection && valid.Value)
|
||||
@ -444,6 +432,14 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
return true;
|
||||
}
|
||||
|
||||
public class PlaylistRemoveButton : GrayButton
|
||||
{
|
||||
public PlaylistRemoveButton()
|
||||
: base(FontAwesome.Solid.MinusSquare)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class PlaylistDownloadButton : BeatmapDownloadButton
|
||||
{
|
||||
private readonly PlaylistItem playlistItem;
|
||||
@ -497,23 +493,6 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
}
|
||||
}
|
||||
|
||||
private class ShowResultsButton : IconButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Icon = FontAwesome.Solid.ChartPie;
|
||||
TooltipText = "View results";
|
||||
|
||||
Add(new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = float.MaxValue,
|
||||
Colour = colours.Gray4,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// For now, this is the same implementation as in PanelBackground, but supports a beatmap info rather than a working beatmap
|
||||
private class PanelBackground : Container // todo: should be a buffered container (https://github.com/ppy/osu-framework/issues/3222)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user