mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Add length display to room screen as well
This commit is contained in:
@ -3,9 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using Humanizer;
|
||||
using Humanizer.Localisation;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
@ -339,11 +337,8 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
ApplyButton.Enabled.Value = hasValidSettings;
|
||||
}
|
||||
|
||||
private void onPlaylistChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
double totalLength = Playlist.Select(p => p.Beatmap.Value.Length).Sum();
|
||||
playlistLength.Text = $"Length: {totalLength.Milliseconds().Humanize(minUnit: TimeUnit.Second, maxUnit: TimeUnit.Hour, precision: 2)}";
|
||||
}
|
||||
private void onPlaylistChanged(object sender, NotifyCollectionChangedEventArgs e) =>
|
||||
playlistLength.Text = $"Length: {Playlist.GetTotalDuration()}";
|
||||
|
||||
private bool hasValidSettings => RoomID.Value == null && NameField.Text.Length > 0 && Playlist.Count > 0;
|
||||
|
||||
|
@ -57,6 +57,7 @@ namespace osu.Game.Screens.Multi.Match
|
||||
|
||||
private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
|
||||
private OverlinedHeader participantsHeader;
|
||||
private OverlinedHeader playlistHeader;
|
||||
|
||||
public MatchSubScreen(Room room)
|
||||
{
|
||||
@ -135,7 +136,7 @@ namespace osu.Game.Screens.Multi.Match
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[] { new OverlinedHeader("Playlist"), },
|
||||
new Drawable[] { playlistHeader = new OverlinedHeader("Playlist"), },
|
||||
new Drawable[]
|
||||
{
|
||||
new DrawableRoomPlaylistWithResults
|
||||
@ -243,6 +244,8 @@ namespace osu.Game.Screens.Multi.Match
|
||||
|
||||
managerUpdated = beatmapManager.ItemUpdated.GetBoundCopy();
|
||||
managerUpdated.BindValueChanged(beatmapUpdated);
|
||||
|
||||
playlist.BindCollectionChanged((_, __) => playlistHeader.Details.Value = playlist.GetTotalDuration(), true);
|
||||
}
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
|
Reference in New Issue
Block a user