From 2658161605763e78f51e5474d3024a6e90092ad2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Jul 2023 18:20:50 +0900 Subject: [PATCH 1/6] Move easily testable test scene to top of `TestSceneGameplayScreen` --- .../Screens/TestSceneGameplayScreen.cs | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs index f127a930a6..36bb401a25 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs @@ -20,6 +20,20 @@ namespace osu.Game.Tournament.Tests.Screens [Cached] private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay { Width = 0.5f }; + [Test] + public void TestWarmup() + { + createScreen(); + + checkScoreVisibility(false); + + toggleWarmup(); + checkScoreVisibility(true); + + toggleWarmup(); + checkScoreVisibility(false); + } + [Test] public void TestStartupState([Values] TourneyState state) { @@ -35,20 +49,6 @@ namespace osu.Game.Tournament.Tests.Screens createScreen(); } - [Test] - public void TestWarmup() - { - createScreen(); - - checkScoreVisibility(false); - - toggleWarmup(); - checkScoreVisibility(true); - - toggleWarmup(); - checkScoreVisibility(false); - } - private void createScreen() { AddStep("setup screen", () => From f837c0a43ce9117870ea5b03a3496dbb80d70854 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Jul 2023 18:22:32 +0900 Subject: [PATCH 2/6] Fix tournament tests not fitting to lower resolutions correctly --- .../Screens/TestSceneDrawingsScreen.cs | 2 +- .../Screens/TestSceneGameplayScreen.cs | 2 +- .../Screens/TestSceneLadderEditorScreen.cs | 2 +- .../Screens/TestSceneLadderScreen.cs | 2 +- .../Screens/TestSceneMapPoolScreen.cs | 2 +- .../Screens/TestSceneRoundEditorScreen.cs | 2 +- .../Screens/TestSceneScheduleScreen.cs | 2 +- .../Screens/TestSceneSeedingEditorScreen.cs | 2 +- .../Screens/TestSceneSeedingScreen.cs | 2 +- .../Screens/TestSceneSetupScreen.cs | 2 +- .../Screens/TestSceneShowcaseScreen.cs | 2 +- .../TestSceneStablePathSelectScreen.cs | 2 +- .../Screens/TestSceneTeamEditorScreen.cs | 2 +- .../Screens/TestSceneTeamIntroScreen.cs | 2 +- .../Screens/TestSceneTeamWinScreen.cs | 2 +- .../TournamentScreenTestScene.cs | 19 +++++++++++++++++++ .../TournamentTestScene.cs | 16 ++++++++-------- 17 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 osu.Game.Tournament.Tests/TournamentScreenTestScene.cs diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs index cd15550931..df11859b71 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs @@ -10,7 +10,7 @@ using osu.Game.Tournament.Screens.Drawings; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneDrawingsScreen : TournamentTestScene + public partial class TestSceneDrawingsScreen : TournamentScreenTestScene { [BackgroundDependencyLoader] private void load(Storage storage) diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs index 36bb401a25..abf0905647 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs @@ -15,7 +15,7 @@ using osu.Game.Tournament.Screens.Gameplay.Components; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneGameplayScreen : TournamentTestScene + public partial class TestSceneGameplayScreen : TournamentScreenTestScene { [Cached] private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay { Width = 0.5f }; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs index 839730f3ca..e1447af9c5 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs @@ -8,7 +8,7 @@ using osu.Game.Tournament.Screens.Editors; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneLadderEditorScreen : TournamentTestScene + public partial class TestSceneLadderEditorScreen : TournamentScreenTestScene { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs index ecc741ddc1..6605e055f8 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs @@ -8,7 +8,7 @@ using osu.Game.Tournament.Screens.Ladder; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneLadderScreen : TournamentTestScene + public partial class TestSceneLadderScreen : TournamentScreenTestScene { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs index 94086f10f2..2c17cd0d52 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs @@ -14,7 +14,7 @@ using osu.Game.Tournament.Screens.MapPool; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneMapPoolScreen : TournamentTestScene + public partial class TestSceneMapPoolScreen : TournamentScreenTestScene { private MapPoolScreen screen; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneRoundEditorScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneRoundEditorScreen.cs index 2e7bf364f7..4faaa3dd75 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneRoundEditorScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneRoundEditorScreen.cs @@ -5,7 +5,7 @@ using osu.Game.Tournament.Screens.Editors; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneRoundEditorScreen : TournamentTestScene + public partial class TestSceneRoundEditorScreen : TournamentScreenTestScene { public TestSceneRoundEditorScreen() { diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs index fd0de3d63a..5071fbbfe3 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs @@ -12,7 +12,7 @@ using osu.Game.Tournament.Screens.Schedule; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneScheduleScreen : TournamentTestScene + public partial class TestSceneScheduleScreen : TournamentScreenTestScene { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneSeedingEditorScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneSeedingEditorScreen.cs index 0d06b0352f..add66ff83e 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneSeedingEditorScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneSeedingEditorScreen.cs @@ -7,7 +7,7 @@ using osu.Game.Tournament.Screens.Editors; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneSeedingEditorScreen : TournamentTestScene + public partial class TestSceneSeedingEditorScreen : TournamentScreenTestScene { [Cached] private readonly LadderInfo ladder = new LadderInfo(); diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneSeedingScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneSeedingScreen.cs index f656934239..a3890bbff0 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneSeedingScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneSeedingScreen.cs @@ -12,7 +12,7 @@ using osu.Game.Tournament.Screens.TeamIntro; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneSeedingScreen : TournamentTestScene + public partial class TestSceneSeedingScreen : TournamentScreenTestScene { [Cached] private readonly LadderInfo ladder = new LadderInfo diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneSetupScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneSetupScreen.cs index 6af2af7732..71ae17d3eb 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneSetupScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneSetupScreen.cs @@ -6,7 +6,7 @@ using osu.Game.Tournament.Screens.Setup; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneSetupScreen : TournamentTestScene + public partial class TestSceneSetupScreen : TournamentScreenTestScene { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs index e50a2a0c07..21e4d0267f 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs @@ -6,7 +6,7 @@ using osu.Game.Tournament.Screens.Showcase; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneShowcaseScreen : TournamentTestScene + public partial class TestSceneShowcaseScreen : TournamentScreenTestScene { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneStablePathSelectScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneStablePathSelectScreen.cs index db49bc960a..3dc595cbb2 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneStablePathSelectScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneStablePathSelectScreen.cs @@ -5,7 +5,7 @@ using osu.Game.Tournament.Screens.Setup; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneStablePathSelectScreen : TournamentTestScene + public partial class TestSceneStablePathSelectScreen : TournamentScreenTestScene { public TestSceneStablePathSelectScreen() { diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneTeamEditorScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneTeamEditorScreen.cs index 7b371ed78b..9e999eaf9d 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneTeamEditorScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneTeamEditorScreen.cs @@ -5,7 +5,7 @@ using osu.Game.Tournament.Screens.Editors; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneTeamEditorScreen : TournamentTestScene + public partial class TestSceneTeamEditorScreen : TournamentScreenTestScene { public TestSceneTeamEditorScreen() { diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs index 02762ab5c7..b76e0d7521 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs @@ -9,7 +9,7 @@ using osu.Game.Tournament.Screens.TeamIntro; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneTeamIntroScreen : TournamentTestScene + public partial class TestSceneTeamIntroScreen : TournamentScreenTestScene { [Cached] private readonly LadderInfo ladder = new LadderInfo(); diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs index 2ed87cdcd5..05c21fa0b1 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs @@ -8,7 +8,7 @@ using osu.Game.Tournament.Screens.TeamWin; namespace osu.Game.Tournament.Tests.Screens { - public partial class TestSceneTeamWinScreen : TournamentTestScene + public partial class TestSceneTeamWinScreen : TournamentScreenTestScene { [Test] public void TestBasic() diff --git a/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs b/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs new file mode 100644 index 0000000000..76cc598af4 --- /dev/null +++ b/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osuTK; + +namespace osu.Game.Tournament.Tests +{ + public abstract partial class TournamentScreenTestScene : TournamentTestScene + { + protected override Container Content { get; } = new DrawSizePreservingFillContainer + { + TargetDrawSize = new Vector2(1920, 1080), + Scale = new Vector2(1920 / (float)(1920 + TournamentSceneManager.CONTROL_AREA_WIDTH)), + RelativeSizeAxes = Axes.Both + }; + } +} diff --git a/osu.Game.Tournament.Tests/TournamentTestScene.cs b/osu.Game.Tournament.Tests/TournamentTestScene.cs index cab78422a2..5b56946ba3 100644 --- a/osu.Game.Tournament.Tests/TournamentTestScene.cs +++ b/osu.Game.Tournament.Tests/TournamentTestScene.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Linq; using System.Threading; using osu.Framework.Allocation; @@ -20,17 +18,17 @@ namespace osu.Game.Tournament.Tests { public abstract partial class TournamentTestScene : OsuTestScene { - private TournamentMatch match; - [Cached] protected LadderInfo Ladder { get; private set; } = new LadderInfo(); - [Resolved] - private RulesetStore rulesetStore { get; set; } - [Cached] protected MatchIPCInfo IPCInfo { get; private set; } = new MatchIPCInfo(); + [Resolved] + private RulesetStore rulesetStore { get; set; } = null!; + + private TournamentMatch match = null!; + [BackgroundDependencyLoader] private void load(TournamentStorage storage) { @@ -45,6 +43,8 @@ namespace osu.Game.Tournament.Tests Ruleset.BindTo(Ladder.Ruleset); Dependencies.CacheAs(new StableInfo(storage)); + + base.Content.Add(Content); } [SetUpSteps] @@ -167,7 +167,7 @@ namespace osu.Game.Tournament.Tests public partial class TournamentTestSceneTestRunner : TournamentGameBase, ITestSceneTestRunner { - private TestSceneTestRunner.TestRunner runner; + private TestSceneTestRunner.TestRunner runner = null!; protected override void LoadAsyncComplete() { From b7f706ad2b0debba553ed3ab072ec90c2c4fa31a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Jul 2023 18:42:16 +0900 Subject: [PATCH 3/6] Set a fixed minimum window size for the tournament client --- osu.Game.Tournament/TournamentGame.cs | 9 +++++++-- osu.Game.Tournament/TournamentSceneManager.cs | 11 +++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index beef1e197d..4d7dd97e96 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -35,14 +35,19 @@ namespace osu.Game.Tournament public static readonly Color4 TEXT_COLOUR = Color4Extensions.FromHex("#fff"); private Drawable heightWarning; - private Bindable windowSize; + private Bindable windowMode; + private readonly BindableSize windowSize = new BindableSize(); + private LoadingSpinner loadingSpinner; [BackgroundDependencyLoader] private void load(FrameworkConfigManager frameworkConfig, GameHost host) { - windowSize = frameworkConfig.GetBindable(FrameworkSetting.WindowedSize); + frameworkConfig.BindWith(FrameworkSetting.WindowedSize, windowSize); + + windowSize.MinValue = new Size(TournamentSceneManager.REQUIRED_WIDTH, TournamentSceneManager.STREAM_AREA_HEIGHT); + windowMode = frameworkConfig.GetBindable(FrameworkSetting.WindowMode); Add(loadingSpinner = new LoadingSpinner(true, true) diff --git a/osu.Game.Tournament/TournamentSceneManager.cs b/osu.Game.Tournament/TournamentSceneManager.cs index 945593ba32..123b0f4d44 100644 --- a/osu.Game.Tournament/TournamentSceneManager.cs +++ b/osu.Game.Tournament/TournamentSceneManager.cs @@ -38,11 +38,14 @@ namespace osu.Game.Tournament private Container screens; private TourneyVideo video; - public const float CONTROL_AREA_WIDTH = 200; + public const int CONTROL_AREA_WIDTH = 200; - public const float STREAM_AREA_WIDTH = 1366; + public const int STREAM_AREA_WIDTH = 1366; + public const int STREAM_AREA_HEIGHT = (int)(STREAM_AREA_WIDTH / ASPECT_RATIO); - public const double REQUIRED_WIDTH = CONTROL_AREA_WIDTH * 2 + STREAM_AREA_WIDTH; + public const float ASPECT_RATIO = 16 / 9f; + + public const int REQUIRED_WIDTH = CONTROL_AREA_WIDTH * 2 + STREAM_AREA_WIDTH; [Cached] private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay(); @@ -65,7 +68,7 @@ namespace osu.Game.Tournament RelativeSizeAxes = Axes.Y, X = CONTROL_AREA_WIDTH, FillMode = FillMode.Fit, - FillAspectRatio = 16 / 9f, + FillAspectRatio = ASPECT_RATIO, Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, Width = STREAM_AREA_WIDTH, From 62121ea14c2d353cfb4a73733a43af3322fae082 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Jul 2023 19:20:12 +0900 Subject: [PATCH 4/6] Add non-black background to right of tournament system --- osu.Game.Tournament/TournamentSceneManager.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game.Tournament/TournamentSceneManager.cs b/osu.Game.Tournament/TournamentSceneManager.cs index 123b0f4d44..9ac5a9de12 100644 --- a/osu.Game.Tournament/TournamentSceneManager.cs +++ b/osu.Game.Tournament/TournamentSceneManager.cs @@ -75,6 +75,13 @@ namespace osu.Game.Tournament //Masking = true, Children = new Drawable[] { + new Box + { + Colour = new Color4(20, 20, 20, 255), + Anchor = Anchor.TopRight, + RelativeSizeAxes = Axes.Both, + Width = 10, + }, video = new TourneyVideo("main", true) { Loop = true, From 09ee500f62dfdf1fda46bf38c082626351f81163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 24 Jul 2023 21:32:05 +0200 Subject: [PATCH 5/6] Fix test failures due to `Content` override being applied in two places weirdly --- osu.Game.Tournament.Tests/TournamentScreenTestScene.cs | 7 +++++++ osu.Game.Tournament.Tests/TournamentTestScene.cs | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs b/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs index 76cc598af4..123fb5c2f9 100644 --- a/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs +++ b/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osuTK; @@ -15,5 +16,11 @@ namespace osu.Game.Tournament.Tests Scale = new Vector2(1920 / (float)(1920 + TournamentSceneManager.CONTROL_AREA_WIDTH)), RelativeSizeAxes = Axes.Both }; + + [BackgroundDependencyLoader] + private void load() + { + base.Content.Add(Content); + } } } diff --git a/osu.Game.Tournament.Tests/TournamentTestScene.cs b/osu.Game.Tournament.Tests/TournamentTestScene.cs index 5b56946ba3..a00a0a6e5a 100644 --- a/osu.Game.Tournament.Tests/TournamentTestScene.cs +++ b/osu.Game.Tournament.Tests/TournamentTestScene.cs @@ -43,8 +43,6 @@ namespace osu.Game.Tournament.Tests Ruleset.BindTo(Ladder.Ruleset); Dependencies.CacheAs(new StableInfo(storage)); - - base.Content.Add(Content); } [SetUpSteps] From e7c1664adbeedcc4f2721482a0fe484b26c01f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 24 Jul 2023 22:07:11 +0200 Subject: [PATCH 6/6] Fix blank space under tournament screen test scenes on very wide screens --- .../TournamentScreenTestScene.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs b/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs index 123fb5c2f9..8adffe1468 100644 --- a/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs +++ b/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -10,17 +11,28 @@ namespace osu.Game.Tournament.Tests { public abstract partial class TournamentScreenTestScene : TournamentTestScene { - protected override Container Content { get; } = new DrawSizePreservingFillContainer - { - TargetDrawSize = new Vector2(1920, 1080), - Scale = new Vector2(1920 / (float)(1920 + TournamentSceneManager.CONTROL_AREA_WIDTH)), - RelativeSizeAxes = Axes.Both - }; + protected override Container Content { get; } = new TournamentScalingContainer(); [BackgroundDependencyLoader] private void load() { base.Content.Add(Content); } + + private partial class TournamentScalingContainer : DrawSizePreservingFillContainer + { + public TournamentScalingContainer() + { + TargetDrawSize = new Vector2(1920, 1080); + RelativeSizeAxes = Axes.Both; + } + + protected override void Update() + { + base.Update(); + + Scale = new Vector2(Math.Min(1, Content.DrawWidth / (1920 + TournamentSceneManager.CONTROL_AREA_WIDTH))); + } + } } }