diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs new file mode 100644 index 0000000000..1976db907c --- /dev/null +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using OpenTK.Graphics; + +namespace osu.Game.Beatmaps.Drawables +{ + public class UpdateableBeatmapSetCover : Container + { + private Drawable displayedCover; + + private BeatmapSetInfo beatmapSet; + public BeatmapSetInfo BeatmapSet + { + get { return beatmapSet; } + set + { + if (value == beatmapSet) return; + beatmapSet = value; + + if (IsLoaded) + updateCover(); + } + } + + private BeatmapSetCoverType coverType = BeatmapSetCoverType.Cover; + public BeatmapSetCoverType CoverType + { + get { return coverType; } + set + { + if (value == coverType) return; + coverType = value; + + if (IsLoaded) + updateCover(); + } + } + + public UpdateableBeatmapSetCover() + { + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + updateCover(); + } + + private void updateCover() + { + displayedCover?.FadeOut(400); + displayedCover?.Expire(); + displayedCover = null; + + if (beatmapSet != null) + { + Add(displayedCover = new DelayedLoadWrapper( + new BeatmapSetCover(beatmapSet, coverType) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), + }) + ); + } + } + } +} diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index ae3fb5ec6e..b076afbcdb 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Framework.Configuration; using osu.Game.Beatmaps; using osu.Game.Users; @@ -16,6 +17,6 @@ namespace osu.Game.Online.Multiplayer public Bindable Type = new Bindable(); public Bindable Beatmap = new Bindable(); public Bindable MaxParticipants = new Bindable(); - public Bindable Participants = new Bindable(); + public Bindable> Participants = new Bindable>(); } } diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index 66e3148065..398518ef2b 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -49,8 +49,8 @@ namespace osu.Game.Overlays.BeatmapSet fields.Children = new Drawable[] { - new Field("made by", BeatmapSet.Metadata.Author.Username, @"Exo2.0-RegularItalic"), - new Field("submitted on", online.Submitted.ToString(@"MMM d, yyyy"), @"Exo2.0-Bold") + new Field("mapped by", BeatmapSet.Metadata.Author.Username, @"Exo2.0-RegularItalic"), + new Field("submitted on", online.Submitted.ToString(@"MMMM d, yyyy"), @"Exo2.0-Bold") { Margin = new MarginPadding { Top = 5 }, }, @@ -58,11 +58,11 @@ namespace osu.Game.Overlays.BeatmapSet if (online.Ranked.HasValue) { - fields.Add(new Field("ranked on ", online.Ranked.Value.ToString(@"MMM d, yyyy"), @"Exo2.0-Bold")); + fields.Add(new Field("ranked on", online.Ranked.Value.ToString(@"MMMM d, yyyy"), @"Exo2.0-Bold")); } else if (online.LastUpdated.HasValue) { - fields.Add(new Field("last updated on ", online.LastUpdated.Value.ToString(@"MMM d, yyyy"), @"Exo2.0-Bold")); + fields.Add(new Field("last updated on", online.LastUpdated.Value.ToString(@"MMMM d, yyyy"), @"Exo2.0-Bold")); } } diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 8833a89479..89c141ef17 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.BeatmapSet private const float buttons_spacing = 5; private readonly Box tabsBg; - private readonly Container coverContainer; + private readonly UpdateableBeatmapSetCover cover; private readonly OsuSpriteText title, artist; private readonly Container noVideoButtons; private readonly FillFlowContainer videoButtons; @@ -36,7 +36,6 @@ namespace osu.Game.Overlays.BeatmapSet public Details Details; private BeatmapManager beatmaps; - private DelayedLoadWrapper cover; public readonly BeatmapPicker Picker; @@ -62,8 +61,8 @@ namespace osu.Game.Overlays.BeatmapSet title.Text = BeatmapSet?.Metadata.Title ?? string.Empty; artist.Text = BeatmapSet?.Metadata.Artist ?? string.Empty; onlineStatusPill.Status = BeatmapSet?.OnlineInfo.Status ?? BeatmapSetOnlineStatus.None; + cover.BeatmapSet = BeatmapSet; - cover?.FadeOut(400, Easing.Out); if (BeatmapSet != null) { downloadButtonsContainer.FadeIn(transition_duration); @@ -71,19 +70,6 @@ namespace osu.Game.Overlays.BeatmapSet noVideoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 0 : 1, transition_duration); videoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 1 : 0, transition_duration); - - coverContainer.Add(cover = new DelayedLoadWrapper( - new BeatmapSetCover(BeatmapSet) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), - }, 300) - { - RelativeSizeAxes = Axes.Both, - }); } else { @@ -130,12 +116,7 @@ namespace osu.Game.Overlays.BeatmapSet RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }, - coverContainer = new Container + cover = new UpdateableBeatmapSetCover { RelativeSizeAxes = Axes.Both, }, diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index cc0123dabc..df784252ce 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -27,8 +27,6 @@ namespace osu.Game.Overlays.Direct { public readonly BeatmapSetInfo SetInfo; - protected Box BlackBackground; - private const double hover_transition_time = 400; private Container content; @@ -81,12 +79,6 @@ namespace osu.Game.Overlays.Direct EdgeEffect = edgeEffectNormal, Children = new[] { - // temporary blackness until the actual background loads. - BlackBackground = new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }, CreateBackground(), progressBar = new ProgressBar { @@ -215,21 +207,10 @@ namespace osu.Game.Overlays.Direct return icons; } - protected Drawable CreateBackground() => new DelayedLoadWrapper( - new BeatmapSetCover(SetInfo) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fill, - OnLoadComplete = d => - { - d.FadeInFromZero(400, Easing.Out); - BlackBackground.Delay(400).FadeOut(); - }, - }, 300) + protected Drawable CreateBackground() => new UpdateableBeatmapSetCover { RelativeSizeAxes = Axes.Both, + BeatmapSet = SetInfo, }; public class Statistic : FillFlowContainer diff --git a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs index be8e09105b..0a2b2fe121 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs @@ -24,19 +24,13 @@ namespace osu.Game.Overlays.Profile.Sections.Historical this.playCount = playCount; } - protected override Drawable CreateLeftVisual() => new DelayedLoadWrapper(new BeatmapSetCover(beatmap.BeatmapSet, BeatmapSetCoverType.List) + protected override Drawable CreateLeftVisual() => new UpdateableBeatmapSetCover { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fit, - RelativeSizeAxes = Axes.Both, - OnLoadComplete = d => d.FadeInFromZero(500, Easing.OutQuint) - }) - { - Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - RelativeSizeAxes = Axes.None, + Origin = Anchor.CentreLeft, Size = new Vector2(80, 50), + BeatmapSet = beatmap.BeatmapSet, + CoverType = BeatmapSetCoverType.List, }; [BackgroundDependencyLoader(true)] diff --git a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs new file mode 100644 index 0000000000..42863754c5 --- /dev/null +++ b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; +using osu.Game.Beatmaps; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Screens.Multi.Components +{ + public class BeatmapTitle : FillFlowContainer + { + private readonly OsuSpriteText beatmapTitle, beatmapDash, beatmapArtist; + + private LocalisationEngine localisation; + + public float TextSize + { + set { beatmapTitle.TextSize = beatmapDash.TextSize = beatmapArtist.TextSize = value; } + } + + private BeatmapInfo beatmap; + + public BeatmapInfo Beatmap + { + set + { + if (value == beatmap) return; + beatmap = value; + + if (IsLoaded) + updateText(); + } + } + + public BeatmapTitle() + { + AutoSizeAxes = Axes.Both; + Direction = FillDirection.Horizontal; + + Children = new[] + { + beatmapTitle = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", }, + beatmapDash = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", }, + beatmapArtist = new OsuSpriteText { Font = @"Exo2.0-RegularItalic", }, + }; + } + + [BackgroundDependencyLoader] + private void load(LocalisationEngine localisation) + { + this.localisation = localisation; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + updateText(); + } + + private void updateText() + { + if (beatmap == null) + { + beatmapTitle.Current = beatmapArtist.Current = null; + beatmapTitle.Text = "Changing map"; + beatmapDash.Text = beatmapArtist.Text = string.Empty; + } + else + { + beatmapTitle.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); + beatmapDash.Text = @" - "; + beatmapArtist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); + } + } + } +} diff --git a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs new file mode 100644 index 0000000000..78ffe01ef0 --- /dev/null +++ b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs @@ -0,0 +1,70 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Multiplayer; +using OpenTK; + +namespace osu.Game.Screens.Multi.Components +{ + public class BeatmapTypeInfo : FillFlowContainer + { + private readonly ModeTypeInfo modeTypeInfo; + private readonly BeatmapTitle beatmapTitle; + private readonly OsuSpriteText beatmapAuthor; + + public BeatmapInfo Beatmap + { + set + { + modeTypeInfo.Beatmap = beatmapTitle.Beatmap = value; + beatmapAuthor.Text = value == null ? string.Empty : $"mapped by {value.Metadata.Author}"; + } + } + + public GameType Type + { + set { modeTypeInfo.Type = value; } + } + + public BeatmapTypeInfo() + { + AutoSizeAxes = Axes.Both; + Direction = FillDirection.Horizontal; + LayoutDuration = 100; + Spacing = new Vector2(5f, 0f); + + Children = new Drawable[] + { + modeTypeInfo = new ModeTypeInfo(), + new Container + { + AutoSizeAxes = Axes.X, + Height = 30, + Margin = new MarginPadding { Left = 5 }, + Children = new Drawable[] + { + beatmapTitle = new BeatmapTitle(), + beatmapAuthor = new OsuSpriteText + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + TextSize = 14, + }, + }, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + beatmapAuthor.Colour = colours.Gray9; + } + } +} diff --git a/osu.Game/Screens/Multi/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Components/DrawableRoom.cs index 1851f4618e..54bd0ae7cc 100644 --- a/osu.Game/Screens/Multi/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Components/DrawableRoom.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input; -using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -42,7 +41,7 @@ namespace osu.Game.Screens.Multi.Components private readonly Bindable statusBind = new Bindable(); private readonly Bindable typeBind = new Bindable(); private readonly Bindable beatmapBind = new Bindable(); - private readonly Bindable participantsBind = new Bindable(); + private readonly Bindable> participantsBind = new Bindable>(); public readonly Room Room; @@ -108,12 +107,13 @@ namespace osu.Game.Screens.Multi.Components } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation) + private void load(OsuColour colours) { Box sideStrip; - Container coverContainer; - OsuSpriteText name, status, beatmapTitle, beatmapDash, beatmapArtist; + UpdateableBeatmapSetCover cover; + OsuSpriteText name, status; ParticipantInfo participantInfo; + BeatmapTitle beatmapTitle; ModeTypeInfo modeTypeInfo; Children = new Drawable[] @@ -146,24 +146,12 @@ namespace osu.Game.Screens.Multi.Components RelativeSizeAxes = Axes.Y, Width = side_strip_width, }, - new Container + cover = new UpdateableBeatmapSetCover { Width = cover_width, RelativeSizeAxes = Axes.Y, Masking = true, Margin = new MarginPadding { Left = side_strip_width }, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }, - coverContainer = new Container - { - RelativeSizeAxes = Axes.Both, - }, - }, }, new Container { @@ -205,30 +193,10 @@ namespace osu.Game.Screens.Multi.Components TextSize = 14, Font = @"Exo2.0-Bold", }, - new FillFlowContainer + beatmapTitle = new BeatmapTitle { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Colour = colours.Gray9, - Direction = FillDirection.Horizontal, - Children = new[] - { - beatmapTitle = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-BoldItalic", - }, - beatmapDash = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-BoldItalic", - }, - beatmapArtist = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-RegularItalic", - }, - }, + TextSize = 14, + Colour = colours.Gray9 }, }, }, @@ -259,34 +227,9 @@ namespace osu.Game.Screens.Multi.Components beatmapBind.ValueChanged += b => { + cover.BeatmapSet = b?.BeatmapSet; + beatmapTitle.Beatmap = b; modeTypeInfo.Beatmap = b; - - if (b != null) - { - coverContainer.FadeIn(transition_duration); - - LoadComponentAsync(new BeatmapSetCover(b.BeatmapSet) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), - }, coverContainer.Add); - - beatmapTitle.Current = localisation.GetUnicodePreference(b.Metadata.TitleUnicode, b.Metadata.Title); - beatmapDash.Text = @" - "; - beatmapArtist.Current = localisation.GetUnicodePreference(b.Metadata.ArtistUnicode, b.Metadata.Artist); - } - else - { - coverContainer.FadeOut(transition_duration); - - beatmapTitle.Current = null; - beatmapArtist.Current = null; - - beatmapTitle.Text = "Changing map"; - beatmapDash.Text = beatmapArtist.Text = string.Empty; - } }; nameBind.BindTo(Room.Name); diff --git a/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs b/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs index e3aba685a7..e2d0268090 100644 --- a/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs +++ b/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs @@ -64,6 +64,7 @@ namespace osu.Game.Screens.Multi.Components AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(5f, 0f), + LayoutDuration = 100, Children = new[] { rulesetContainer = new Container diff --git a/osu.Game/Screens/Multi/Components/ParticipantCount.cs b/osu.Game/Screens/Multi/Components/ParticipantCount.cs new file mode 100644 index 0000000000..e47a529ff8 --- /dev/null +++ b/osu.Game/Screens/Multi/Components/ParticipantCount.cs @@ -0,0 +1,67 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Screens.Multi.Components +{ + public class ParticipantCount : FillFlowContainer + { + private const float text_size = 30; + private const float transition_duration = 100; + + private readonly OsuSpriteText count, slash, max; + + public int Count + { + set => count.Text = value.ToString(); + } + + public int? Max + { + set + { + if (value == null) + { + slash.FadeOut(transition_duration); + max.FadeOut(transition_duration); + } + else + { + slash.FadeIn(transition_duration); + max.Text = value.ToString(); + max.FadeIn(transition_duration); + } + } + } + + public ParticipantCount() + { + AutoSizeAxes = Axes.Both; + Direction = FillDirection.Horizontal; + LayoutDuration = transition_duration; + + Children = new[] + { + count = new OsuSpriteText + { + TextSize = text_size, + Font = @"Exo2.0-Bold" + }, + slash = new OsuSpriteText + { + Text = @"/", + TextSize = text_size, + Font = @"Exo2.0-Light" + }, + max = new OsuSpriteText + { + TextSize = text_size, + Font = @"Exo2.0-Light" + }, + }; + } + } +} diff --git a/osu.Game/Screens/Multi/Components/RoomInspector.cs b/osu.Game/Screens/Multi/Components/RoomInspector.cs index 3bd054b042..22bca1efc7 100644 --- a/osu.Game/Screens/Multi/Components/RoomInspector.cs +++ b/osu.Game/Screens/Multi/Components/RoomInspector.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; @@ -10,7 +11,6 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -34,13 +34,15 @@ namespace osu.Game.Screens.Multi.Components private readonly Bindable typeBind = new Bindable(); private readonly Bindable beatmapBind = new Bindable(); private readonly Bindable maxParticipantsBind = new Bindable(); - private readonly Bindable participantsBind = new Bindable(); + private readonly Bindable> participantsBind = new Bindable>(); private OsuColour colours; private Box statusStrip; - private Container coverContainer; - private FillFlowContainer topFlow, participantsFlow, participantNumbersFlow, infoPanelFlow; + private UpdateableBeatmapSetCover cover; + private ParticipantCount participantCount; + private FillFlowContainer topFlow, participantsFlow; private OsuSpriteText name, status; + private BeatmapTypeInfo beatmapTypeInfo; private ScrollContainer participantsScroll; private ParticipantInfo participantInfo; @@ -77,13 +79,10 @@ namespace osu.Game.Screens.Multi.Components } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation) + private void load(OsuColour colours) { this.colours = colours; - ModeTypeInfo modeTypeInfo; - OsuSpriteText participants, participantsSlash, maxParticipants, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor; - Children = new Drawable[] { new Box @@ -105,21 +104,9 @@ namespace osu.Game.Screens.Multi.Components Masking = true, Children = new Drawable[] { - new Container + cover = new UpdateableBeatmapSetCover { RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }, - coverContainer = new Container - { - RelativeSizeAxes = Axes.Both, - }, - }, }, new Box { @@ -132,32 +119,10 @@ namespace osu.Game.Screens.Multi.Components Padding = new MarginPadding(20), Children = new Drawable[] { - participantNumbersFlow = new FillFlowContainer + participantCount = new ParticipantCount { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - LayoutDuration = transition_duration, - Children = new[] - { - participants = new OsuSpriteText - { - TextSize = 30, - Font = @"Exo2.0-Bold" - }, - participantsSlash = new OsuSpriteText - { - Text = @"/", - TextSize = 30, - Font = @"Exo2.0-Light" - }, - maxParticipants = new OsuSpriteText - { - TextSize = 30, - Font = @"Exo2.0-Light" - }, - }, }, name = new OsuSpriteText { @@ -200,54 +165,7 @@ namespace osu.Game.Screens.Multi.Components TextSize = 14, Font = @"Exo2.0-Bold", }, - infoPanelFlow = new FillFlowContainer - { - AutoSizeAxes = Axes.X, - Height = 30, - Direction = FillDirection.Horizontal, - LayoutDuration = transition_duration, - Spacing = new Vector2(5f, 0f), - Children = new Drawable[] - { - modeTypeInfo = new ModeTypeInfo(), - new Container - { - AutoSizeAxes = Axes.X, - RelativeSizeAxes = Axes.Y, - Margin = new MarginPadding { Left = 5 }, - Children = new[] - { - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new[] - { - beatmapTitle = new OsuSpriteText - { - Font = @"Exo2.0-BoldItalic", - }, - beatmapDash = new OsuSpriteText - { - Font = @"Exo2.0-BoldItalic", - }, - beatmapArtist = new OsuSpriteText - { - Font = @"Exo2.0-RegularItalic", - }, - }, - }, - beatmapAuthor = new OsuSpriteText - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - TextSize = 14, - Colour = colours.Gray9, - }, - }, - }, - }, - }, + beatmapTypeInfo = new BeatmapTypeInfo(), }, }, }, @@ -285,61 +203,19 @@ namespace osu.Game.Screens.Multi.Components nameBind.ValueChanged += n => name.Text = n; hostBind.ValueChanged += h => participantInfo.Host = h; - typeBind.ValueChanged += t => modeTypeInfo.Type = t; + typeBind.ValueChanged += t => beatmapTypeInfo.Type = t; + maxParticipantsBind.ValueChanged += m => participantCount.Max = m; statusBind.ValueChanged += displayStatus; beatmapBind.ValueChanged += b => { - modeTypeInfo.Beatmap = b; - - if (b != null) - { - coverContainer.FadeIn(transition_duration); - - LoadComponentAsync(new BeatmapSetCover(b.BeatmapSet) - { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), - }, coverContainer.Add); - - beatmapTitle.Current = localisation.GetUnicodePreference(b.Metadata.TitleUnicode, b.Metadata.Title); - beatmapDash.Text = @" - "; - beatmapArtist.Current = localisation.GetUnicodePreference(b.Metadata.ArtistUnicode, b.Metadata.Artist); - beatmapAuthor.Text = $"mapped by {b.Metadata.Author}"; - } - else - { - coverContainer.FadeOut(transition_duration); - - beatmapTitle.Current = null; - beatmapArtist.Current = null; - - beatmapTitle.Text = "Changing map"; - beatmapDash.Text = beatmapArtist.Text = beatmapAuthor.Text = string.Empty; - } - }; - - maxParticipantsBind.ValueChanged += m => - { - if (m == null) - { - participantsSlash.FadeOut(transition_duration); - maxParticipants.FadeOut(transition_duration); - } - else - { - participantsSlash.FadeIn(transition_duration); - maxParticipants.FadeIn(transition_duration); - maxParticipants.Text = m.ToString(); - } + cover.BeatmapSet = b?.BeatmapSet; + beatmapTypeInfo.Beatmap = b; }; participantsBind.ValueChanged += p => { - participants.Text = p.Length.ToString(); + participantCount.Count = p.Count(); participantInfo.Participants = p; participantsFlow.ChildrenEnumerable = p.Select(u => new UserTile(u)); }; @@ -367,10 +243,10 @@ namespace osu.Game.Screens.Multi.Components { if (Room == null) { - coverContainer.FadeOut(transition_duration); + cover.BeatmapSet = null; participantsFlow.FadeOut(transition_duration); - participantNumbersFlow.FadeOut(transition_duration); - infoPanelFlow.FadeOut(transition_duration); + participantCount.FadeOut(transition_duration); + beatmapTypeInfo.FadeOut(transition_duration); name.FadeOut(transition_duration); participantInfo.FadeOut(transition_duration); @@ -379,8 +255,8 @@ namespace osu.Game.Screens.Multi.Components else { participantsFlow.FadeIn(transition_duration); - participantNumbersFlow.FadeIn(transition_duration); - infoPanelFlow.FadeIn(transition_duration); + participantCount.FadeIn(transition_duration); + beatmapTypeInfo.FadeIn(transition_duration); name.FadeIn(transition_duration); participantInfo.FadeIn(transition_duration);