mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 18:12:56 +08:00
Better letterbox settings transition
This commit is contained in:
parent
4b23cc47ea
commit
c7a241246e
@ -4,6 +4,7 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections.Graphics
|
namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||||
{
|
{
|
||||||
@ -11,11 +12,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
{
|
{
|
||||||
protected override string Header => "Layout";
|
protected override string Header => "Layout";
|
||||||
|
|
||||||
private SettingsSlider<double> letterboxPositionX;
|
private FillFlowContainer letterboxSettings;
|
||||||
private SettingsSlider<double> letterboxPositionY;
|
|
||||||
|
|
||||||
private Bindable<bool> letterboxing;
|
private Bindable<bool> letterboxing;
|
||||||
|
|
||||||
|
private const int letterbox_container_height = 75;
|
||||||
|
private const int duration = 200;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(FrameworkConfigManager config)
|
private void load(FrameworkConfigManager config)
|
||||||
{
|
{
|
||||||
@ -33,34 +36,30 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
LabelText = "Letterboxing",
|
LabelText = "Letterboxing",
|
||||||
Bindable = letterboxing,
|
Bindable = letterboxing,
|
||||||
},
|
},
|
||||||
letterboxPositionX = new SettingsSlider<double>
|
letterboxSettings = new FillFlowContainer
|
||||||
{
|
{
|
||||||
LabelText = "Horizontal position",
|
Direction = FillDirection.Vertical,
|
||||||
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionX)
|
RelativeSizeAxes = Axes.X,
|
||||||
},
|
Masking = true,
|
||||||
letterboxPositionY = new SettingsSlider<double>
|
|
||||||
{
|
Children = new Drawable[]
|
||||||
LabelText = "Vertical position",
|
{
|
||||||
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionY)
|
new SettingsSlider<double>
|
||||||
|
{
|
||||||
|
LabelText = "Horizontal position",
|
||||||
|
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionX)
|
||||||
|
},
|
||||||
|
new SettingsSlider<double>
|
||||||
|
{
|
||||||
|
LabelText = "Vertical position",
|
||||||
|
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionY)
|
||||||
|
},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
letterboxing.ValueChanged += visibilityChanged;
|
letterboxing.ValueChanged += isVisible => letterboxSettings.ResizeHeightTo(isVisible ? letterbox_container_height : 0, duration, EasingTypes.OutQuint);
|
||||||
letterboxing.TriggerChange();
|
letterboxing.TriggerChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void visibilityChanged(bool newVisibility)
|
|
||||||
{
|
|
||||||
if (newVisibility)
|
|
||||||
{
|
|
||||||
letterboxPositionX.Show();
|
|
||||||
letterboxPositionY.Show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
letterboxPositionX.Hide();
|
|
||||||
letterboxPositionY.Hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user