Skip to content

Instantly share code, notes, and snippets.

@smoogipoo
Created April 20, 2024 17:36
Show Gist options
  • Save smoogipoo/7decf39d51bf897a23d4dce913a18730 to your computer and use it in GitHub Desktop.
Save smoogipoo/7decf39d51bf897a23d4dce913a18730 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..bfe9c3c5e4 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(SkinnableDrawable leaderboard)
{
- Debug.Assert(leaderboard == multiplayerLeaderboard);
+ Debug.Assert(leaderboard.Drawable == multiplayerLeaderboard);
HUDOverlay.LeaderboardFlow.Insert(0, leaderboard);
diff --git a/osu.Game/Screens/Play/HUD/SoloGameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/SoloGameplayLeaderboard.cs
index e9bb1d2101..28efbbacf7 100644
--- a/osu.Game/Screens/Play/HUD/SoloGameplayLeaderboard.cs
+++ b/osu.Game/Screens/Play/HUD/SoloGameplayLeaderboard.cs
@@ -11,11 +11,12 @@
using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
using osu.Game.Screens.Select;
+using osu.Game.Skinning;
using osu.Game.Users;
namespace osu.Game.Screens.Play.HUD
{
- public partial class SoloGameplayLeaderboard : GameplayLeaderboard
+ public partial class SoloGameplayLeaderboard : GameplayLeaderboard, ISerialisableDrawable
{
private const int duration = 100;
@@ -104,5 +105,9 @@ protected override bool CheckValidScorePosition(GameplayLeaderboardScore score,
private void updateVisibility() =>
this.FadeTo(AlwaysVisible.Value || configVisibility.Value ? 1 : 0, duration);
+
+ public bool IsPlaceable => false;
+
+ public bool UsesFixedAnchor { get; set; }
}
}
diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs
index 4fcc52bc5d..7d177fa1dc 100644
--- a/osu.Game/Screens/Play/Player.cs
+++ b/osu.Game/Screens/Play/Player.cs
@@ -876,22 +876,28 @@ private void loadLeaderboard()
if (gameplayLeaderboard != null)
{
- LoadComponentAsync(gameplayLeaderboard, leaderboard =>
- {
- if (!LoadedBeatmapSuccessfully)
- return;
+ LoadComponentAsync(
+ new SkinnableDrawable(new SkinnableContainerLookup(SkinnableContainerLookup.TargetArea.Leaderboard, Ruleset.Value), gameplayLeaderboard)
+ {
+ RelativeSizeAxes = Axes.None,
+ AutoSizeAxes = Axes.Both
+ },
+ skinnable =>
+ {
+ if (!LoadedBeatmapSuccessfully)
+ return;
- leaderboard.Expanded.BindTo(LeaderboardExpandedState);
+ ((GameplayLeaderboard)skinnable.Drawable).Expanded.BindTo(LeaderboardExpandedState);
- AddLeaderboardToHUD(leaderboard);
- });
+ AddLeaderboardToHUD(skinnable);
+ });
}
}
[CanBeNull]
protected virtual GameplayLeaderboard CreateGameplayLeaderboard() => null;
- protected virtual void AddLeaderboardToHUD(GameplayLeaderboard leaderboard) => HUDOverlay.LeaderboardFlow.Add(leaderboard);
+ protected virtual void AddLeaderboardToHUD(SkinnableDrawable leaderboard) => HUDOverlay.LeaderboardFlow.Add(leaderboard);
private void updateLeaderboardExpandedState() =>
LeaderboardExpandedState.Value = !LocalUserPlaying.Value || HUDOverlay.HoldingForHUD.Value;
diff --git a/osu.Game/Skinning/SkinnableContainerLookup.cs b/osu.Game/Skinning/SkinnableContainerLookup.cs
index 58cda3ab06..6fdaadf31b 100644
--- a/osu.Game/Skinning/SkinnableContainerLookup.cs
+++ b/osu.Game/Skinning/SkinnableContainerLookup.cs
@@ -63,7 +63,9 @@ public enum TargetArea
SongSelect,
[Description("Playfield")]
- Playfield
+ Playfield,
+
+ Leaderboard
}
bool IEquatable<ISkinComponentLookup>.Equals(ISkinComponentLookup? other)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment