1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-25 17:42:56 +08:00

Add skinning support for "seeya" sample

This commit is contained in:
Salman Ahmed 2022-03-10 05:52:20 +03:00
parent b8ee786d77
commit 2c1589e068

View File

@ -13,14 +13,17 @@ using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Framework.Utils;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.IO.Archives;
using osu.Game.Online.API;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets;
using osu.Game.Screens.Backgrounds;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
using Realms;
@ -55,7 +58,8 @@ namespace osu.Game.Screens.Menu
private const int exit_delay = 3000;
private Sample seeya;
private SkinnableSound skinnableSeeya;
private ISample seeya;
protected virtual string SeeyaSampleName => "Intro/seeya";
@ -90,14 +94,18 @@ namespace osu.Game.Screens.Menu
private BeatmapManager beatmaps { get; set; }
[BackgroundDependencyLoader]
private void load(OsuConfigManager config, Framework.Game game, RealmAccess realm)
private void load(OsuConfigManager config, Framework.Game game, RealmAccess realm, IAPIProvider api)
{
// prevent user from changing beatmap while the intro is still running.
beatmap = Beatmap.BeginLease(false);
MenuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
MenuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
seeya = audio.Samples.Get(SeeyaSampleName);
if (api.LocalUser.Value.IsSupporter)
AddInternal(skinnableSeeya = new SkinnableSound(new SampleInfo(SeeyaSampleName)));
else
seeya = audio.Samples.Get(SeeyaSampleName);
// if the user has requested not to play theme music, we should attempt to find a random beatmap from their collection.
if (!MenuMusic.Value)
@ -201,7 +209,14 @@ namespace osu.Game.Screens.Menu
// we also handle the exit transition.
if (MenuVoice.Value)
{
seeya.Play();
// ensure samples have been updated after resume before playing.
ScheduleAfterChildren(() =>
{
if (skinnableSeeya != null)
skinnableSeeya.Play();
else
seeya.Play();
});
// if playing the outro voice, we have more time to have fun with the background track.
// initially fade to almost silent then ramp out over the remaining time.