mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 11:02:54 +08:00
Add hover+select sounds to some components that are missing them
This commit is contained in:
parent
7dc1de7423
commit
9b7bb37244
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -59,33 +60,37 @@ namespace osu.Game.Graphics.Containers
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
InternalChild = new GridContainer
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
new GridContainer
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Content = new[]
|
|
||||||
{
|
{
|
||||||
new[]
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Content = new[]
|
||||||
{
|
{
|
||||||
handleContainer = new Container
|
new[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
handleContainer = new Container
|
||||||
Origin = Anchor.Centre,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Padding = new MarginPadding { Horizontal = 5 },
|
|
||||||
Child = handle = new PlaylistItemHandle
|
|
||||||
{
|
{
|
||||||
Size = new Vector2(12),
|
Anchor = Anchor.Centre,
|
||||||
Colour = HandleColour,
|
Origin = Anchor.Centre,
|
||||||
AlwaysPresent = true,
|
AutoSizeAxes = Axes.Both,
|
||||||
Alpha = 0
|
Padding = new MarginPadding { Horizontal = 5 },
|
||||||
}
|
Child = handle = new PlaylistItemHandle
|
||||||
},
|
{
|
||||||
CreateContent()
|
Size = new Vector2(12),
|
||||||
}
|
Colour = HandleColour,
|
||||||
|
AlwaysPresent = true,
|
||||||
|
Alpha = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
CreateContent()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize) },
|
||||||
|
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }
|
||||||
},
|
},
|
||||||
ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize) },
|
new HoverClickSounds()
|
||||||
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,14 +23,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost host { get; set; }
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
|
private readonly SpriteIcon linkIcon;
|
||||||
|
|
||||||
public ExternalLinkButton(string link = null)
|
public ExternalLinkButton(string link = null)
|
||||||
{
|
{
|
||||||
Link = link;
|
Link = link;
|
||||||
Size = new Vector2(12);
|
Size = new Vector2(12);
|
||||||
InternalChild = new SpriteIcon
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.Solid.ExternalLinkAlt,
|
linkIcon = new SpriteIcon
|
||||||
RelativeSizeAxes = Axes.Both
|
{
|
||||||
|
Icon = FontAwesome.Solid.ExternalLinkAlt,
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
},
|
||||||
|
new HoverClickSounds(HoverSampleSet.Submit)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,13 +48,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
InternalChild.FadeColour(hoverColour, 500, Easing.OutQuint);
|
linkIcon.FadeColour(hoverColour, 500, Easing.OutQuint);
|
||||||
return base.OnHover(e);
|
return base.OnHover(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
InternalChild.FadeColour(Color4.White, 500, Easing.OutQuint);
|
linkIcon.FadeColour(Color4.White, 500, Easing.OutQuint);
|
||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -13,6 +16,7 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -39,6 +43,8 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
|
private Sample sampleTabSwitched;
|
||||||
|
|
||||||
public ChannelTabItem(Channel value)
|
public ChannelTabItem(Channel value)
|
||||||
: base(value)
|
: base(value)
|
||||||
{
|
{
|
||||||
@ -112,6 +118,7 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
new HoverSounds()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,11 +159,12 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours, AudioManager audio)
|
||||||
{
|
{
|
||||||
BackgroundActive = colours.ChatBlue;
|
BackgroundActive = colours.ChatBlue;
|
||||||
BackgroundInactive = colours.Gray4;
|
BackgroundInactive = colours.Gray4;
|
||||||
backgroundHover = colours.Gray7;
|
backgroundHover = colours.Gray7;
|
||||||
|
sampleTabSwitched = audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-select");
|
||||||
|
|
||||||
highlightBox.Colour = colours.Yellow;
|
highlightBox.Colour = colours.Yellow;
|
||||||
}
|
}
|
||||||
@ -217,7 +225,14 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
Text.Font = Text.Font.With(weight: FontWeight.Medium);
|
Text.Font = Text.Font.With(weight: FontWeight.Medium);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnActivated() => updateState();
|
protected override void OnActivated()
|
||||||
|
{
|
||||||
|
if (IsLoaded)
|
||||||
|
sampleTabSwitched?.Play();
|
||||||
|
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnDeactivated() => updateState();
|
protected override void OnDeactivated() => updateState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
if (value.Type != ChannelType.PM)
|
if (value.Type != ChannelType.PM)
|
||||||
throw new ArgumentException("Argument value needs to have the targettype user!");
|
throw new ArgumentException("Argument value needs to have the targettype user!");
|
||||||
|
|
||||||
ClickableAvatar avatar;
|
DrawableAvatar avatar;
|
||||||
|
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
@ -48,10 +48,9 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Child = new DelayedLoadWrapper(avatar = new ClickableAvatar(value.Users.First())
|
Child = new DelayedLoadWrapper(avatar = new DrawableAvatar(value.Users.First())
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both
|
||||||
OpenOnClick = false,
|
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
@ -138,7 +138,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
new HoverClickSounds()
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var b in bindings)
|
foreach (var b in bindings)
|
||||||
@ -458,6 +459,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Text = keyBinding.KeyCombination.ReadableString(),
|
Text = keyBinding.KeyCombination.ReadableString(),
|
||||||
},
|
},
|
||||||
|
new HoverSounds()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ 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.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Users.Drawables
|
namespace osu.Game.Users.Drawables
|
||||||
@ -32,9 +33,17 @@ namespace osu.Game.Users.Drawables
|
|||||||
if (country == null && !ShowPlaceholderOnNull)
|
if (country == null && !ShowPlaceholderOnNull)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return new DrawableFlag(country)
|
return new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new DrawableFlag(country)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
},
|
||||||
|
new HoverClickSounds(HoverSampleSet.Submit)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user