mirror of https://github.com/ppy/osu
Add resolution selector in tournament setup screen
This commit is contained in:
parent
8fb41e4c67
commit
b902e50396
|
@ -22,9 +22,9 @@ public class ControlPanel : Container
|
|||
|
||||
public ControlPanel()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
AlwaysPresent = true;
|
||||
Width = 0.15f;
|
||||
Width = TournamentSceneManager.CONTROL_AREA_WIDTH;
|
||||
Anchor = Anchor.TopRight;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
|
@ -47,8 +47,8 @@ public ControlPanel()
|
|||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = 0.75f,
|
||||
Position = new Vector2(0, 35f),
|
||||
Padding = new MarginPadding(5),
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 5f),
|
||||
},
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
@ -22,6 +25,7 @@ public class SetupScreen : TournamentScreen, IProvideVideo
|
|||
private FillFlowContainer fillFlow;
|
||||
|
||||
private LoginOverlay loginOverlay;
|
||||
private ActionableInfo resolution;
|
||||
|
||||
[Resolved]
|
||||
private MatchIPCInfo ipc { get; set; }
|
||||
|
@ -32,9 +36,13 @@ public class SetupScreen : TournamentScreen, IProvideVideo
|
|||
[Resolved]
|
||||
private RulesetStore rulesets { get; set; }
|
||||
|
||||
private Bindable<Size> windowSize;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(FrameworkConfigManager frameworkConfig)
|
||||
{
|
||||
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
|
||||
|
||||
InternalChild = fillFlow = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
@ -48,6 +56,9 @@ private void load()
|
|||
reload();
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private Framework.Game game { get; set; }
|
||||
|
||||
private void reload()
|
||||
{
|
||||
var fileBasedIpc = ipc as FileBasedIPC;
|
||||
|
@ -97,9 +108,25 @@ private void reload()
|
|||
Items = rulesets.AvailableRulesets,
|
||||
Current = LadderInfo.Ruleset,
|
||||
},
|
||||
resolution = new ActionableInfo
|
||||
{
|
||||
Label = "Stream area resolution",
|
||||
ButtonText = "Set to 1080p",
|
||||
Action = () =>
|
||||
{
|
||||
windowSize.Value = new Size((int)(1920 / TournamentSceneManager.STREAM_AREA_WIDTH * TournamentSceneManager.REQUIRED_WIDTH), 1080);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
resolution.Value = $"{ScreenSpaceDrawQuad.Width:N0}x{ScreenSpaceDrawQuad.Height:N0}";
|
||||
}
|
||||
|
||||
public class LabelledDropdown<T> : LabelledComponent<OsuDropdown<T>, T>
|
||||
{
|
||||
public LabelledDropdown()
|
||||
|
|
|
@ -65,7 +65,7 @@ private void load(Storage storage, FrameworkConfigManager frameworkConfig)
|
|||
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
|
||||
windowSize.BindValueChanged(size => ScheduleAfterChildren(() =>
|
||||
{
|
||||
var minWidth = (int)(size.NewValue.Height / 9f * 16 + 400);
|
||||
var minWidth = (int)(size.NewValue.Height / 768f * TournamentSceneManager.REQUIRED_WIDTH) - 1;
|
||||
|
||||
heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0;
|
||||
}), true);
|
||||
|
|
|
@ -33,6 +33,12 @@ public class TournamentSceneManager : CompositeDrawable
|
|||
private Container screens;
|
||||
private TourneyVideo video;
|
||||
|
||||
public const float CONTROL_AREA_WIDTH = 160;
|
||||
|
||||
public const float STREAM_AREA_WIDTH = 1366;
|
||||
|
||||
public const double REQUIRED_WIDTH = TournamentSceneManager.CONTROL_AREA_WIDTH * 2 + TournamentSceneManager.STREAM_AREA_WIDTH;
|
||||
|
||||
[Cached]
|
||||
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay();
|
||||
|
||||
|
@ -51,13 +57,13 @@ private void load(LadderInfo ladder, Storage storage)
|
|||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
X = 200,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
X = CONTROL_AREA_WIDTH,
|
||||
FillMode = FillMode.Fit,
|
||||
FillAspectRatio = 16 / 9f,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
Size = new Vector2(0.8f, 1),
|
||||
Width = STREAM_AREA_WIDTH,
|
||||
//Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -96,7 +102,7 @@ private void load(LadderInfo ladder, Storage storage)
|
|||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = 200,
|
||||
Width = CONTROL_AREA_WIDTH,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
|
@ -108,8 +114,8 @@ private void load(LadderInfo ladder, Storage storage)
|
|||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(2),
|
||||
Padding = new MarginPadding(2),
|
||||
Spacing = new Vector2(5),
|
||||
Padding = new MarginPadding(5),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ScreenButton(typeof(SetupScreen)) { Text = "Setup", RequestSelection = SetScreen },
|
||||
|
|
Loading…
Reference in New Issue