1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:23:22 +08:00

Improve visuals of tournament song bar

This is a stop-gap until we add new versions (and share between game and tournament client).
This commit is contained in:
Dean Herbert 2023-08-01 14:56:48 +09:00
parent 7f8455eb06
commit f02416f877
2 changed files with 32 additions and 13 deletions

View File

@ -14,7 +14,6 @@ using osu.Game.Extensions;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using osu.Game.Tournament.Models;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -22,14 +21,14 @@ namespace osu.Game.Tournament.Components
{ {
public partial class SongBar : CompositeDrawable public partial class SongBar : CompositeDrawable
{ {
private TournamentBeatmap? beatmap; private IBeatmapInfo? beatmap;
public const float HEIGHT = 145 / 2f; public const float HEIGHT = 145 / 2f;
[Resolved] [Resolved]
private IBindable<RulesetInfo> ruleset { get; set; } = null!; private IBindable<RulesetInfo> ruleset { get; set; } = null!;
public TournamentBeatmap? Beatmap public IBeatmapInfo? Beatmap
{ {
set set
{ {
@ -37,7 +36,7 @@ namespace osu.Game.Tournament.Components
return; return;
beatmap = value; beatmap = value;
update(); refreshContent();
} }
} }
@ -49,7 +48,7 @@ namespace osu.Game.Tournament.Components
set set
{ {
mods = value; mods = value;
update(); refreshContent();
} }
} }
@ -71,19 +70,25 @@ namespace osu.Game.Tournament.Components
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false; protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(OsuColour colours)
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Masking = true;
CornerRadius = 5;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Box
{
Colour = colours.Gray3,
RelativeSizeAxes = Axes.Both,
},
flow = new FillFlowContainer flow = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
LayoutDuration = 500,
LayoutEasing = Easing.OutQuint,
Direction = FillDirection.Full, Direction = FillDirection.Full,
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,
@ -93,7 +98,7 @@ namespace osu.Game.Tournament.Components
Expanded = true; Expanded = true;
} }
private void update() private void refreshContent()
{ {
if (beatmap == null) if (beatmap == null)
{ {
@ -229,7 +234,7 @@ namespace osu.Game.Tournament.Components
} }
} }
}, },
new TournamentBeatmapPanel(beatmap) new UnmaskedTournamentBeatmapPanel(beatmap)
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Width = 0.5f, Width = 0.5f,
@ -272,4 +277,18 @@ namespace osu.Game.Tournament.Components
} }
} }
} }
internal partial class UnmaskedTournamentBeatmapPanel : TournamentBeatmapPanel
{
public UnmaskedTournamentBeatmapPanel(IBeatmapInfo? beatmap, string mod = "")
: base(beatmap, mod)
{
}
[BackgroundDependencyLoader]
private void load()
{
Masking = false;
}
}
} }

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Components
{ {
public partial class TournamentBeatmapPanel : CompositeDrawable public partial class TournamentBeatmapPanel : CompositeDrawable
{ {
public readonly TournamentBeatmap? Beatmap; public readonly IBeatmapInfo? Beatmap;
private readonly string mod; private readonly string mod;
@ -30,7 +30,7 @@ namespace osu.Game.Tournament.Components
private Box flash = null!; private Box flash = null!;
public TournamentBeatmapPanel(TournamentBeatmap? beatmap, string mod = "") public TournamentBeatmapPanel(IBeatmapInfo? beatmap, string mod = "")
{ {
Beatmap = beatmap; Beatmap = beatmap;
this.mod = mod; this.mod = mod;
@ -58,7 +58,7 @@ namespace osu.Game.Tournament.Components
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.5f), Colour = OsuColour.Gray(0.5f),
OnlineInfo = Beatmap, OnlineInfo = (Beatmap as IBeatmapSetOnlineInfo),
}, },
new FillFlowContainer new FillFlowContainer
{ {