mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Merge pull request #223 from peppy/more-sound-effects
Add various sound effects.
This commit is contained in:
commit
d05a1ea1c5
@ -1 +1 @@
|
||||
Subproject commit a3b2991157ec0bdeb0e73d10e7b845aa16715420
|
||||
Subproject commit 73ddad1f01f223c6c311f1302ed1658a2320813d
|
@ -1,6 +1,9 @@
|
||||
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
@ -26,6 +29,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
private static readonly Vector2 size_extended = new Vector2(140, 50);
|
||||
private static readonly Vector2 size_retracted = new Vector2(100, 50);
|
||||
private AudioSample sampleClick;
|
||||
|
||||
public BackButton()
|
||||
{
|
||||
@ -135,6 +139,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleClick = audio.Sample.Get(@"Menu/menuback");
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
var flash = new Box
|
||||
@ -148,6 +158,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
flash.FadeOutFromOne(200);
|
||||
flash.Expire();
|
||||
|
||||
sampleClick.Play();
|
||||
|
||||
return base.OnClick(state);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -60,6 +63,8 @@ namespace osu.Game.Overlays.Options
|
||||
|
||||
private Light light;
|
||||
private SpriteText labelSpriteText;
|
||||
private AudioSample sampleChecked;
|
||||
private AudioSample sampleUnchecked;
|
||||
|
||||
public CheckBoxOption()
|
||||
{
|
||||
@ -102,11 +107,19 @@ namespace osu.Game.Overlays.Options
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleChecked = audio.Sample.Get(@"Checkbox/check-on");
|
||||
sampleUnchecked = audio.Sample.Get(@"Checkbox/check-off");
|
||||
}
|
||||
|
||||
protected override void OnChecked()
|
||||
{
|
||||
if (bindable != null)
|
||||
bindable.Value = true;
|
||||
|
||||
sampleChecked?.Play();
|
||||
light.State = CheckBoxState.Checked;
|
||||
}
|
||||
|
||||
@ -115,6 +128,7 @@ namespace osu.Game.Overlays.Options
|
||||
if (bindable != null)
|
||||
bindable.Value = false;
|
||||
|
||||
sampleUnchecked?.Play();
|
||||
light.State = CheckBoxState.Unchecked;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,9 @@
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
@ -58,6 +61,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
private SpriteText tooltip1;
|
||||
private SpriteText tooltip2;
|
||||
protected FlowContainer Flow;
|
||||
private AudioSample sampleClick;
|
||||
|
||||
public ToolbarButton()
|
||||
{
|
||||
@ -120,6 +124,12 @@ namespace osu.Game.Overlays.Toolbar
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleClick = audio.Sample.Get(@"Menu/menuclick");
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
@ -133,6 +143,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
Action?.Invoke();
|
||||
sampleClick.Play();
|
||||
HoverBackground.FlashColour(new Color4(255, 255, 255, 100), 500, EasingTypes.OutQuint);
|
||||
return true;
|
||||
}
|
||||
|
@ -113,7 +113,9 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
Add(s);
|
||||
|
||||
s.FadeInFromZero(200);
|
||||
//todo: fix this... clock dependencies are a pain
|
||||
if (s.Clock != null)
|
||||
s.FadeInFromZero(200);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -28,6 +31,7 @@ namespace osu.Game.Screens.Menu
|
||||
private readonly float extraWidth;
|
||||
private Key triggerKey;
|
||||
private string text;
|
||||
private AudioSample sampleClick;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos)
|
||||
{
|
||||
@ -211,6 +215,14 @@ namespace osu.Game.Screens.Menu
|
||||
box.ScaleTo(new Vector2(1, 1), 500, EasingTypes.OutElastic);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleClick = audio.Sample.Get($@"Menu/menu-{internalName}-click");
|
||||
if (sampleClick == null)
|
||||
sampleClick = audio.Sample.Get(internalName.Contains(@"back") ? @"Menu/menuback" : @"Menu/menuhit");
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
trigger();
|
||||
@ -232,11 +244,9 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private void trigger()
|
||||
{
|
||||
//Game.Audio.PlaySamplePositional($@"menu-{internalName}-click", internalName.Contains(@"back") ? @"menuback" : @"menuhit");
|
||||
sampleClick.Play();
|
||||
|
||||
clickAction?.Invoke();
|
||||
|
||||
//box.FlashColour(ColourHelper.Lighten2(colour, 0.7f), 200);
|
||||
}
|
||||
|
||||
public override bool HandleInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f;
|
||||
@ -250,6 +260,7 @@ namespace osu.Game.Screens.Menu
|
||||
public int ContractStyle;
|
||||
|
||||
ButtonState state;
|
||||
|
||||
public ButtonState State
|
||||
{
|
||||
get { return state; }
|
||||
|
@ -5,6 +5,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -28,6 +31,8 @@ namespace osu.Game.Screens.Menu
|
||||
public Action OnChart;
|
||||
public Action OnTest;
|
||||
|
||||
private AudioSample sampleOsuClick;
|
||||
|
||||
private FlowContainerWithOrigin buttonFlow;
|
||||
|
||||
//todo: make these non-internal somehow.
|
||||
@ -111,6 +116,12 @@ namespace osu.Game.Screens.Menu
|
||||
buttonFlow.Add(buttonsTopLevel);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleOsuClick = audio.Sample.Get(@"Menu/menuhit");
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
@ -157,7 +168,7 @@ namespace osu.Game.Screens.Menu
|
||||
switch (state)
|
||||
{
|
||||
case MenuState.Initial:
|
||||
//Game.Audio.PlaySamplePositional(@"menuhit");
|
||||
sampleOsuClick.Play();
|
||||
State = MenuState.TopLevel;
|
||||
return;
|
||||
case MenuState.TopLevel:
|
||||
|
@ -24,6 +24,7 @@ using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
@ -45,6 +46,9 @@ namespace osu.Game.Screens.Select
|
||||
private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20);
|
||||
private CancellationTokenSource initialAddSetsTask;
|
||||
|
||||
private AudioSample sampleChangeDifficulty;
|
||||
private AudioSample sampleChangeBeatmap;
|
||||
|
||||
class WedgeBackground : Container
|
||||
{
|
||||
public WedgeBackground()
|
||||
@ -163,6 +167,9 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
trackManager = audio.Track;
|
||||
|
||||
sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
|
||||
sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand");
|
||||
|
||||
initialAddSetsTask = new CancellationTokenSource();
|
||||
|
||||
Task.Factory.StartNew(() => addBeatmapSets(game, initialAddSetsTask.Token), initialAddSetsTask.Token);
|
||||
@ -259,7 +266,14 @@ namespace osu.Game.Screens.Select
|
||||
private void selectionChanged(BeatmapGroup group, BeatmapInfo beatmap)
|
||||
{
|
||||
if (!beatmap.Equals(Beatmap?.BeatmapInfo))
|
||||
{
|
||||
if (beatmap.BeatmapSetID == Beatmap?.BeatmapInfo.BeatmapSetID)
|
||||
sampleChangeDifficulty.Play();
|
||||
else
|
||||
sampleChangeBeatmap.Play();
|
||||
|
||||
Beatmap = database.GetWorkingBeatmap(beatmap, Beatmap);
|
||||
}
|
||||
|
||||
ensurePlayingSelected();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user