1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +08:00
This commit is contained in:
nanashi-1 2022-09-26 21:11:14 +08:00
parent 5c132aadeb
commit 4295d9c169
2 changed files with 0 additions and 44 deletions

View File

@ -5,14 +5,12 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.PolygonExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Configuration;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Screens.Play.HUD;
using osuTK;
@ -26,8 +24,6 @@ namespace osu.Game.Tests.Visual.Gameplay
private readonly BindableDouble playerScore = new BindableDouble();
private Bindable<bool> configVisibility = new Bindable<bool>();
public TestSceneGameplayLeaderboard()
{
AddStep("toggle expanded", () =>
@ -39,12 +35,6 @@ namespace osu.Game.Tests.Visual.Gameplay
AddSliderStep("set player score", 50, 5000000, 1222333, v => playerScore.Value = v);
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
config.BindWith(OsuSetting.GameplayLeaderboard, configVisibility);
}
[Test]
public void TestLayoutWithManyScores()
{
@ -139,21 +129,6 @@ namespace osu.Game.Tests.Visual.Gameplay
=> AddAssert($"leaderboard height is {panelCount} panels high", () => leaderboard.DrawHeight == (GameplayLeaderboardScore.PANEL_HEIGHT + leaderboard.Spacing) * panelCount);
}
[Test]
public void TestVisibility()
{
createLeaderboard();
addLocalPlayer();
AddStep("set visible true", () => configVisibility.Value = true);
AddWaitStep("wait", 1);
AddAssert("is leaderboard fully visible", () => leaderboard.FlowAlpha == 1);
AddStep("set visible false", () => configVisibility.Value = false);
AddWaitStep("wait", 1);
AddAssert("is leaderboard fully invisible", () => leaderboard.FlowAlpha == 0);
}
private void addLocalPlayer()
{
AddStep("add local player", () =>
@ -188,8 +163,6 @@ namespace osu.Game.Tests.Visual.Gameplay
{
public float Spacing => Flow.Spacing.Y;
public float FlowAlpha => Flow.Alpha;
public bool CheckPositionByUsername(string username, int? expectedPosition)
{
var scoreItem = Flow.FirstOrDefault(i => i.User?.Username == username);

View File

@ -3,14 +3,12 @@
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Caching;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osu.Game.Users;
using osuTK;
@ -20,10 +18,6 @@ namespace osu.Game.Screens.Play.HUD
{
public abstract class GameplayLeaderboard : CompositeDrawable
{
private const int duration = 100;
private readonly Bindable<bool> configVisibility = new Bindable<bool>();
private readonly Cached sorting = new Cached();
public Bindable<bool> Expanded = new Bindable<bool>();
@ -63,19 +57,11 @@ namespace osu.Game.Screens.Play.HUD
};
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
config.BindWith(OsuSetting.GameplayLeaderboard, configVisibility);
}
protected override void LoadComplete()
{
base.LoadComplete();
Scheduler.AddDelayed(sort, 1000, true);
configVisibility.BindValueChanged(_ => updateVisibility(), true);
}
/// <summary>
@ -207,8 +193,5 @@ namespace osu.Game.Screens.Play.HUD
public override bool HandlePositionalInput => false;
public override bool HandleNonPositionalInput => false;
}
private void updateVisibility() =>
Flow.FadeTo(configVisibility.Value ? 1 : 0, duration);
}
}