2020-02-14 16:20:38 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2020-02-14 16:20:38 +08:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2020-12-25 12:38:11 +08:00
|
|
|
using osu.Game.Online.Rooms;
|
2021-12-08 19:38:18 +08:00
|
|
|
using osu.Game.Screens.OnlinePlay.Playlists;
|
2020-02-14 16:20:38 +08:00
|
|
|
using osu.Game.Screens.Select;
|
|
|
|
using osuTK;
|
|
|
|
|
2020-12-25 23:50:00 +08:00
|
|
|
namespace osu.Game.Screens.OnlinePlay.Components
|
2020-02-14 16:20:38 +08:00
|
|
|
{
|
|
|
|
public class MatchBeatmapDetailArea : BeatmapDetailArea
|
|
|
|
{
|
|
|
|
public Action CreateNewItem;
|
|
|
|
|
|
|
|
public readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
|
|
|
|
|
|
|
|
[Resolved(typeof(Room))]
|
|
|
|
protected BindableList<PlaylistItem> Playlist { get; private set; }
|
|
|
|
|
|
|
|
private readonly Drawable playlistArea;
|
|
|
|
private readonly DrawableRoomPlaylist playlist;
|
|
|
|
|
|
|
|
public MatchBeatmapDetailArea()
|
|
|
|
{
|
|
|
|
Add(playlistArea = new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Padding = new MarginPadding { Vertical = 10 },
|
|
|
|
Child = new GridContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Padding = new MarginPadding { Bottom = 10 },
|
2021-12-09 00:29:45 +08:00
|
|
|
Child = playlist = new PlaylistsRoomSettingsPlaylist
|
2020-02-14 16:20:38 +08:00
|
|
|
{
|
2021-12-09 16:33:59 +08:00
|
|
|
RelativeSizeAxes = Axes.Both
|
2020-02-14 16:20:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new TriangleButton
|
|
|
|
{
|
2020-02-20 17:34:24 +08:00
|
|
|
Text = "Add new playlist entry",
|
2020-02-14 16:20:38 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Size = Vector2.One,
|
|
|
|
Action = () => CreateNewItem?.Invoke()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
RowDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(),
|
|
|
|
new Dimension(GridSizeMode.Absolute, 50),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
playlist.Items.BindTo(Playlist);
|
|
|
|
playlist.SelectedItem.BindTo(SelectedItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnTabChanged(BeatmapDetailAreaTabItem tab, bool selectedMods)
|
|
|
|
{
|
|
|
|
base.OnTabChanged(tab, selectedMods);
|
|
|
|
|
|
|
|
switch (tab)
|
|
|
|
{
|
2022-06-24 20:25:23 +08:00
|
|
|
case BeatmapDetailAreaPlaylistTabItem:
|
2020-02-14 16:20:38 +08:00
|
|
|
playlistArea.Show();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
playlistArea.Hide();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override BeatmapDetailAreaTabItem[] CreateTabItems() => base.CreateTabItems().Prepend(new BeatmapDetailAreaPlaylistTabItem()).ToArray();
|
|
|
|
}
|
|
|
|
}
|