1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 18:42:56 +08:00

Add bindable flow for expanded leaderboard state

This commit is contained in:
Dean Herbert 2021-02-19 15:09:41 +09:00
parent a6d163619a
commit ee9e6fff40
3 changed files with 7 additions and 0 deletions

View File

@ -85,6 +85,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
public void TestScoreUpdates()
{
AddRepeatStep("update state", () => streamingClient.RandomlyUpdateState(), 100);
AddToggleStep("switch compact mode", expanded => leaderboard.Expanded.Value = expanded);
}
[Test]

View File

@ -4,6 +4,7 @@
using System;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Bindables;
using osu.Framework.Caching;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -16,6 +17,8 @@ namespace osu.Game.Screens.Play.HUD
{
private readonly Cached sorting = new Cached();
public Bindable<bool> Expanded = new Bindable<bool>();
public GameplayLeaderboard()
{
Width = GameplayLeaderboardScore.EXTENDED_WIDTH + GameplayLeaderboardScore.SHEAR_WIDTH;
@ -49,6 +52,7 @@ namespace osu.Game.Screens.Play.HUD
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Expanded = { BindTarget = Expanded },
};
base.Add(drawable);

View File

@ -30,6 +30,8 @@ namespace osu.Game.Screens.Play.HUD
private const float panel_shear = 0.15f;
public Bindable<bool> Expanded = new Bindable<bool>();
private OsuSpriteText positionText, scoreText, accuracyText, comboText, usernameText;
public BindableDouble TotalScore { get; } = new BindableDouble();