1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 03:22:54 +08:00

Breathe some colour and life into the toolbar

This commit is contained in:
Dean Herbert 2023-12-28 04:06:29 +09:00
parent 92c4c20a51
commit cf5e3e8863
No known key found for this signature in database
3 changed files with 43 additions and 38 deletions

View File

@ -3,6 +3,7 @@
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@ -14,7 +15,7 @@ namespace osu.Game.Overlays.Toolbar
{
public partial class ToolbarOverlayToggleButton : ToolbarButton
{
private readonly Box stateBackground;
private Box stateBackground;
private OverlayContainer stateContainer;
@ -44,12 +45,13 @@ namespace osu.Game.Overlays.Toolbar
}
}
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,

View File

@ -4,20 +4,19 @@
#nullable disable
using System.Collections.Generic;
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 osuTK.Input;
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.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Rulesets;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
namespace osu.Game.Overlays.Toolbar
{
@ -47,20 +46,18 @@ namespace osu.Game.Overlays.Toolbar
{
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)
@ -90,7 +87,7 @@ namespace osu.Game.Overlays.Toolbar
{
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();

View File

@ -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
{
@ -41,27 +43,31 @@ namespace osu.Game.Overlays.Toolbar
{
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)