From 2c1589e068dcc0af8d40ece788ed248fed782c8a Mon Sep 17 00:00:00 2001
From: Salman Ahmed <frenzibyte@gmail.com>
Date: Thu, 10 Mar 2022 05:52:20 +0300
Subject: [PATCH] Add skinning support for "seeya" sample

---
 osu.Game/Screens/Menu/IntroScreen.cs | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index afe75c5ef7..65f9dde1f9 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -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.