Skip to content

Instantly share code, notes, and snippets.

@smoogipoo
Created April 20, 2024 18:17
Show Gist options
  • Save smoogipoo/b37be2b0c403e78095e1c6175066aeb4 to your computer and use it in GitHub Desktop.
Save smoogipoo/b37be2b0c403e78095e1c6175066aeb4 to your computer and use it in GitHub Desktop.
diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs
index e560c5ca5d..6cea898d30 100644
--- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs
+++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs
@@ -18,6 +18,7 @@
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Ranking;
+using osu.Game.Skinning;
using osu.Game.Users;
namespace osu.Game.Screens.OnlinePlay.Multiplayer
@@ -79,9 +80,9 @@ private void load()
protected override GameplayLeaderboard CreateGameplayLeaderboard() => multiplayerLeaderboard = new MultiplayerGameplayLeaderboard(users);
- protected override void AddLeaderboardToHUD(GameplayLeaderboard leaderboard)
+ protected override void AddLeaderboardToHUD(SkinComponentsContainer leaderboard)
{
- Debug.Assert(leaderboard == multiplayerLeaderboard);
+ Debug.Assert(leaderboard.Components.Single() == multiplayerLeaderboard);
HUDOverlay.LeaderboardFlow.Insert(0, leaderboard);
diff --git a/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs
index d2b6b834f8..1d57a03fea 100644
--- a/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs
+++ b/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs
@@ -10,13 +10,14 @@
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Containers;
+using osu.Game.Skinning;
using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Play.HUD
{
- public abstract partial class GameplayLeaderboard : CompositeDrawable
+ public abstract partial class GameplayLeaderboard : CompositeDrawable, ISerialisableDrawable
{
private readonly Cached sorting = new Cached();
@@ -189,5 +190,7 @@ public InputDisabledScrollContainer()
public override bool HandlePositionalInput => false;
public override bool HandleNonPositionalInput => false;
}
+
+ public bool UsesFixedAnchor { get; set; }
}
}
diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs
index 4fcc52bc5d..05f42c94d6 100644
--- a/osu.Game/Screens/Play/Player.cs
+++ b/osu.Game/Screens/Play/Player.cs
@@ -876,14 +876,17 @@ private void loadLeaderboard()
if (gameplayLeaderboard != null)
{
- LoadComponentAsync(gameplayLeaderboard, leaderboard =>
+ SkinComponentsContainer container;
+
+ LoadComponentAsync(container = new SkinComponentsContainer(new SkinComponentsContainerLookup(SkinComponentsContainerLookup.TargetArea.Leaderboard, Ruleset.Value)), _ =>
{
if (!LoadedBeatmapSuccessfully)
return;
- leaderboard.Expanded.BindTo(LeaderboardExpandedState);
+ container.Add(gameplayLeaderboard);
+ ((GameplayLeaderboard)container.Components.Single()).Expanded.BindTo(LeaderboardExpandedState);
- AddLeaderboardToHUD(leaderboard);
+ AddLeaderboardToHUD(container);
});
}
}
@@ -891,7 +894,7 @@ private void loadLeaderboard()
[CanBeNull]
protected virtual GameplayLeaderboard CreateGameplayLeaderboard() => null;
- protected virtual void AddLeaderboardToHUD(GameplayLeaderboard leaderboard) => HUDOverlay.LeaderboardFlow.Add(leaderboard);
+ protected virtual void AddLeaderboardToHUD(SkinComponentsContainer leaderboard) => HUDOverlay.LeaderboardFlow.Add(leaderboard);
private void updateLeaderboardExpandedState() =>
LeaderboardExpandedState.Value = !LocalUserPlaying.Value || HUDOverlay.HoldingForHUD.Value;
diff --git a/osu.Game/Skinning/SkinComponentsContainerLookup.cs b/osu.Game/Skinning/SkinComponentsContainerLookup.cs
index 34358c3f06..37f7471d2a 100644
--- a/osu.Game/Skinning/SkinComponentsContainerLookup.cs
+++ b/osu.Game/Skinning/SkinComponentsContainerLookup.cs
@@ -71,7 +71,9 @@ public enum TargetArea
SongSelect,
[Description("Playfield")]
- Playfield
+ Playfield,
+
+ Leaderboard
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment