Merge pull request #2074 from peppy/visual-settings-improvements

Collapse visual settings by default in player
This commit is contained in:
Dan Balasescu 2018-02-19 14:31:08 +09:00 committed by GitHub
commit 8d61f60388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 19 deletions

View File

@ -39,7 +39,7 @@ namespace osu.Game.Screens.Play.HUD
//CollectionSettings = new CollectionSettings(),
//DiscussionSettings = new DiscussionSettings(),
PlaybackSettings = new PlaybackSettings(),
VisualSettings = new VisualSettings()
VisualSettings = new VisualSettings { Expanded = false }
}
};

View File

@ -31,6 +31,28 @@ namespace osu.Game.Screens.Play.PlayerSettings
private bool expanded = true;
public bool Expanded
{
get { return expanded; }
set
{
if (expanded == value) return;
expanded = value;
content.ClearTransforms();
if (expanded)
content.AutoSizeAxes = Axes.Y;
else
{
content.AutoSizeAxes = Axes.None;
content.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
}
button.FadeColour(expanded ? buttonActiveColour : Color4.White, 200, Easing.OutQuint);
}
}
private Color4 buttonActiveColour;
protected PlayerSettingsGroup()
@ -82,7 +104,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
Position = new Vector2(-15, 0),
Icon = FontAwesome.fa_bars,
Scale = new Vector2(0.75f),
Action = toggleContentVisibility,
Action = () => Expanded = !Expanded,
},
}
},
@ -111,22 +133,5 @@ namespace osu.Game.Screens.Play.PlayerSettings
}
protected override Container<Drawable> Content => content;
private void toggleContentVisibility()
{
content.ClearTransforms();
expanded = !expanded;
if (expanded)
content.AutoSizeAxes = Axes.Y;
else
{
content.AutoSizeAxes = Axes.None;
content.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
}
button.FadeColour(expanded ? buttonActiveColour : Color4.White, 200, Easing.OutQuint);
}
}
}