コード例 #1
0
        /// <summary>
        /// Gets the music with the specified name. The name is in the same format as for texture names. Throws an ArgumentException if the music does not exist. Note: SoundMP3 is in the Terraria.ModLoader namespace.
        /// </summary>
        /// <exception cref="MissingResourceException">Missing mod: " + name</exception>
        public static Music GetMusic(string name)
        {
            if (Main.dedServ)
            {
                return(null);
            }
            SplitName(name, out string modName, out string subName);
            Mod mod = ModLoader.GetMod(modName);

            if (mod == null)
            {
                throw new MissingResourceException("Missing mod: " + name);
            }
            return(mod.GetMusic(subName));
        }