mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 09:27:18 +09:00
Channel list item hover effect
This commit is contained in:
parent
d8e86da78c
commit
2ba86cffa6
@ -7,6 +7,7 @@ using OpenTK.Graphics;
|
|||||||
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.Input;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
@ -22,11 +23,13 @@ namespace osu.Game.Overlays.Chat
|
|||||||
|
|
||||||
private readonly Channel channel;
|
private readonly Channel channel;
|
||||||
|
|
||||||
|
private readonly OsuSpriteText name;
|
||||||
private readonly OsuSpriteText topic;
|
private readonly OsuSpriteText topic;
|
||||||
private readonly TextAwesome joinedCheckmark;
|
private readonly TextAwesome joinedCheckmark;
|
||||||
|
|
||||||
private Color4? joinedColour;
|
private Color4? joinedColour;
|
||||||
private Color4? topicColour;
|
private Color4? topicColour;
|
||||||
|
private Color4 hoverColour;
|
||||||
|
|
||||||
public string[] FilterTerms => new[] { channel.Name };
|
public string[] FilterTerms => new[] { channel.Name };
|
||||||
public bool MatchingCurrentFilter
|
public bool MatchingCurrentFilter
|
||||||
@ -80,7 +83,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
name = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = channel.ToString(),
|
Text = channel.ToString(),
|
||||||
TextSize = text_size,
|
TextSize = text_size,
|
||||||
@ -143,10 +146,25 @@ namespace osu.Game.Overlays.Chat
|
|||||||
{
|
{
|
||||||
topicColour = colours.Gray9;
|
topicColour = colours.Gray9;
|
||||||
joinedColour = colours.Blue;
|
joinedColour = colours.Blue;
|
||||||
|
hoverColour = colours.Yellow;
|
||||||
|
|
||||||
updateColour(channel.Joined);
|
updateColour(channel.Joined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state)
|
||||||
|
{
|
||||||
|
if (!channel.Joined.Value)
|
||||||
|
name.FadeColour(hoverColour, transition_duration);
|
||||||
|
|
||||||
|
return base.OnHover(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(InputState state)
|
||||||
|
{
|
||||||
|
if (!channel.Joined.Value)
|
||||||
|
name.FadeColour(Color4.White, transition_duration);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
if(channel != null) channel.Joined.ValueChanged -= updateColour;
|
if(channel != null) channel.Joined.ValueChanged -= updateColour;
|
||||||
@ -157,6 +175,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
{
|
{
|
||||||
if (joined)
|
if (joined)
|
||||||
{
|
{
|
||||||
|
name.FadeColour(Color4.White, transition_duration);
|
||||||
joinedCheckmark.FadeTo(1f, transition_duration);
|
joinedCheckmark.FadeTo(1f, transition_duration);
|
||||||
topic.FadeTo(0.8f, transition_duration);
|
topic.FadeTo(0.8f, transition_duration);
|
||||||
topic.FadeColour(Color4.White, transition_duration);
|
topic.FadeColour(Color4.White, transition_duration);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user