1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 10:17:19 +08:00

IsOpen -> Expanded

This commit is contained in:
Dean Herbert 2021-05-19 15:48:31 +09:00
parent 539e5179fe
commit 19a07b0107
2 changed files with 12 additions and 11 deletions

View File

@ -23,7 +23,7 @@ namespace osu.Game.Overlays.News.Sidebar
{ {
private const int animation_duration = 250; private const int animation_duration = 250;
public readonly BindableBool IsOpen = new BindableBool(); public readonly BindableBool Expanded = new BindableBool();
public MonthSection(int month, int year, IEnumerable<APINewsPost> posts) public MonthSection(int month, int year, IEnumerable<APINewsPost> posts)
{ {
@ -32,6 +32,7 @@ namespace osu.Game.Overlays.News.Sidebar
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Masking = true; Masking = true;
InternalChild = new FillFlowContainer InternalChild = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -41,11 +42,11 @@ namespace osu.Game.Overlays.News.Sidebar
{ {
new DropdownHeader(month, year) new DropdownHeader(month, year)
{ {
IsOpen = { BindTarget = IsOpen } Expanded = { BindTarget = Expanded }
}, },
new PostsContainer new PostsContainer
{ {
IsOpen = { BindTarget = IsOpen }, Expanded = { BindTarget = Expanded },
Children = posts.Select(p => new PostButton(p)).ToArray() Children = posts.Select(p => new PostButton(p)).ToArray()
} }
} }
@ -54,7 +55,7 @@ namespace osu.Game.Overlays.News.Sidebar
private class DropdownHeader : OsuClickableContainer private class DropdownHeader : OsuClickableContainer
{ {
public readonly BindableBool IsOpen = new BindableBool(); public readonly BindableBool Expanded = new BindableBool();
private readonly SpriteIcon icon; private readonly SpriteIcon icon;
@ -64,7 +65,7 @@ namespace osu.Game.Overlays.News.Sidebar
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = 15; Height = 15;
Action = IsOpen.Toggle; Action = Expanded.Toggle;
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText
@ -88,7 +89,7 @@ namespace osu.Game.Overlays.News.Sidebar
{ {
base.LoadComplete(); base.LoadComplete();
IsOpen.BindValueChanged(open => Expanded.BindValueChanged(open =>
{ {
icon.Scale = new Vector2(1, open.NewValue ? -1 : 1); icon.Scale = new Vector2(1, open.NewValue ? -1 : 1);
}, true); }, true);
@ -129,7 +130,7 @@ namespace osu.Game.Overlays.News.Sidebar
private class PostsContainer : Container private class PostsContainer : Container
{ {
public readonly BindableBool IsOpen = new BindableBool(); public readonly BindableBool Expanded = new BindableBool();
protected override Container<Drawable> Content { get; } protected override Container<Drawable> Content { get; }
@ -153,14 +154,14 @@ namespace osu.Game.Overlays.News.Sidebar
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
IsOpen.BindValueChanged(updateState, true); Expanded.BindValueChanged(updateState, true);
} }
private void updateState(ValueChangedEvent<bool> isOpen) private void updateState(ValueChangedEvent<bool> expanded)
{ {
ClearTransforms(true); ClearTransforms(true);
if (isOpen.NewValue) if (expanded.NewValue)
{ {
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Content.FadeIn(animation_duration, Easing.OutQuint); Content.FadeIn(animation_duration, Easing.OutQuint);

View File

@ -95,7 +95,7 @@ namespace osu.Game.Overlays.News.Sidebar
monthsFlow.Add(new MonthSection(month, year, posts) monthsFlow.Add(new MonthSection(month, year, posts)
{ {
IsOpen = { Value = i == 0 } Expanded = { Value = i == 0 }
}); });
} }
} }