mirror of
https://github.com/ppy/osu.git
synced 2026-06-04 03:33:40 +08:00
59b826c321
This PR converts the leaderboard into a full-fledged skinnable component that can be manipulated by users at will. Notably, this finally allows https://github.com/ppy/osu/issues/20422 to be fixed - although it's a very mixed bag, for several reasons: - Because of taiko players' refusal to see reason^W^W^W^Winsistence on keeping stable behaviours related to aspect ratio treatment, I have to assume the worst case scenario, which means than on typical resolutions like 16:9 (or even worse, 4:3), the leaderboard will likely not occupy as much vertical space as it probably could. - Additionally, there's the problem of where to put the spectator list. I settled on putting it to the right of the leaderboard, but that's kind of janky, because the leaderboard sometimes collapses and sometimes fully hides, leading to a very awkward space left behind. If we had the capability to anchor elements to other elements, maybe this could be resolved, but for now, I'm not sure what to do. I think if some users are bothered by it they can move it where they want it. Or delete it.
77 lines
3.1 KiB
C#
77 lines
3.1 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using System.Linq;
|
|
using osu.Framework.Graphics;
|
|
using osu.Game.Graphics;
|
|
using osu.Game.Screens.Play.HUD;
|
|
using osu.Game.Skinning;
|
|
using osuTK;
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
|
{
|
|
public class TaikoTrianglesSkinTransformer : SkinTransformer
|
|
{
|
|
public TaikoTrianglesSkinTransformer(ISkin skin)
|
|
: base(skin)
|
|
{
|
|
}
|
|
|
|
public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
|
|
{
|
|
switch (lookup)
|
|
{
|
|
case GlobalSkinnableContainerLookup containerLookup:
|
|
{
|
|
// Only handle per ruleset defaults here.
|
|
if (containerLookup.Ruleset == null)
|
|
return base.GetDrawableComponent(lookup);
|
|
|
|
switch (containerLookup.Lookup)
|
|
{
|
|
case GlobalSkinnableContainers.MainHUDComponents:
|
|
return new DefaultSkinComponentsContainer(container =>
|
|
{
|
|
var leaderboard = container.OfType<DrawableGameplayLeaderboard>().FirstOrDefault();
|
|
var spectatorList = container.OfType<SpectatorList>().FirstOrDefault();
|
|
|
|
if (leaderboard != null)
|
|
{
|
|
leaderboard.Position = new Vector2(40, -100);
|
|
leaderboard.Height = 180;
|
|
leaderboard.Anchor = Anchor.BottomLeft;
|
|
leaderboard.Origin = Anchor.BottomLeft;
|
|
}
|
|
|
|
if (spectatorList != null)
|
|
{
|
|
spectatorList.HeaderFont.Value = Typeface.Venera;
|
|
spectatorList.HeaderColour.Value = new OsuColour().BlueLighter;
|
|
spectatorList.Anchor = Anchor.BottomLeft;
|
|
spectatorList.Origin = Anchor.TopLeft;
|
|
spectatorList.Position = new Vector2(320, -280);
|
|
}
|
|
})
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
Children = new Drawable[]
|
|
{
|
|
new DrawableGameplayLeaderboard(),
|
|
new SpectatorList
|
|
{
|
|
Anchor = Anchor.BottomLeft,
|
|
Origin = Anchor.BottomLeft,
|
|
}
|
|
},
|
|
};
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
|
|
return base.GetDrawableComponent(lookup);
|
|
}
|
|
}
|
|
}
|