mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 17:03:02 +08:00
Merge pull request #13454 from nekodex/change-default-hover-click-sample
Change default HoverSounds/HoverClickSounds samples
This commit is contained in:
commit
c2759121b9
@ -51,7 +51,7 @@
|
|||||||
<Reference Include="Java.Interop" />
|
<Reference Include="Java.Interop" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.604.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.611.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.609.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.609.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected virtual HoverClickSounds CreateHoverClickSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet);
|
protected virtual HoverClickSounds CreateHoverClickSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet);
|
||||||
|
|
||||||
public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Default)
|
||||||
{
|
{
|
||||||
this.sampleSet = sampleSet;
|
this.sampleSet = sampleSet;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
|
||||||
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;
|
||||||
@ -23,9 +22,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private const int text_size = 17;
|
private const int text_size = 17;
|
||||||
private const int transition_length = 80;
|
private const int transition_length = 80;
|
||||||
|
|
||||||
private Sample sampleClick;
|
|
||||||
private Sample sampleHover;
|
|
||||||
|
|
||||||
private TextContainer text;
|
private TextContainer text;
|
||||||
|
|
||||||
public DrawableOsuMenuItem(MenuItem item)
|
public DrawableOsuMenuItem(MenuItem item)
|
||||||
@ -36,12 +32,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
sampleHover = audio.Samples.Get(@"UI/generic-hover");
|
|
||||||
sampleClick = audio.Samples.Get(@"UI/generic-select");
|
|
||||||
|
|
||||||
BackgroundColour = Color4.Transparent;
|
BackgroundColour = Color4.Transparent;
|
||||||
BackgroundColourHover = Color4Extensions.FromHex(@"172023");
|
BackgroundColourHover = Color4Extensions.FromHex(@"172023");
|
||||||
|
|
||||||
|
AddInternal(new HoverClickSounds());
|
||||||
|
|
||||||
updateTextColour();
|
updateTextColour();
|
||||||
|
|
||||||
Item.Action.BindDisabledChanged(_ => updateState(), true);
|
Item.Action.BindDisabledChanged(_ => updateState(), true);
|
||||||
@ -84,7 +79,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
if (IsHovered && !Item.Action.Disabled)
|
if (IsHovered && !Item.Action.Disabled)
|
||||||
{
|
{
|
||||||
sampleHover.Play();
|
|
||||||
text.BoldText.FadeIn(transition_length, Easing.OutQuint);
|
text.BoldText.FadeIn(transition_length, Easing.OutQuint);
|
||||||
text.NormalText.FadeOut(transition_length, Easing.OutQuint);
|
text.NormalText.FadeOut(transition_length, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
@ -95,12 +89,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
|
||||||
{
|
|
||||||
sampleClick.Play();
|
|
||||||
return base.OnClick(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected sealed override Drawable CreateContent() => text = CreateTextContainer();
|
protected sealed override Drawable CreateContent() => text = CreateTextContainer();
|
||||||
protected virtual TextContainer CreateTextContainer() => new TextContainer();
|
protected virtual TextContainer CreateTextContainer() => new TextContainer();
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// Array of button codes which should trigger the click sound.
|
/// Array of button codes which should trigger the click sound.
|
||||||
/// If this optional parameter is omitted or set to <code>null</code>, the click sound will only be played on left click.
|
/// If this optional parameter is omitted or set to <code>null</code>, the click sound will only be played on left click.
|
||||||
/// </param>
|
/// </param>
|
||||||
public HoverClickSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal, MouseButton[] buttons = null)
|
public HoverClickSounds(HoverSampleSet sampleSet = HoverSampleSet.Default, MouseButton[] buttons = null)
|
||||||
: base(sampleSet)
|
: base(sampleSet)
|
||||||
{
|
{
|
||||||
this.buttons = buttons ?? new[] { MouseButton.Left };
|
this.buttons = buttons ?? new[] { MouseButton.Left };
|
||||||
@ -45,7 +45,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
sampleClick = audio.Samples.Get($@"UI/generic-select{SampleSet.GetDescription()}");
|
sampleClick = audio.Samples.Get($@"UI/{SampleSet.GetDescription()}-select")
|
||||||
|
?? audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-select");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
25
osu.Game/Graphics/UserInterface/HoverSampleSet.cs
Normal file
25
osu.Game/Graphics/UserInterface/HoverSampleSet.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// 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 System.ComponentModel;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
public enum HoverSampleSet
|
||||||
|
{
|
||||||
|
[Description("default")]
|
||||||
|
Default,
|
||||||
|
|
||||||
|
[Description("button")]
|
||||||
|
Button,
|
||||||
|
|
||||||
|
[Description("softer")]
|
||||||
|
Soft,
|
||||||
|
|
||||||
|
[Description("toolbar")]
|
||||||
|
Toolbar,
|
||||||
|
|
||||||
|
[Description("songselect")]
|
||||||
|
SongSelect
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
// 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.ComponentModel;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
@ -22,7 +21,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected readonly HoverSampleSet SampleSet;
|
protected readonly HoverSampleSet SampleSet;
|
||||||
|
|
||||||
public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Default)
|
||||||
{
|
{
|
||||||
SampleSet = sampleSet;
|
SampleSet = sampleSet;
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
@ -31,7 +30,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, SessionStatics statics)
|
private void load(AudioManager audio, SessionStatics statics)
|
||||||
{
|
{
|
||||||
sampleHover = audio.Samples.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
|
sampleHover = audio.Samples.Get($@"UI/{SampleSet.GetDescription()}-hover")
|
||||||
|
?? audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-hover");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PlayHoverSample()
|
public override void PlayHoverSample()
|
||||||
@ -40,22 +40,4 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
sampleHover.Play();
|
sampleHover.Play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum HoverSampleSet
|
|
||||||
{
|
|
||||||
[Description("")]
|
|
||||||
Loud,
|
|
||||||
|
|
||||||
[Description("-soft")]
|
|
||||||
Normal,
|
|
||||||
|
|
||||||
[Description("-softer")]
|
|
||||||
Soft,
|
|
||||||
|
|
||||||
[Description("-toolbar")]
|
|
||||||
Toolbar,
|
|
||||||
|
|
||||||
[Description("-songselect")]
|
|
||||||
SongSelect
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private readonly Box hover;
|
private readonly Box hover;
|
||||||
|
|
||||||
public OsuAnimatedButton()
|
public OsuAnimatedButton()
|
||||||
|
: base(HoverSampleSet.Button)
|
||||||
{
|
{
|
||||||
base.Content.Add(content = new Container
|
base.Content.Add(content = new Container
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
protected Box Background;
|
protected Box Background;
|
||||||
protected SpriteText SpriteText;
|
protected SpriteText SpriteText;
|
||||||
|
|
||||||
public OsuButton(HoverSampleSet? hoverSounds = HoverSampleSet.Loud)
|
public OsuButton(HoverSampleSet? hoverSounds = HoverSampleSet.Button)
|
||||||
{
|
{
|
||||||
Height = 40;
|
Height = 40;
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ using System.Threading.Tasks;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
@ -25,8 +24,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public readonly Bindable<APIChangelogBuild> Current = new Bindable<APIChangelogBuild>();
|
public readonly Bindable<APIChangelogBuild> Current = new Bindable<APIChangelogBuild>();
|
||||||
|
|
||||||
private Sample sampleBack;
|
|
||||||
|
|
||||||
private List<APIChangelogBuild> builds;
|
private List<APIChangelogBuild> builds;
|
||||||
|
|
||||||
protected List<APIUpdateStream> Streams;
|
protected List<APIUpdateStream> Streams;
|
||||||
@ -41,8 +38,6 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Header.Build.BindTarget = Current;
|
Header.Build.BindTarget = Current;
|
||||||
|
|
||||||
sampleBack = audio.Samples.Get(@"UI/generic-select-soft");
|
|
||||||
|
|
||||||
Current.BindValueChanged(e =>
|
Current.BindValueChanged(e =>
|
||||||
{
|
{
|
||||||
if (e.NewValue != null)
|
if (e.NewValue != null)
|
||||||
@ -108,7 +103,6 @@ namespace osu.Game.Overlays
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Current.Value = null;
|
Current.Value = null;
|
||||||
sampleBack?.Play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.609.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.609.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.604.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.611.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.4.0" />
|
<PackageReference Include="Sentry" Version="3.4.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.609.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.609.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.604.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.611.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user