diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index cff86cf0a11b..c475d606a915 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -251,7 +251,7 @@ private void refreshContent() } } }, - new TournamentBeatmapPanel(beatmap) + new SongBarBeatmapPanel(beatmap) { RelativeSizeAxes = Axes.X, Width = 0.5f, diff --git a/osu.Game.Tournament/Components/SongBarBeatmapPanel.cs b/osu.Game.Tournament/Components/SongBarBeatmapPanel.cs new file mode 100644 index 000000000000..1e5c4906fbe4 --- /dev/null +++ b/osu.Game.Tournament/Components/SongBarBeatmapPanel.cs @@ -0,0 +1,37 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Game.Beatmaps; + +namespace osu.Game.Tournament.Components +{ + public partial class SongBarBeatmapPanel : TournamentBeatmapPanel + { + protected override bool TranslucentProtectedAfterPick => false; + + public SongBarBeatmapPanel(IBeatmapInfo? beatmap) + : base(beatmap) + { + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + ModIconContainer.With(d => + { + d.Anchor = Anchor.CentreRight; + d.Origin = Anchor.CentreRight; + d.Margin = new MarginPadding { Right = 20 }; + }); + + PadLockContainer.With(d => + { + d.Anchor = Anchor.CentreRight; + d.Origin = Anchor.CentreRight; + d.Margin = new MarginPadding { Right = 100 }; + }); + } + } +} diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 628f1006059c..e06a5b027f3d 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -25,21 +25,27 @@ public partial class TournamentBeatmapPanel : CompositeDrawable { public readonly IBeatmapInfo? Beatmap; - private readonly string? mod; + private string? mod; public const float HEIGHT = 50; private readonly Bindable currentMatch = new Bindable(); private Box flash = null!; + + protected Container PadLockContainer = null!; private PadLock padLock = null!; - private readonly bool isMappool; - public TournamentBeatmapPanel(IBeatmapInfo? beatmap, string mod = "", bool isMappool = false) + protected Container ModIconContainer = null!; + + [Resolved] + private LadderInfo ladderInfo { get; set; } = null!; + + protected virtual bool TranslucentProtectedAfterPick => true; + + public TournamentBeatmapPanel(IBeatmapInfo? beatmap) { Beatmap = beatmap; - this.mod = mod; - this.isMappool = isMappool; Width = 400; Height = HEIGHT; @@ -53,6 +59,8 @@ private void load(LadderInfo ladder) Masking = true; + mod = ladderInfo.CurrentMatch.Value?.Round.Value?.Beatmaps.FirstOrDefault(b => b.Beatmap?.OnlineID == Beatmap?.OnlineID)?.Mods; + AddRangeInternal(new Drawable[] { new Box @@ -113,11 +121,25 @@ private void load(LadderInfo ladder) } }, }, - padLock = new PadLock + PadLockContainer = new Container { Origin = Anchor.Centre, Anchor = Anchor.Centre, - Alpha = 0f, + AutoSizeAxes = Axes.Both, + Child = padLock = new PadLock + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Alpha = 0f, + }, + }, + ModIconContainer = new Container + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Margin = new MarginPadding(10), + Width = 60, + RelativeSizeAxes = Axes.Y, }, flash = new Box { @@ -130,13 +152,9 @@ private void load(LadderInfo ladder) if (!string.IsNullOrEmpty(mod)) { - AddInternal(new TournamentModIcon(mod) + ModIconContainer.Add(new TournamentModIcon(mod) { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Margin = new MarginPadding(10), - Width = 60, - RelativeSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.Both, }); } } @@ -164,17 +182,17 @@ private void updateState() } var found = currentMatch.Value.PicksBans.Where(p => p.BeatmapID == Beatmap?.OnlineID).ToList(); - var foundProtected = isMappool ? found.FirstOrDefault(s => s.Type == ChoiceType.Protected) : null; + var foundProtected = found.FirstOrDefault(s => s.Type == ChoiceType.Protected); var lastFound = found.LastOrDefault(); bool shouldFlash = lastFound != choice; - if (foundProtected != null && isMappool) + if (foundProtected != null) { padLock.Team = foundProtected.Team; padLock.Show(); - if (currentMatch.Value.PicksBans.Any(p => p.Type == ChoiceType.Pick)) + if (currentMatch.Value.PicksBans.Any(p => p.Type == ChoiceType.Pick) && TranslucentProtectedAfterPick) { padLock.FadeTo(0.5f); } diff --git a/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs index 253cca8c981d..f46aefe7fef8 100644 --- a/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs @@ -273,7 +273,7 @@ private void updatePanel() => Schedule(() => if (Model.Beatmap != null) { - drawableContainer.Child = new TournamentBeatmapPanel(Model.Beatmap, Model.Mods) + drawableContainer.Child = new TournamentBeatmapPanel(Model.Beatmap) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs index 9927dd56a05f..20ff91ae482a 100644 --- a/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs @@ -262,7 +262,7 @@ private void updatePanel() if (Model.Beatmap != null) { - drawableContainer.Child = new TournamentBeatmapPanel(Model.Beatmap, result.Mod.Value) + drawableContainer.Child = new TournamentBeatmapPanel(Model.Beatmap) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 31ca289fdaff..86d3eb6f2ba6 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -328,7 +328,7 @@ private void updateDisplay() flowCount = 1; } - currentFlow.Add(new TournamentBeatmapPanel(b.Beatmap, b.Mods, true) + currentFlow.Add(new TournamentBeatmapPanel(b.Beatmap) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre,