1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 13:42:56 +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.Rulesets;
using osu.Game.Screens.Menu;
using osu.Game.Tournament.Models;
using osuTK;
using osuTK.Graphics;
@ -22,14 +21,14 @@ namespace osu.Game.Tournament.Components
{
public partial class SongBar : CompositeDrawable
{
private TournamentBeatmap? beatmap;
private IBeatmapInfo? beatmap;
public const float HEIGHT = 145 / 2f;
[Resolved]
private IBindable<RulesetInfo> ruleset { get; set; } = null!;
public TournamentBeatmap? Beatmap
public IBeatmapInfo? Beatmap
{
set
{
@ -37,7 +36,7 @@ namespace osu.Game.Tournament.Components
return;
beatmap = value;
update();
refreshContent();
}
}
@ -49,7 +48,7 @@ namespace osu.Game.Tournament.Components
set
{
mods = value;
update();
refreshContent();
}
}
@ -71,19 +70,25 @@ namespace osu.Game.Tournament.Components
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
[BackgroundDependencyLoader]
private void load()
private void load(OsuColour colours)
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Masking = true;
CornerRadius = 5;
InternalChildren = new Drawable[]
{
new Box
{
Colour = colours.Gray3,
RelativeSizeAxes = Axes.Both,
},
flow = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
LayoutDuration = 500,
LayoutEasing = Easing.OutQuint,
Direction = FillDirection.Full,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
@ -93,7 +98,7 @@ namespace osu.Game.Tournament.Components
Expanded = true;
}
private void update()
private void refreshContent()
{
if (beatmap == null)
{
@ -229,7 +234,7 @@ namespace osu.Game.Tournament.Components
}
}
},
new TournamentBeatmapPanel(beatmap)
new UnmaskedTournamentBeatmapPanel(beatmap)
{
RelativeSizeAxes = Axes.X,
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 readonly TournamentBeatmap? Beatmap;
public readonly IBeatmapInfo? Beatmap;
private readonly string mod;
@ -30,7 +30,7 @@ namespace osu.Game.Tournament.Components
private Box flash = null!;
public TournamentBeatmapPanel(TournamentBeatmap? beatmap, string mod = "")
public TournamentBeatmapPanel(IBeatmapInfo? beatmap, string mod = "")
{
Beatmap = beatmap;
this.mod = mod;
@ -58,7 +58,7 @@ namespace osu.Game.Tournament.Components
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.5f),
OnlineInfo = Beatmap,
OnlineInfo = (Beatmap as IBeatmapSetOnlineInfo),
},
new FillFlowContainer
{