From 9f4e48dde78eb1b76c6131999aa21aeb4dc42843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 24 Sep 2024 15:15:28 +0200 Subject: [PATCH] Actually use bindables rather than stick things in `Update()` --- osu.Game/Screens/Play/HUD/ArgonSongProgress.cs | 2 +- osu.Game/Screens/Play/HUD/DefaultSongProgress.cs | 3 +-- osu.Game/Skinning/Components/BoxElement.cs | 8 +++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs b/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs index 1a18466743..92ac863e98 100644 --- a/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs @@ -98,6 +98,7 @@ protected override void LoadComplete() Interactive.BindValueChanged(_ => bar.Interactive = Interactive.Value, true); ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true); ShowTime.BindValueChanged(_ => info.FadeTo(ShowTime.Value ? 1 : 0, 200, Easing.In), true); + AccentColour.BindValueChanged(_ => Colour = AccentColour.Value, true); } protected override void UpdateObjects(IEnumerable objects) @@ -118,7 +119,6 @@ protected override void Update() base.Update(); content.Height = bar.Height + bar_height + info.Height; graphContainer.Height = bar.Height; - Colour = AccentColour.Value; } protected override void UpdateProgress(double progress, bool isIntro) diff --git a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs index 93d75a22ba..4e41901ee3 100644 --- a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs @@ -90,6 +90,7 @@ protected override void LoadComplete() Interactive.BindValueChanged(_ => updateBarVisibility(), true); ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true); ShowTime.BindValueChanged(_ => updateTimeVisibility(), true); + AccentColour.BindValueChanged(_ => Colour = AccentColour.Value, true); base.LoadComplete(); } @@ -118,8 +119,6 @@ protected override void Update() if (!Precision.AlmostEquals(Height, newHeight, 5f)) content.Height = newHeight; - - Colour = AccentColour.Value; } private void updateBarVisibility() diff --git a/osu.Game/Skinning/Components/BoxElement.cs b/osu.Game/Skinning/Components/BoxElement.cs index 633fb0c327..7f052a8523 100644 --- a/osu.Game/Skinning/Components/BoxElement.cs +++ b/osu.Game/Skinning/Components/BoxElement.cs @@ -46,12 +46,18 @@ public BoxElement() Masking = true; } + protected override void LoadComplete() + { + base.LoadComplete(); + + AccentColour.BindValueChanged(_ => Colour = AccentColour.Value, true); + } + protected override void Update() { base.Update(); base.CornerRadius = CornerRadius.Value * Math.Min(DrawWidth, DrawHeight); - Colour = AccentColour.Value; } } }