mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Update arrow colour on hover
This commit is contained in:
@ -26,22 +26,10 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
Spacing = new Vector2(0, 10),
|
Spacing = new Vector2(0, 10),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new TestButton
|
new TestButton(),
|
||||||
{
|
new LoadRepliesButton(),
|
||||||
Action = () => { }
|
new ShowRepliesButton(1),
|
||||||
},
|
|
||||||
new LoadRepliesButton
|
|
||||||
{
|
|
||||||
Action = () => { }
|
|
||||||
},
|
|
||||||
new ShowRepliesButton(1)
|
|
||||||
{
|
|
||||||
Action = () => { }
|
|
||||||
},
|
|
||||||
new ShowRepliesButton(2)
|
new ShowRepliesButton(2)
|
||||||
{
|
|
||||||
Action = () => { }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,37 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Comments.Buttons
|
namespace osu.Game.Overlays.Comments.Buttons
|
||||||
{
|
{
|
||||||
public abstract class CommentRepliesButton : OsuHoverContainer
|
public abstract class CommentRepliesButton : CompositeDrawable
|
||||||
{
|
{
|
||||||
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
public Action Action { get; set; }
|
||||||
|
|
||||||
protected ChevronIcon Icon;
|
[Resolved]
|
||||||
|
private OverlayColourProvider colourProvider { get; set; }
|
||||||
|
|
||||||
|
protected SpriteIcon Icon;
|
||||||
private Box background;
|
private Box background;
|
||||||
|
|
||||||
public CommentRepliesButton()
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
InternalChildren = new Drawable[]
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OverlayColourProvider colourProvider)
|
|
||||||
{
|
{
|
||||||
Add(new CircularContainer
|
new CircularContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
@ -37,7 +39,8 @@ namespace osu.Game.Overlays.Comments.Buttons
|
|||||||
{
|
{
|
||||||
background = new Box
|
background = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colourProvider.Background2
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
@ -63,38 +66,44 @@ namespace osu.Game.Overlays.Comments.Buttons
|
|||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
|
||||||
Text = GetText()
|
Text = GetText()
|
||||||
},
|
},
|
||||||
Icon = new ChevronIcon
|
Icon = new SpriteIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
|
Size = new Vector2(7.5f),
|
||||||
|
Icon = FontAwesome.Solid.ChevronDown,
|
||||||
|
Colour = colourProvider.Foreground1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
new HoverClickSounds(),
|
||||||
IdleColour = colourProvider.Background2;
|
};
|
||||||
HoverColour = colourProvider.Background1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract string GetText();
|
protected abstract string GetText();
|
||||||
|
|
||||||
protected class ChevronIcon : SpriteIcon
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
public ChevronIcon()
|
base.OnHover(e);
|
||||||
{
|
background.FadeColour(colourProvider.Background1, 200, Easing.OutQuint);
|
||||||
Anchor = Anchor.Centre;
|
Icon.FadeColour(colourProvider.Light1, 200, Easing.OutQuint);
|
||||||
Origin = Anchor.Centre;
|
return true;
|
||||||
Size = new Vector2(7.5f);
|
|
||||||
Icon = FontAwesome.Solid.ChevronDown;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
private void load(OverlayColourProvider colourProvider)
|
|
||||||
{
|
{
|
||||||
Colour = colourProvider.Foreground1;
|
base.OnHoverLost(e);
|
||||||
}
|
background.FadeColour(colourProvider.Background2, 200, Easing.OutQuint);
|
||||||
|
Icon.FadeColour(colourProvider.Foreground1, 200, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
{
|
||||||
|
Action?.Invoke();
|
||||||
|
return base.OnClick(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user