hud->content and style fixes

This commit is contained in:
Andrey Zavadskiy 2017-04-04 17:47:41 +03:00
parent 009909dd4b
commit bec4bf36ac

View File

@ -20,7 +20,7 @@ namespace osu.Game.Modes.UI
{ {
private const int duration = 100; private const int duration = 100;
private readonly Container hud; private readonly Container content;
public readonly KeyCounterCollection KeyCounter; public readonly KeyCounterCollection KeyCounter;
public readonly ComboCounter ComboCounter; public readonly ComboCounter ComboCounter;
public readonly ScoreCounter ScoreCounter; public readonly ScoreCounter ScoreCounter;
@ -42,7 +42,7 @@ namespace osu.Game.Modes.UI
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Add(hud = new Container Add(content = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -61,17 +61,23 @@ namespace osu.Game.Modes.UI
private void load(OsuConfigManager config, NotificationManager notificationManager) private void load(OsuConfigManager config, NotificationManager notificationManager)
{ {
showKeyCounter = config.GetBindable<bool>(OsuConfig.KeyOverlay); showKeyCounter = config.GetBindable<bool>(OsuConfig.KeyOverlay);
showKeyCounter.ValueChanged += visibility => showKeyCounter.ValueChanged += keyCounterVisibility =>
{ {
if (visibility) if (keyCounterVisibility)
KeyCounter.Show(); KeyCounter.FadeIn(duration);
else else
KeyCounter.Hide(); KeyCounter.FadeOut(duration);
}; };
showKeyCounter.TriggerChange(); showKeyCounter.TriggerChange();
showHud = config.GetBindable<bool>(OsuConfig.ShowInterface); showHud = config.GetBindable<bool>(OsuConfig.ShowInterface);
showHud.ValueChanged += hudVisibilityChanged; showHud.ValueChanged += hudVisibility =>
{
if (hudVisibility)
content.FadeIn(duration);
else
content.FadeOut(duration);
};
showHud.TriggerChange(); showHud.TriggerChange();
if (!showHud && !hasShownNotificationOnce) if (!showHud && !hasShownNotificationOnce)
@ -85,14 +91,6 @@ namespace osu.Game.Modes.UI
} }
} }
private void hudVisibilityChanged(object sender, EventArgs e)
{
if (showHud)
hud.FadeIn(duration);
else
hud.FadeOut(duration);
}
public void BindProcessor(ScoreProcessor processor) public void BindProcessor(ScoreProcessor processor)
{ {
ScoreCounter?.Current.BindTo(processor.TotalScore); ScoreCounter?.Current.BindTo(processor.TotalScore);