Skip to content

Commit

Permalink
Breathe some colour and life into the toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Dec 27, 2023
1 parent 92c4c20 commit cf5e3e8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 36 deletions.
8 changes: 5 additions & 3 deletions osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#nullable disable

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
Expand All @@ -14,7 +15,7 @@ namespace osu.Game.Overlays.Toolbar
{
public partial class ToolbarOverlayToggleButton : ToolbarButton
{
private readonly Box stateBackground;
private Box stateBackground;

private OverlayContainer stateContainer;

Expand Down Expand Up @@ -44,12 +45,13 @@ public OverlayContainer StateContainer
}
}

public ToolbarOverlayToggleButton()
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundContent.Add(stateBackground = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(150).Opacity(180),
Colour = colours.Carmine.Opacity(180),
Blending = BlendingParameters.Additive,
Depth = 2,
Alpha = 0,
Expand Down
39 changes: 18 additions & 21 deletions osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
#nullable disable

using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Rulesets;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;

namespace osu.Game.Overlays.Toolbar
{
Expand Down Expand Up @@ -47,20 +46,18 @@ private void load(AudioManager audio)
{
Size = new Vector2(Toolbar.HEIGHT, 3),
Anchor = Anchor.BottomLeft,
Origin = Anchor.TopLeft,
Masking = true,
EdgeEffect = new EdgeEffectParameters
Origin = Anchor.BottomLeft,
Y = -1,
Children = new Drawable[]
{
Type = EdgeEffectType.Glow,
Colour = new Color4(255, 194, 224, 100),
Radius = 15,
Roundness = 15,
},
Child = new Box
{
RelativeSizeAxes = Axes.Both,
new Circle
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(18, 3),
}
}
}
},
});

foreach (var ruleset in Rulesets.AvailableRulesets)
Expand Down Expand Up @@ -90,7 +87,7 @@ private void moveLineToCurrent()
{
if (SelectedTab != null)
{
ModeButtonLine.MoveToX(SelectedTab.DrawPosition.X, !hasInitialPosition ? 0 : 200, Easing.OutQuint);
ModeButtonLine.MoveToX(SelectedTab.DrawPosition.X, !hasInitialPosition ? 0 : 500, Easing.OutElasticQuarter);

if (hasInitialPosition)
selectionSamples[SelectedTab.Value.ShortName]?.Play();
Expand Down
30 changes: 18 additions & 12 deletions osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Rulesets;
using osuTK.Graphics;

namespace osu.Game.Overlays.Toolbar
{
Expand Down Expand Up @@ -41,27 +43,31 @@ private partial class RulesetButton : ToolbarButton
{
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds();

[Resolved]
private OsuColour colours { get; set; } = null!;

public RulesetButton()
{
Padding = new MarginPadding(3)
{
Bottom = 5
};
}

public bool Active
{
set
set => Scheduler.AddOnce(() =>
{
if (value)
{
IconContainer.Colour = Color4.White;
IconContainer.EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Colour = new Color4(255, 194, 224, 100),
Radius = 15,
Roundness = 15,
};
IconContainer.Colour = Color4Extensions.FromHex("#00FFAA");
}
else
{
IconContainer.Colour = new Color4(255, 194, 224, 255);
IconContainer.Colour = colours.GrayF;
IconContainer.EdgeEffect = new EdgeEffectParameters();
}
}
});
}

protected override bool OnClick(ClickEvent e)
Expand Down

0 comments on commit cf5e3e8

Please sign in to comment.