Пример #1
0
 internal static void ResizeAndFillArrays()
 {
     customSounds         = new SoundEffect[nextSound[SoundType.Custom]];
     customSoundInstances = new SoundEffectInstance[nextSound[SoundType.Custom]];
     Array.Resize(ref Main.soundItem, nextSound[SoundType.Item]);
     Array.Resize(ref Main.soundInstanceItem, nextSound[SoundType.Item]);
     Array.Resize(ref Main.soundNPCHit, nextSound[SoundType.NPCHit]);
     Array.Resize(ref Main.soundInstanceNPCHit, nextSound[SoundType.NPCHit]);
     Array.Resize(ref Main.soundNPCKilled, nextSound[SoundType.NPCKilled]);
     Array.Resize(ref Main.soundInstanceNPCKilled, nextSound[SoundType.NPCKilled]);
     Array.Resize(ref Main.music, nextSound[SoundType.Music]);
     Array.Resize(ref Main.musicFade, nextSound[SoundType.Music]);
     foreach (SoundType type in Enum.GetValues(typeof(SoundType)))
     {
         foreach (string sound in sounds[type].Keys)
         {
             int slot = GetSoundSlot(type, sound);
             if (type != SoundType.Music)
             {
                 GetSoundArray(type)[slot]         = ModLoader.GetSound(sound);
                 GetSoundInstanceArray(type)[slot] = GetSoundArray(type)[slot]?.CreateInstance() ?? null;
             }
             else
             {
                 Main.music[slot] = ModLoader.GetMusic(sound) ?? null;
             }
         }
     }
 }