mirror of
https://github.com/ppy/osu.git
synced 2026-05-23 02:39:52 +08:00
Adjust tray to feel better
This commit is contained in:
@@ -241,7 +241,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 40,
|
||||
Text = "Edit playlist",
|
||||
Text = "+ Add more beatmaps",
|
||||
Action = () => EditPlaylist?.Invoke()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,19 @@
|
||||
|
||||
using System.ComponentModel;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using Container = osu.Framework.Graphics.Containers.Container;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
{
|
||||
@@ -23,64 +27,101 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
|
||||
private OsuScrollContainer scroll = null!;
|
||||
private FillFlowContainer flow = null!;
|
||||
private OsuSpriteText text = null!;
|
||||
|
||||
public PlaylistTray(Room room)
|
||||
{
|
||||
this.room = room;
|
||||
|
||||
Size = new Vector2(400, 75);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
Size = new Vector2(500, 75);
|
||||
|
||||
Masking = true;
|
||||
CornerRadius = 20;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
new Box
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = colourProvider.Background6.Opacity(0.2f),
|
||||
Offset = new Vector2(2),
|
||||
Radius = 8,
|
||||
};
|
||||
|
||||
InternalChild = new BufferedContainer(pixelSnapping: true)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.9f
|
||||
},
|
||||
new GridContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = DrawableRoomPlaylistItem.HEIGHT,
|
||||
Padding = new MarginPadding { Horizontal = 20 },
|
||||
ColumnDimensions = new[]
|
||||
new Box
|
||||
{
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension()
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background3,
|
||||
},
|
||||
Content = new[]
|
||||
new GridContainer
|
||||
{
|
||||
new Drawable[]
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = DrawableRoomPlaylistItem.HEIGHT,
|
||||
Padding = new MarginPadding { Horizontal = 10 },
|
||||
ColumnDimensions = new[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Text = "Playlist",
|
||||
Font = OsuFont.Default.With(size: 20)
|
||||
},
|
||||
scroll = new OsuScrollContainer(Direction.Horizontal)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Margin = new MarginPadding { Left = 10 },
|
||||
ScrollbarVisible = false,
|
||||
Child = flow = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Horizontal
|
||||
}
|
||||
}
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension()
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.Style.Heading2,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Y = 20,
|
||||
Font = OsuFont.Style.Caption2,
|
||||
Text = "Manage items on previous screen"
|
||||
},
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
scroll = new OsuScrollContainer(Direction.Horizontal)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ScrollbarVisible = false,
|
||||
Child = flow = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Spacing = new Vector2(5),
|
||||
Direction = FillDirection.Horizontal
|
||||
}
|
||||
},
|
||||
new Box
|
||||
{
|
||||
Colour = ColourInfo.GradientHorizontal(colourProvider.Background3, colourProvider.Background3.Opacity(0)),
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
X = -1,
|
||||
Width = 60,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -92,6 +133,8 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
|
||||
room.PropertyChanged += onRoomPropertyChanged;
|
||||
updateRoomPlaylist();
|
||||
|
||||
this.FadeOut();
|
||||
}
|
||||
|
||||
private void onRoomPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
@@ -104,19 +147,27 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
{
|
||||
if (room.Playlist.Count > 0)
|
||||
{
|
||||
flow.Add(new DrawableRoomPlaylistItem(room.Playlist[^1], loadImmediately: true)
|
||||
var newItem = new DrawableRoomPlaylistItem(room.Playlist[^1], loadImmediately: true)
|
||||
{
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 250,
|
||||
AllowReordering = false,
|
||||
});
|
||||
};
|
||||
|
||||
if (flow.Count > 1)
|
||||
flow[0].Expire();
|
||||
|
||||
flow.Add(newItem);
|
||||
|
||||
scroll.ScrollToStart(animated: false);
|
||||
ScheduleAfterChildren(() => scroll.ScrollToEnd());
|
||||
|
||||
Scheduler.AddDelayed(() => text.Text = $"{room.Playlist.Count} item(s)", 100);
|
||||
}
|
||||
|
||||
scroll.ScrollToStart(animated: false);
|
||||
|
||||
this.FadeIn(200);
|
||||
ScheduleAfterChildren(() => scroll.ScrollToEnd());
|
||||
this.Delay(1000).FadeOut(200);
|
||||
this.FadeIn(200)
|
||||
.Delay(2000)
|
||||
.FadeOut(200);
|
||||
}
|
||||
|
||||
// Disallow the user from interacting with the scrolling elements.
|
||||
|
||||
@@ -149,13 +149,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
freeModSelect.IsValidMod = isValidAllowedMod;
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
if (room.Playlist.Count <= 1)
|
||||
room.Playlist = [createItem()];
|
||||
|
||||
this.Exit();
|
||||
}
|
||||
protected override void OnStart() => AddNewItem();
|
||||
|
||||
public override void OnEntering(ScreenTransitionEvent e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user