mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 16:12:54 +08:00
Merge pull request #12284 from bdach/fix-scores-initially-showing
Fix scores being initially visible incorrectly in gameplay screen
This commit is contained in:
commit
f95b91e3b6
@ -1,9 +1,13 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osu.Game.Tournament.Screens.Gameplay;
|
||||
using osu.Game.Tournament.Screens.Gameplay.Components;
|
||||
|
||||
namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
@ -18,5 +22,24 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
Add(new GameplayScreen());
|
||||
Add(chat);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestWarmup()
|
||||
{
|
||||
checkScoreVisibility(false);
|
||||
|
||||
toggleWarmup();
|
||||
checkScoreVisibility(true);
|
||||
|
||||
toggleWarmup();
|
||||
checkScoreVisibility(false);
|
||||
}
|
||||
|
||||
private void checkScoreVisibility(bool visible)
|
||||
=> AddUntilStep($"scores {(visible ? "shown" : "hidden")}",
|
||||
() => this.ChildrenOfType<TeamScore>().All(score => score.Alpha == (visible ? 1 : 0)));
|
||||
|
||||
private void toggleWarmup()
|
||||
=> AddStep("toggle warmup", () => this.ChildrenOfType<TourneyButton>().First().Click());
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,11 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
Origin = Anchor.TopRight,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
|
@ -14,9 +14,21 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
{
|
||||
private readonly TeamScore score;
|
||||
|
||||
private bool showScore;
|
||||
|
||||
public bool ShowScore
|
||||
{
|
||||
set => score.FadeTo(value ? 1 : 0, 200);
|
||||
get => showScore;
|
||||
set
|
||||
{
|
||||
if (showScore == value)
|
||||
return;
|
||||
|
||||
showScore = value;
|
||||
|
||||
if (IsLoaded)
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
public TeamDisplay(TournamentTeam team, TeamColour colour, Bindable<int?> currentTeamScore, int pointsToWin)
|
||||
@ -92,5 +104,18 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
updateDisplay();
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
score.FadeTo(ShowScore ? 1 : 0, 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user