1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 10:17:32 +08:00

Merge pull request #24348 from peppy/tournament-resolution-fixes

Enforce a hard minimum window size for tournament client
This commit is contained in:
Dean Herbert 2023-07-25 08:20:03 +09:00 committed by GitHub
commit 8535135a84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 94 additions and 43 deletions

View File

@ -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)

View File

@ -15,11 +15,25 @@ 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 };
[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", () =>

View File

@ -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()

View File

@ -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()

View File

@ -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;

View File

@ -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()
{

View File

@ -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()

View File

@ -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();

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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();

View File

@ -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()

View File

@ -0,0 +1,38 @@
// 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;
using osu.Framework.Allocation;
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<Drawable> 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)));
}
}
}
}

View File

@ -1,8 +1,6 @@
// 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.
#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)
{
@ -167,7 +165,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()
{

View File

@ -35,14 +35,19 @@ namespace osu.Game.Tournament
public static readonly Color4 TEXT_COLOUR = Color4Extensions.FromHex("#fff");
private Drawable heightWarning;
private Bindable<Size> windowSize;
private Bindable<WindowMode> windowMode;
private readonly BindableSize windowSize = new BindableSize();
private LoadingSpinner loadingSpinner;
[BackgroundDependencyLoader]
private void load(FrameworkConfigManager frameworkConfig, GameHost host)
{
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
frameworkConfig.BindWith(FrameworkSetting.WindowedSize, windowSize);
windowSize.MinValue = new Size(TournamentSceneManager.REQUIRED_WIDTH, TournamentSceneManager.STREAM_AREA_HEIGHT);
windowMode = frameworkConfig.GetBindable<WindowMode>(FrameworkSetting.WindowMode);
Add(loadingSpinner = new LoadingSpinner(true, true)

View File

@ -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,13 +68,20 @@ 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,
//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,