mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Ensure gameplay leaderboard hides with rest of HUD when it should
This commit is contained in:
@ -60,7 +60,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
AllowPause = false,
|
AllowPause = false,
|
||||||
AllowRestart = false,
|
AllowRestart = false,
|
||||||
AllowSkipping = room.AutoSkip.Value,
|
AllowSkipping = room.AutoSkip.Value,
|
||||||
AutomaticallySkipIntro = room.AutoSkip.Value
|
AutomaticallySkipIntro = room.AutoSkip.Value,
|
||||||
|
AlwaysShowLeaderboard = true,
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
this.users = users;
|
this.users = users;
|
||||||
|
@ -9,7 +9,6 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.EnumExtensions;
|
using osu.Framework.Extensions.EnumExtensions;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
@ -80,7 +79,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private readonly SkinnableTargetContainer mainComponents;
|
private readonly SkinnableTargetContainer mainComponents;
|
||||||
|
|
||||||
private IEnumerable<Drawable> hideTargets => new Drawable[] { mainComponents, KeyCounter, topRightElements };
|
private readonly List<Drawable> hideTargets;
|
||||||
|
|
||||||
public HUDOverlay(DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
public HUDOverlay(DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
@ -129,6 +128,8 @@ namespace osu.Game.Screens.Play
|
|||||||
},
|
},
|
||||||
clicksPerSecondCalculator = new ClicksPerSecondCalculator()
|
clicksPerSecondCalculator = new ClicksPerSecondCalculator()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hideTargets = new List<Drawable> { mainComponents, KeyCounter, topRightElements };
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
@ -173,6 +174,13 @@ namespace osu.Game.Screens.Play
|
|||||||
replayLoaded.BindValueChanged(replayLoadedValueChanged, true);
|
replayLoaded.BindValueChanged(replayLoadedValueChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Add(Drawable drawable, bool hideWithHUD)
|
||||||
|
{
|
||||||
|
base.Add(drawable);
|
||||||
|
if (hideWithHUD)
|
||||||
|
hideTargets.Add(drawable);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
@ -838,6 +838,7 @@ namespace osu.Game.Screens.Play
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
leaderboard.Expanded.BindTo(LeaderboardExpandedState);
|
leaderboard.Expanded.BindTo(LeaderboardExpandedState);
|
||||||
|
|
||||||
AddLeaderboardToHUD(leaderboard);
|
AddLeaderboardToHUD(leaderboard);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -849,7 +850,7 @@ namespace osu.Game.Screens.Play
|
|||||||
Margin = new MarginPadding { Bottom = 75, Left = 20 },
|
Margin = new MarginPadding { Bottom = 75, Left = 20 },
|
||||||
};
|
};
|
||||||
|
|
||||||
protected virtual void AddLeaderboardToHUD(GameplayLeaderboard leaderboard) => HUDOverlay.Add(leaderboard);
|
protected virtual void AddLeaderboardToHUD(GameplayLeaderboard leaderboard) => HUDOverlay.Add(leaderboard, !Configuration.AlwaysShowLeaderboard);
|
||||||
|
|
||||||
private void updateLeaderboardExpandedState() =>
|
private void updateLeaderboardExpandedState() =>
|
||||||
LeaderboardExpandedState.Value = !LocalUserPlaying.Value || HUDOverlay.HoldingForHUD.Value;
|
LeaderboardExpandedState.Value = !LocalUserPlaying.Value || HUDOverlay.HoldingForHUD.Value;
|
||||||
|
@ -36,5 +36,10 @@ namespace osu.Game.Screens.Play
|
|||||||
/// Whether the intro should be skipped by default.
|
/// Whether the intro should be skipped by default.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutomaticallySkipIntro { get; set; }
|
public bool AutomaticallySkipIntro { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the gameplay leaderboard should always be shown (usually in a contracted state).
|
||||||
|
/// </summary>
|
||||||
|
public bool AlwaysShowLeaderboard { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user