mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 04:22:55 +08:00
Add sound design for daily challenge intro animation
This commit is contained in:
parent
0cb3b6a1f8
commit
c6fa348d82
@ -138,7 +138,7 @@ namespace osu.Game.Screens.Menu
|
||||
});
|
||||
buttonsPlay.Add(new MainMenuButton(ButtonSystemStrings.Multi, @"button-default-select", OsuIcon.Online, new Color4(94, 63, 186, 255), onMultiplayer, Key.M));
|
||||
buttonsPlay.Add(new MainMenuButton(ButtonSystemStrings.Playlists, @"button-default-select", OsuIcon.Tournament, new Color4(94, 63, 186, 255), onPlaylists, Key.L));
|
||||
buttonsPlay.Add(new DailyChallengeButton(@"button-default-select", new Color4(94, 63, 186, 255), onDailyChallenge, Key.D));
|
||||
buttonsPlay.Add(new DailyChallengeButton(@"button-daily-select", new Color4(94, 63, 186, 255), onDailyChallenge, Key.D));
|
||||
buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play);
|
||||
|
||||
buttonsEdit.Add(new MainMenuButton(EditorStrings.BeatmapEditor.ToLower(), @"button-default-select", OsuIcon.Beatmap, new Color4(238, 170, 0, 255), _ => OnEditBeatmap?.Invoke(), Key.B, Key.E)
|
||||
|
@ -4,6 +4,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -68,6 +70,18 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||
[Resolved]
|
||||
private MusicController musicController { get; set; } = null!;
|
||||
|
||||
private Sample? dateWindupSample;
|
||||
private Sample? dateImpactSample;
|
||||
private Sample? beatmapWindupSample;
|
||||
private Sample? beatmapImpactSample;
|
||||
|
||||
private SampleChannel? dateWindupChannel;
|
||||
private SampleChannel? dateImpactChannel;
|
||||
private SampleChannel? beatmapWindupChannel;
|
||||
private SampleChannel? beatmapImpactChannel;
|
||||
|
||||
private IDisposable? duckOperation;
|
||||
|
||||
public DailyChallengeIntro(Room room)
|
||||
{
|
||||
this.room = room;
|
||||
@ -79,7 +93,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||
protected override BackgroundScreen CreateBackground() => new DailyChallengeIntroBackgroundScreen(colourProvider);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapDifficultyCache difficultyCache, BeatmapModelDownloader beatmapDownloader, OsuConfigManager config)
|
||||
private void load(BeatmapDifficultyCache difficultyCache, BeatmapModelDownloader beatmapDownloader, OsuConfigManager config, AudioManager audio)
|
||||
{
|
||||
const float horizontal_info_size = 500f;
|
||||
|
||||
@ -323,6 +337,11 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||
if (!beatmapManager.IsAvailableLocally(new BeatmapSetInfo { OnlineID = item.Beatmap.BeatmapSet!.OnlineID }))
|
||||
beatmapDownloader.Download(item.Beatmap.BeatmapSet!, config.Get<bool>(OsuSetting.PreferNoVideo));
|
||||
}
|
||||
|
||||
dateWindupSample = audio.Samples.Get(@"DailyChallenge/date-windup");
|
||||
dateImpactSample = audio.Samples.Get(@"DailyChallenge/date-impact");
|
||||
beatmapWindupSample = audio.Samples.Get(@"DailyChallenge/beatmap-windup");
|
||||
beatmapImpactSample = audio.Samples.Get(@"DailyChallenge/beatmap-impact");
|
||||
}
|
||||
|
||||
public override void OnEntering(ScreenTransitionEvent e)
|
||||
@ -338,6 +357,8 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||
|
||||
this.FadeInFromZero(400, Easing.OutQuint);
|
||||
updateAnimationState();
|
||||
|
||||
playDateWindupSample();
|
||||
}
|
||||
|
||||
public override void OnSuspending(ScreenTransitionEvent e)
|
||||
@ -346,6 +367,12 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||
base.OnSuspending(e);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
resetAudio();
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
|
||||
private void updateAnimationState()
|
||||
{
|
||||
if (!beatmapBackgroundLoaded || !this.IsCurrentScreen())
|
||||
@ -380,6 +407,29 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||
.Then()
|
||||
.MoveToY(0, 4000);
|
||||
|
||||
using (BeginDelayedSequence(150))
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
playDateImpactSample();
|
||||
playBeatmapWindupSample();
|
||||
|
||||
duckOperation?.Dispose();
|
||||
duckOperation = musicController.Duck(new DuckParameters
|
||||
{
|
||||
RestoreDuration = 1500f,
|
||||
});
|
||||
});
|
||||
|
||||
using (BeginDelayedSequence(2750))
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
duckOperation?.Dispose();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
using (BeginDelayedSequence(1000))
|
||||
{
|
||||
beatmapContent
|
||||
@ -406,6 +456,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||
shouldBePlayingMusic = true;
|
||||
DailyChallenge.TrySetDailyChallengeBeatmap(this, beatmapManager, rulesets, musicController, item);
|
||||
ApplyToBackground(bs => ((RoomBackgroundScreen)bs).SelectedItem.Value = item);
|
||||
playBeatmapImpactSample();
|
||||
});
|
||||
}
|
||||
|
||||
@ -425,6 +476,39 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||
}
|
||||
}
|
||||
|
||||
private void playDateWindupSample()
|
||||
{
|
||||
dateWindupChannel = dateWindupSample?.GetChannel();
|
||||
dateWindupChannel?.Play();
|
||||
}
|
||||
|
||||
private void playDateImpactSample()
|
||||
{
|
||||
dateImpactChannel = dateImpactSample?.GetChannel();
|
||||
dateImpactChannel?.Play();
|
||||
}
|
||||
|
||||
private void playBeatmapWindupSample()
|
||||
{
|
||||
beatmapWindupChannel = beatmapWindupSample?.GetChannel();
|
||||
beatmapWindupChannel?.Play();
|
||||
}
|
||||
|
||||
private void playBeatmapImpactSample()
|
||||
{
|
||||
beatmapImpactChannel = beatmapImpactSample?.GetChannel();
|
||||
beatmapImpactChannel?.Play();
|
||||
}
|
||||
|
||||
private void resetAudio()
|
||||
{
|
||||
dateWindupChannel?.Stop();
|
||||
dateImpactChannel?.Stop();
|
||||
beatmapWindupChannel?.Stop();
|
||||
beatmapImpactChannel?.Stop();
|
||||
duckOperation?.Dispose();
|
||||
}
|
||||
|
||||
private partial class DailyChallengeIntroBackgroundScreen : RoomBackgroundScreen
|
||||
{
|
||||
private readonly OverlayColourProvider colourProvider;
|
||||
|
Loading…
Reference in New Issue
Block a user