1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 04:02:59 +08:00

Fix my code according to the changes @bdach requested

This commit is contained in:
CenTdemeern1 2022-03-31 20:39:26 +02:00
parent c64a90b39e
commit bdb21b17f7

View File

@ -21,9 +21,8 @@ namespace osu.Game.Overlays.Toolbar
{ {
private Bindable<ToolbarClockDisplayMode> clockDisplayMode; private Bindable<ToolbarClockDisplayMode> clockDisplayMode;
protected Box HoverBackground; private Box hoverBackground;
private readonly Box flashBackground; private Box flashBackground;
private readonly FillFlowContainer clockContainer;
private DigitalClockDisplay digital; private DigitalClockDisplay digital;
private AnalogClockDisplay analog; private AnalogClockDisplay analog;
@ -33,10 +32,16 @@ namespace osu.Game.Overlays.Toolbar
{ {
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
AutoSizeAxes = Axes.X; AutoSizeAxes = Axes.X;
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
clockDisplayMode = config.GetBindable<ToolbarClockDisplayMode>(OsuSetting.ToolbarClockDisplayMode);
Children = new Drawable[] Children = new Drawable[]
{ {
HoverBackground = new Box hoverBackground = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(80).Opacity(180), Colour = OsuColour.Gray(80).Opacity(180),
@ -50,8 +55,7 @@ namespace osu.Game.Overlays.Toolbar
Colour = Color4.White.Opacity(100), Colour = Color4.White.Opacity(100),
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
}, },
new FillFlowContainer
clockContainer = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
@ -75,12 +79,6 @@ namespace osu.Game.Overlays.Toolbar
}; };
} }
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
clockDisplayMode = config.GetBindable<ToolbarClockDisplayMode>(OsuSetting.ToolbarClockDisplayMode);
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
@ -109,14 +107,16 @@ namespace osu.Game.Overlays.Toolbar
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
HoverBackground.FadeIn(200); hoverBackground.FadeIn(200);
return base.OnHover(e); return base.OnHover(e);
} }
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
HoverBackground.FadeOut(200); hoverBackground.FadeOut(200);
base.OnHoverLost(e);
} }
private void cycleDisplayMode() private void cycleDisplayMode()