Exemple #1
0
        /// <summary>
        /// Searches for the specified music player with a matching name.
        /// </summary>
        /// <returns>
        /// A reference to a music player, if found. Null reference otherwise.
        /// </returns>
        /// <remarks>
        /// <para>If multiple banks have music players with a matching name, primary music bank will be checked first.
        /// Within a bank, the first occurrence of found music player will be used.</para>
        /// </remarks>
        public static MusicPlayer GetMusicPlayer(string name)
        {
            if (shutdown)
            {
                return(null);
            }

            // Check primary bank first
            MusicBank primaryBank = bankManager.PrimaryBank;

            if (primaryBank != null && primaryBank.ContainsAsset(name))
            {
                return(primaryBank.GetMusicPlayer(name));
            }

            // Check other banks
            for (int i = 0; i < bankManager.Banks.Count; i++)
            {
                MusicBank bank = bankManager.Banks[i];

                // Skip primary bank
                if (bank == primaryBank)
                {
                    continue;
                }

                if (bank.ContainsAsset(name))
                {
                    return(bank.GetMusicPlayer(name));
                }
            }

            return(null);
        }
Exemple #2
0
        /// <summary>
        /// Registers new music bank.
        /// </summary>
        /// <param name="bank">A reference to a music bank to register.</param>
        /// <returns>
        /// True, if music bank was succesfully registered. False otherwise.
        /// </returns>
        public static bool RegisterBank(MusicBank bank)
        {
            if (shutdown)
            {
                return(false);
            }

            return(bankManager.RegisterBank(bank));
        }
Exemple #3
0
 public void OnEnable()
 {
     bank = target as MusicBank;
 }
Exemple #4
0
 internal MusicPlayer(MusicBank bank_, string name_)
 {
     bank = bank_;
     name = name_;
 }
Exemple #5
0
 internal Playlist(MusicBank bank_, string name_)
 {
     bank = bank_;
     name = name_;
 }