From 539e5179fe8ef9d9cd148882a063595295872815 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 May 2021 15:45:24 +0900 Subject: [PATCH] Tidy up content and bind event code --- .../Overlays/News/Sidebar/MonthSection.cs | 22 +++++++++---------- osu.Game/Overlays/News/Sidebar/YearsPanel.cs | 4 ++-- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/News/Sidebar/MonthSection.cs b/osu.Game/Overlays/News/Sidebar/MonthSection.cs index 2fc88b3909..9fc4f49bd3 100644 --- a/osu.Game/Overlays/News/Sidebar/MonthSection.cs +++ b/osu.Game/Overlays/News/Sidebar/MonthSection.cs @@ -117,10 +117,10 @@ namespace osu.Game.Overlays.News.Sidebar } [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider, GameHost host) + private void load(OverlayColourProvider overlayColours, GameHost host) { - IdleColour = colourProvider.Light2; - HoverColour = colourProvider.Light1; + IdleColour = overlayColours.Light2; + HoverColour = overlayColours.Light1; TooltipText = "view in browser"; Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug); @@ -131,9 +131,7 @@ namespace osu.Game.Overlays.News.Sidebar { public readonly BindableBool IsOpen = new BindableBool(); - protected override Container Content => content; - - private readonly FillFlowContainer content; + protected override Container Content { get; } public PostsContainer() { @@ -141,7 +139,7 @@ namespace osu.Game.Overlays.News.Sidebar AutoSizeAxes = Axes.Y; AutoSizeDuration = animation_duration; AutoSizeEasing = Easing.Out; - InternalChild = content = new FillFlowContainer + InternalChild = Content = new FillFlowContainer { Margin = new MarginPadding { Top = 5 }, RelativeSizeAxes = Axes.X, @@ -155,24 +153,24 @@ namespace osu.Game.Overlays.News.Sidebar protected override void LoadComplete() { base.LoadComplete(); - IsOpen.BindValueChanged(_ => updateState(), true); + IsOpen.BindValueChanged(updateState, true); } - private void updateState() + private void updateState(ValueChangedEvent isOpen) { ClearTransforms(true); - if (IsOpen.Value) + if (isOpen.NewValue) { AutoSizeAxes = Axes.Y; - content.FadeIn(animation_duration, Easing.OutQuint); + Content.FadeIn(animation_duration, Easing.OutQuint); } else { AutoSizeAxes = Axes.None; this.ResizeHeightTo(0, animation_duration, Easing.OutQuint); - content.FadeOut(animation_duration, Easing.OutQuint); + Content.FadeOut(animation_duration, Easing.OutQuint); } } } diff --git a/osu.Game/Overlays/News/Sidebar/YearsPanel.cs b/osu.Game/Overlays/News/Sidebar/YearsPanel.cs index 849cdbf659..b6bbdbb6d4 100644 --- a/osu.Game/Overlays/News/Sidebar/YearsPanel.cs +++ b/osu.Game/Overlays/News/Sidebar/YearsPanel.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.News.Sidebar private FillFlowContainer yearsFlow; [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider, Bindable metadata) + private void load(OverlayColourProvider overlayColours, Bindable metadata) { this.metadata.BindTo(metadata); @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.News.Sidebar new Box { RelativeSizeAxes = Axes.Both, - Colour = colourProvider.Background3 + Colour = overlayColours.Background3 }, new Container {