1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 03:02:56 +08:00

Actually use bindables rather than stick things in Update()

This commit is contained in:
Bartłomiej Dach 2024-09-24 15:15:28 +02:00
parent 4f57a67ea4
commit 9f4e48dde7
No known key found for this signature in database
3 changed files with 9 additions and 4 deletions

View File

@ -98,6 +98,7 @@ namespace osu.Game.Screens.Play.HUD
Interactive.BindValueChanged(_ => bar.Interactive = Interactive.Value, true); Interactive.BindValueChanged(_ => bar.Interactive = Interactive.Value, true);
ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true); ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true);
ShowTime.BindValueChanged(_ => info.FadeTo(ShowTime.Value ? 1 : 0, 200, Easing.In), true); ShowTime.BindValueChanged(_ => info.FadeTo(ShowTime.Value ? 1 : 0, 200, Easing.In), true);
AccentColour.BindValueChanged(_ => Colour = AccentColour.Value, true);
} }
protected override void UpdateObjects(IEnumerable<HitObject> objects) protected override void UpdateObjects(IEnumerable<HitObject> objects)
@ -118,7 +119,6 @@ namespace osu.Game.Screens.Play.HUD
base.Update(); base.Update();
content.Height = bar.Height + bar_height + info.Height; content.Height = bar.Height + bar_height + info.Height;
graphContainer.Height = bar.Height; graphContainer.Height = bar.Height;
Colour = AccentColour.Value;
} }
protected override void UpdateProgress(double progress, bool isIntro) protected override void UpdateProgress(double progress, bool isIntro)

View File

@ -90,6 +90,7 @@ namespace osu.Game.Screens.Play.HUD
Interactive.BindValueChanged(_ => updateBarVisibility(), true); Interactive.BindValueChanged(_ => updateBarVisibility(), true);
ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true); ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true);
ShowTime.BindValueChanged(_ => updateTimeVisibility(), true); ShowTime.BindValueChanged(_ => updateTimeVisibility(), true);
AccentColour.BindValueChanged(_ => Colour = AccentColour.Value, true);
base.LoadComplete(); base.LoadComplete();
} }
@ -118,8 +119,6 @@ namespace osu.Game.Screens.Play.HUD
if (!Precision.AlmostEquals(Height, newHeight, 5f)) if (!Precision.AlmostEquals(Height, newHeight, 5f))
content.Height = newHeight; content.Height = newHeight;
Colour = AccentColour.Value;
} }
private void updateBarVisibility() private void updateBarVisibility()

View File

@ -46,12 +46,18 @@ namespace osu.Game.Skinning.Components
Masking = true; Masking = true;
} }
protected override void LoadComplete()
{
base.LoadComplete();
AccentColour.BindValueChanged(_ => Colour = AccentColour.Value, true);
}
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
base.CornerRadius = CornerRadius.Value * Math.Min(DrawWidth, DrawHeight); base.CornerRadius = CornerRadius.Value * Math.Min(DrawWidth, DrawHeight);
Colour = AccentColour.Value;
} }
} }
} }