mirror of
https://github.com/ppy/osu
synced 2025-04-11 03:31:46 +00:00
Merge branch 'master' into menu-music-osz
This commit is contained in:
commit
a48a03bf38
@ -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,12 @@ 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 transition_duration = 400;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(FrameworkConfigManager config)
|
private void load(FrameworkConfigManager config)
|
||||||
{
|
{
|
||||||
@ -33,34 +35,40 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
LabelText = "Letterboxing",
|
LabelText = "Letterboxing",
|
||||||
Bindable = letterboxing,
|
Bindable = letterboxing,
|
||||||
},
|
},
|
||||||
letterboxPositionX = new SettingsSlider<double>
|
letterboxSettings = new FillFlowContainer
|
||||||
|
{
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
AutoSizeDuration = transition_duration,
|
||||||
|
AutoSizeEasing = EasingTypes.OutQuint,
|
||||||
|
Masking = true,
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new SettingsSlider<double>
|
||||||
{
|
{
|
||||||
LabelText = "Horizontal position",
|
LabelText = "Horizontal position",
|
||||||
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionX)
|
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionX)
|
||||||
},
|
},
|
||||||
letterboxPositionY = new SettingsSlider<double>
|
new SettingsSlider<double>
|
||||||
{
|
{
|
||||||
LabelText = "Vertical position",
|
LabelText = "Vertical position",
|
||||||
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionY)
|
Bindable = config.GetBindable<double>(FrameworkSetting.LetterboxPositionY)
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
letterboxing.ValueChanged += visibilityChanged;
|
letterboxing.ValueChanged += isVisible =>
|
||||||
letterboxing.TriggerChange();
|
{
|
||||||
}
|
letterboxSettings.ClearTransforms();
|
||||||
|
letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None;
|
||||||
|
|
||||||
private void visibilityChanged(bool newVisibility)
|
if(!isVisible)
|
||||||
{
|
letterboxSettings.ResizeHeightTo(0, transition_duration, EasingTypes.OutQuint);
|
||||||
if (newVisibility)
|
};
|
||||||
{
|
letterboxing.TriggerChange();
|
||||||
letterboxPositionX.Show();
|
|
||||||
letterboxPositionY.Show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
letterboxPositionX.Hide();
|
|
||||||
letterboxPositionY.Hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ namespace osu.Game.Screens.Play
|
|||||||
public readonly SongProgress Progress;
|
public readonly SongProgress Progress;
|
||||||
public readonly ModDisplay ModDisplay;
|
public readonly ModDisplay ModDisplay;
|
||||||
|
|
||||||
private Bindable<bool> showKeyCounter;
|
|
||||||
private Bindable<bool> showHud;
|
private Bindable<bool> showHud;
|
||||||
|
|
||||||
private static bool hasShownNotificationOnce;
|
private static bool hasShownNotificationOnce;
|
||||||
@ -67,24 +66,8 @@ namespace osu.Game.Screens.Play
|
|||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuConfigManager config, NotificationManager notificationManager)
|
private void load(OsuConfigManager config, NotificationManager notificationManager)
|
||||||
{
|
{
|
||||||
showKeyCounter = config.GetBindable<bool>(OsuSetting.KeyOverlay);
|
|
||||||
showKeyCounter.ValueChanged += keyCounterVisibility =>
|
|
||||||
{
|
|
||||||
if (keyCounterVisibility)
|
|
||||||
KeyCounter.FadeIn(duration);
|
|
||||||
else
|
|
||||||
KeyCounter.FadeOut(duration);
|
|
||||||
};
|
|
||||||
showKeyCounter.TriggerChange();
|
|
||||||
|
|
||||||
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
|
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
|
||||||
showHud.ValueChanged += hudVisibility =>
|
showHud.ValueChanged += hudVisibility => content.FadeTo(hudVisibility ? 1 : 0, duration);
|
||||||
{
|
|
||||||
if (hudVisibility)
|
|
||||||
content.FadeIn(duration);
|
|
||||||
else
|
|
||||||
content.FadeOut(duration);
|
|
||||||
};
|
|
||||||
showHud.TriggerChange();
|
showHud.TriggerChange();
|
||||||
|
|
||||||
if (!showHud && !hasShownNotificationOnce)
|
if (!showHud && !hasShownNotificationOnce)
|
||||||
|
@ -6,11 +6,18 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class KeyCounterCollection : FillFlowContainer<KeyCounter>
|
public class KeyCounterCollection : FillFlowContainer<KeyCounter>
|
||||||
{
|
{
|
||||||
|
private const int duration = 100;
|
||||||
|
|
||||||
|
private Bindable<bool> showKeyCounter;
|
||||||
|
|
||||||
public KeyCounterCollection()
|
public KeyCounterCollection()
|
||||||
{
|
{
|
||||||
AlwaysReceiveInput = true;
|
AlwaysReceiveInput = true;
|
||||||
@ -34,6 +41,14 @@ namespace osu.Game.Screens.Play
|
|||||||
counter.ResetCount();
|
counter.ResetCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
showKeyCounter = config.GetBindable<bool>(OsuSetting.KeyOverlay);
|
||||||
|
showKeyCounter.ValueChanged += keyCounterVisibility => FadeTo(keyCounterVisibility ? 1 : 0, duration);
|
||||||
|
showKeyCounter.TriggerChange();
|
||||||
|
}
|
||||||
|
|
||||||
//further: change default values here and in KeyCounter if needed, instead of passing them in every constructor
|
//further: change default values here and in KeyCounter if needed, instead of passing them in every constructor
|
||||||
private bool isCounting;
|
private bool isCounting;
|
||||||
public bool IsCounting
|
public bool IsCounting
|
||||||
|
Loading…
Reference in New Issue
Block a user