Move welcome to local usages

This commit is contained in:
Dean Herbert 2019-10-08 12:07:59 +09:00
parent 4ba2dccde3
commit b8b2ff2674
3 changed files with 10 additions and 6 deletions

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Screens;
using osu.Framework.Graphics;
@ -17,11 +18,13 @@ public class IntroCircles : IntroScreen
private const double delay_step_one = 2300;
private const double delay_step_two = 600;
private SampleChannel welcome;
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
if (MenuVoice.Value)
Welcome = audio.Samples.Get(@"welcome");
welcome = audio.Samples.Get(@"welcome");
}
protected override void LogoArriving(OsuLogo logo, bool resuming)
@ -30,7 +33,7 @@ protected override void LogoArriving(OsuLogo logo, bool resuming)
if (!resuming)
{
Welcome?.Play();
welcome?.Play();
Scheduler.AddDelayed(delegate
{

View File

@ -37,8 +37,6 @@ public abstract class IntroScreen : StartupScreen
/// </summary>
protected abstract string BeatmapFile { get; }
protected SampleChannel Welcome;
protected Bindable<bool> MenuVoice;
protected Bindable<bool> MenuMusic;

View File

@ -6,6 +6,7 @@
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Screens;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -40,11 +41,13 @@ public class IntroTriangles : IntroScreen
private BackgroundScreenDefault background;
private SampleChannel welcome;
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
if (MenuVoice.Value && !MenuMusic.Value)
Welcome = audio.Samples.Get(@"welcome");
welcome = audio.Samples.Get(@"welcome");
}
protected override void LogoArriving(OsuLogo logo, bool resuming)
@ -65,7 +68,7 @@ protected override void LogoArriving(OsuLogo logo, bool resuming)
}, t =>
{
AddInternal(t);
Welcome?.Play();
welcome?.Play();
StartTrack();
});