mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 15:23:14 +08:00
Use GetAsync for all samples
This commit is contained in:
parent
1b279d383f
commit
e7a5816d27
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -37,15 +38,15 @@ namespace osu.Game.Graphics.Containers
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuGame osuGame, AudioManager audio, PreviewTrackManager previewTrackManager)
|
||||
private async Task load(OsuGame osuGame, AudioManager audio, PreviewTrackManager previewTrackManager)
|
||||
{
|
||||
this.previewTrackManager = previewTrackManager;
|
||||
|
||||
if (osuGame != null)
|
||||
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
|
||||
|
||||
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
|
||||
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
|
||||
samplePopIn = await audio.Sample.GetAsync(@"UI/overlay-pop-in");
|
||||
samplePopOut = await audio.Sample.GetAsync(@"UI/overlay-pop-out");
|
||||
|
||||
StateChanged += onStateChanged;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Graphics
|
||||
private SampleChannel shutter;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, OsuConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio)
|
||||
private async Task load(GameHost host, OsuConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio)
|
||||
{
|
||||
this.host = host;
|
||||
this.storage = storage.GetStorageForDirectory(@"screenshots");
|
||||
@ -51,7 +51,7 @@ namespace osu.Game.Graphics
|
||||
screenshotFormat = config.GetBindable<ScreenshotFormat>(OsuSetting.ScreenshotFormat);
|
||||
captureMenuCursor = config.GetBindable<bool>(OsuSetting.ScreenshotCaptureMenuCursor);
|
||||
|
||||
shutter = audio.Sample.Get("UI/shutter");
|
||||
shutter = await audio.Sample.GetAsync("UI/shutter");
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -28,9 +29,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
private async Task load(AudioManager audio)
|
||||
{
|
||||
sampleClick = audio.Sample.Get($@"UI/generic-select{SampleSet.GetDescription()}");
|
||||
sampleClick = await audio.Sample.GetAsync($@"UI/generic-select{SampleSet.GetDescription()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -35,9 +36,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
private async Task load(AudioManager audio)
|
||||
{
|
||||
sampleHover = audio.Sample.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
|
||||
sampleHover = await audio.Sample.GetAsync($@"UI/generic-hover{SampleSet.GetDescription()}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -110,10 +111,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
private async Task load(AudioManager audio)
|
||||
{
|
||||
sampleChecked = audio.Sample.Get(@"UI/check-on");
|
||||
sampleUnchecked = audio.Sample.Get(@"UI/check-off");
|
||||
sampleChecked = await audio.Sample.GetAsync(@"UI/check-on");
|
||||
sampleUnchecked = await audio.Sample.GetAsync(@"UI/check-off");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -69,10 +70,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
private async Task load(AudioManager audio)
|
||||
{
|
||||
sampleHover = audio.Sample.Get(@"UI/generic-hover");
|
||||
sampleClick = audio.Sample.Get(@"UI/generic-select");
|
||||
sampleHover = await audio.Sample.GetAsync(@"UI/generic-hover");
|
||||
sampleClick = await audio.Sample.GetAsync(@"UI/generic-select");
|
||||
|
||||
BackgroundColour = Color4.Transparent;
|
||||
BackgroundColourHover = OsuColour.FromHex(@"172023");
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
@ -119,9 +120,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
||||
private async Task load(AudioManager audio, OsuColour colours)
|
||||
{
|
||||
sample = audio.Sample.Get(@"UI/sliderbar-notch");
|
||||
sample = await audio.Sample.GetAsync(@"UI/sliderbar-notch");
|
||||
AccentColour = colours.Pink;
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ namespace osu.Game.Overlays
|
||||
[BackgroundDependencyLoader]
|
||||
private async Task load(OsuColour colours, TextureStore textures, AudioManager audio)
|
||||
{
|
||||
getSample = audio.Sample.Get(@"MedalSplash/medal-get");
|
||||
getSample = await audio.Sample.GetAsync(@"MedalSplash/medal-get");
|
||||
innerSpin.Texture = outerSpin.Texture = await textures.GetAsync(@"MedalSplash/disc-spin");
|
||||
|
||||
disc.EdgeEffect = leftStrip.EdgeEffect = rightStrip.EdgeEffect = new EdgeEffectParameters
|
||||
|
@ -15,6 +15,7 @@ using osu.Game.Rulesets.Mods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -49,7 +50,7 @@ namespace osu.Game.Overlays.Mods
|
||||
protected readonly IBindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuColour colours, IBindable<RulesetInfo> ruleset, AudioManager audio, Bindable<IEnumerable<Mod>> selectedMods)
|
||||
private async Task load(OsuColour colours, IBindable<RulesetInfo> ruleset, AudioManager audio, Bindable<IEnumerable<Mod>> selectedMods)
|
||||
{
|
||||
LowMultiplierColour = colours.Red;
|
||||
HighMultiplierColour = colours.Green;
|
||||
@ -58,8 +59,8 @@ namespace osu.Game.Overlays.Mods
|
||||
Ruleset.BindTo(ruleset);
|
||||
if (selectedMods != null) SelectedMods.BindTo(selectedMods);
|
||||
|
||||
sampleOn = audio.Sample.Get(@"UI/check-on");
|
||||
sampleOff = audio.Sample.Get(@"UI/check-off");
|
||||
sampleOn = await audio.Sample.GetAsync(@"UI/check-on");
|
||||
sampleOff = await audio.Sample.GetAsync(@"UI/check-off");
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -179,11 +180,11 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
private async Task load(AudioManager audio)
|
||||
{
|
||||
sampleHover = audio.Sample.Get(@"Menu/button-hover");
|
||||
sampleHover = await audio.Sample.GetAsync(@"Menu/button-hover");
|
||||
if (!string.IsNullOrEmpty(sampleName))
|
||||
sampleClick = audio.Sample.Get($@"Menu/{sampleName}");
|
||||
sampleClick = await audio.Sample.GetAsync($@"Menu/{sampleName}");
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -102,10 +103,10 @@ namespace osu.Game.Screens.Menu
|
||||
private OsuGame game;
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(AudioManager audio, OsuGame game)
|
||||
private async Task load(AudioManager audio, OsuGame game)
|
||||
{
|
||||
this.game = game;
|
||||
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
|
||||
sampleBack = await audio.Sample.GetAsync(@"Menu/button-back-select");
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -47,7 +48,7 @@ namespace osu.Game.Screens.Menu
|
||||
private WorkingBeatmap introBeatmap;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap)
|
||||
private async Task load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap)
|
||||
{
|
||||
this.beatmap.BindTo(beatmap);
|
||||
|
||||
@ -80,8 +81,8 @@ namespace osu.Game.Screens.Menu
|
||||
introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
||||
track = introBeatmap.Track;
|
||||
|
||||
welcome = audio.Sample.Get(@"welcome");
|
||||
seeya = audio.Sample.Get(@"seeya");
|
||||
welcome = await audio.Sample.GetAsync(@"welcome");
|
||||
seeya = await audio.Sample.GetAsync(@"seeya");
|
||||
}
|
||||
|
||||
private const double delay_step_one = 2300;
|
||||
|
@ -256,8 +256,8 @@ namespace osu.Game.Screens.Menu
|
||||
[BackgroundDependencyLoader]
|
||||
private async Task load(TextureStore textures, AudioManager audio)
|
||||
{
|
||||
sampleClick = audio.Sample.Get(@"Menu/osu-logo-select");
|
||||
sampleBeat = audio.Sample.Get(@"Menu/osu-logo-heartbeat");
|
||||
sampleClick = await audio.Sample.GetAsync(@"Menu/osu-logo-select");
|
||||
sampleBeat = await audio.Sample.GetAsync(@"Menu/osu-logo-heartbeat");
|
||||
|
||||
logo.Texture = await textures.GetAsync(@"Menu/logo");
|
||||
ripple.Texture = await textures.GetAsync(@"Menu/logo");
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -80,7 +81,7 @@ namespace osu.Game.Screens
|
||||
private SampleChannel sampleExit;
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable<RulesetInfo> ruleset)
|
||||
private async Task load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable<RulesetInfo> ruleset)
|
||||
{
|
||||
Beatmap.BindTo(beatmap);
|
||||
Ruleset.BindTo(ruleset);
|
||||
@ -98,7 +99,7 @@ namespace osu.Game.Screens
|
||||
};
|
||||
}
|
||||
|
||||
sampleExit = audio.Sample.Get(@"UI/screen-back");
|
||||
sampleExit = await audio.Sample.GetAsync(@"UI/screen-back");
|
||||
}
|
||||
|
||||
public virtual bool OnPressed(GlobalAction action)
|
||||
|
@ -84,7 +84,7 @@ namespace osu.Game.Screens.Play
|
||||
public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, APIAccess api, OsuConfigManager config)
|
||||
private async Task load(AudioManager audio, APIAccess api, OsuConfigManager config)
|
||||
{
|
||||
this.api = api;
|
||||
|
||||
@ -92,7 +92,7 @@ namespace osu.Game.Screens.Play
|
||||
if (working is DummyWorkingBeatmap)
|
||||
return;
|
||||
|
||||
sampleRestart = audio.Sample.Get(@"Gameplay/restart");
|
||||
sampleRestart = await audio.Sample.GetAsync(@"Gameplay/restart");
|
||||
|
||||
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
||||
userAudioOffset = config.GetBindable<double>(OsuSetting.AudioOffset);
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -224,12 +225,12 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, AudioManager audio)
|
||||
private async Task load(OsuColour colours, AudioManager audio)
|
||||
{
|
||||
colourNormal = colours.Yellow;
|
||||
colourHover = colours.YellowDark;
|
||||
|
||||
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
|
||||
sampleConfirm = await audio.Sample.GetAsync(@"SongSelect/confirm-selection");
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -45,7 +46,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
private SampleChannel sampleHover;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
||||
private async Task load(AudioManager audio, OsuColour colours)
|
||||
{
|
||||
InternalChild = borderContainer = new Container
|
||||
{
|
||||
@ -68,7 +69,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
}
|
||||
};
|
||||
|
||||
sampleHover = audio.Sample.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}");
|
||||
sampleHover = await audio.Sample.GetAsync($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}");
|
||||
hoverLayer.Colour = colours.Blue.Opacity(0.1f);
|
||||
}
|
||||
|
||||
|
@ -55,11 +55,11 @@ namespace osu.Game.Screens.Select
|
||||
private readonly Bindable<IEnumerable<Mod>> selectedMods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, Bindable<IEnumerable<Mod>> selectedMods)
|
||||
private async Task load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, Bindable<IEnumerable<Mod>> selectedMods)
|
||||
{
|
||||
if (selectedMods != null) this.selectedMods.BindTo(selectedMods);
|
||||
|
||||
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
|
||||
sampleConfirm = await audio.Sample.GetAsync(@"SongSelect/confirm-selection");
|
||||
|
||||
Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue);
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
@ -198,7 +199,7 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours)
|
||||
private async Task load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours)
|
||||
{
|
||||
if (Footer != null)
|
||||
{
|
||||
@ -218,8 +219,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
dialogOverlay = dialog;
|
||||
|
||||
sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
|
||||
sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand");
|
||||
sampleChangeDifficulty = await audio.Sample.GetAsync(@"SongSelect/select-difficulty");
|
||||
sampleChangeBeatmap = await audio.Sample.GetAsync(@"SongSelect/select-expand");
|
||||
|
||||
Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSetsEnumerable();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user