1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

Privatise button again

This commit is contained in:
Dan Balasescu 2021-12-10 00:38:18 +09:00
parent f9af239ed9
commit 05aa9635a8
4 changed files with 16 additions and 9 deletions

View File

@ -273,7 +273,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
private void assertDeleteButtonVisibility(int index, bool visible)
=> AddAssert($"delete button {index} {(visible ? "is" : "is not")} visible",
() => (playlist.ChildrenOfType<DrawableRoomPlaylistItem>().ElementAt(2 + index * 2).RemoveButton.Alpha > 0) == visible);
() => (playlist.ChildrenOfType<DrawableRoomPlaylistItem.PlaylistRemoveButton>().ElementAt(2 + index * 2).Alpha > 0) == visible);
private void createPlaylist(Action<TestPlaylist> setupPlaylist = null)
{

View File

@ -126,7 +126,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
private void moveToDeleteButton(int index, Vector2? offset = null) => AddStep($"move mouse to delete button {index}", () =>
{
var item = playlist.ChildrenOfType<OsuRearrangeableListItem<PlaylistItem>>().ElementAt(index);
InputManager.MoveMouseTo(item.ChildrenOfType<DrawableRoomPlaylistItem>().ElementAt(0).RemoveButton, offset);
InputManager.MoveMouseTo(item.ChildrenOfType<DrawableRoomPlaylistItem.PlaylistRemoveButton>().ElementAt(0), offset);
});
private void createPlaylist()

View File

@ -154,7 +154,7 @@ namespace osu.Game.Tests.Visual.Online
AddStep($"move mouse to delete button {index}", () =>
{
item = playlist.ChildrenOfType<OsuRearrangeableListItem<PlaylistItem>>().ElementAt(index);
InputManager.MoveMouseTo(item.ChildrenOfType<DrawableRoomPlaylistItem>().ElementAt(0).RemoveButton);
InputManager.MoveMouseTo(item.ChildrenOfType<DrawableRoomPlaylistItem.PlaylistRemoveButton>().ElementAt(0));
});
AddStep("click", () => InputManager.Click(MouseButton.Left));
@ -164,6 +164,6 @@ namespace osu.Game.Tests.Visual.Online
private void assertDeleteButtonVisibility(int index, bool visible)
=> AddUntilStep($"delete button {index} {(visible ? "is" : "is not")} visible",
() => (playlist.ChildrenOfType<DrawableRoomPlaylistItem>().ElementAt(index).RemoveButton.Alpha > 0) == visible);
() => (playlist.ChildrenOfType<DrawableRoomPlaylistItem.PlaylistRemoveButton>().ElementAt(index).Alpha > 0) == visible);
}
}

View File

@ -59,8 +59,6 @@ namespace osu.Game.Screens.OnlinePlay
public readonly PlaylistItem Item;
public Drawable RemoveButton { get; private set; }
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>();
@ -76,6 +74,7 @@ namespace osu.Game.Screens.OnlinePlay
private FillFlowContainer buttonsFlow;
private UpdateableAvatar ownerAvatar;
private Drawable showResultsButton;
private Drawable removeButton;
private PanelBackground panelBackground;
private FillFlowContainer mainFillFlow;
@ -192,8 +191,8 @@ namespace osu.Game.Screens.OnlinePlay
{
allowDeletion = value;
if (RemoveButton != null)
RemoveButton.Alpha = value ? 1 : 0;
if (removeButton != null)
removeButton.Alpha = value ? 1 : 0;
}
}
@ -417,7 +416,7 @@ namespace osu.Game.Screens.OnlinePlay
TooltipText = "View results"
},
Item.Beatmap.Value == null ? Empty() : new PlaylistDownloadButton(Item),
RemoveButton = new GrayButton(FontAwesome.Solid.MinusSquare)
removeButton = new PlaylistRemoveButton
{
Size = new Vector2(30, 30),
Alpha = AllowDeletion ? 1 : 0,
@ -433,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;