mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add icons for editor toolbox tools
This commit is contained in:
@ -5,7 +5,6 @@ using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -29,7 +28,7 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
|
||||
private Color4 selectedBackgroundColour;
|
||||
private Color4 selectedBubbleColour;
|
||||
|
||||
private readonly Drawable bubble;
|
||||
private Drawable icon;
|
||||
private readonly RadioButton button;
|
||||
|
||||
public DrawableRadioButton(RadioButton button)
|
||||
@ -40,19 +39,6 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
|
||||
Action = button.Select;
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
bubble = new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fit,
|
||||
Scale = new Vector2(0.5f),
|
||||
X = 10,
|
||||
Masking = true,
|
||||
Blending = BlendingParameters.Additive,
|
||||
Child = new Box { RelativeSizeAxes = Axes.Both }
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -73,7 +59,14 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
|
||||
Colour = Color4.Black.Opacity(0.5f)
|
||||
};
|
||||
|
||||
Add(bubble);
|
||||
Add(icon = (button.CreateIcon?.Invoke() ?? new Circle()).With(b =>
|
||||
{
|
||||
b.Blending = BlendingParameters.Additive;
|
||||
b.Anchor = Anchor.CentreLeft;
|
||||
b.Origin = Anchor.CentreLeft;
|
||||
b.Size = new Vector2(20);
|
||||
b.X = 10;
|
||||
}));
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -96,7 +89,7 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
|
||||
return;
|
||||
|
||||
BackgroundColour = button.Selected.Value ? selectedBackgroundColour : defaultBackgroundColour;
|
||||
bubble.Colour = button.Selected.Value ? selectedBubbleColour : defaultBubbleColour;
|
||||
icon.Colour = button.Selected.Value ? selectedBubbleColour : defaultBubbleColour;
|
||||
}
|
||||
|
||||
protected override SpriteText CreateText() => new OsuSpriteText
|
||||
|
Reference in New Issue
Block a user