C# text adventure - звуковые проблемы в меню
Hello I have to write a text adventure for school in C# in visual studio 2015. I have made a little starting menu with some options. While the menu is displayed some background music is playing. When you choose an option from the menu a little sound is played but it stops the background music from playing. I basically want to play multiple sounds at the same time. Any help would be appreciated.
Что я уже пробовал:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Threading; using System.Media; namespace Text_Adventure2 { class Program { static string Playername = ""; static string CorrectIntro = ""; static ConsoleColor TextColor = ConsoleColor.White; private static SoundPlayer IntroMusic; private static SoundPlayer MenuSelector; public static void Main(string[] args) { MenuSelector = new System.Media.SoundPlayer(); MenuSelector.SoundLocation = @"C:\Users\stijn\Desktop\School\Programmeren\Periode 1\Text Adventure\Sounds\MenuSelector.wav"; Menu(); } private static void Menu() { IntroMusic = new System.Media.SoundPlayer(); IntroMusic.SoundLocation = @"C:\Users\stijn\Desktop\School\Programmeren\Periode 1\Text Adventure\Sounds\IntroMusic.wav"; IntroMusic.Play(); Console.ForegroundColor = TextColor; Zin("The story of Benedict Henderson"); Enter('\n'); Enter('\n'); Zin("[1] Start"); Enter('\n'); Zin("[2] Options"); Enter('\n'); Zin("[3] Credits"); Enter('\n'); Zin("[4] Quit"); Enter('\n'); ConsoleKeyInfo MenuSelector = Console.ReadKey(true); switch (MenuSelector.Key) { case ConsoleKey.D1: Intro(); break; case ConsoleKey.D2: Options(); break; case ConsoleKey.D3: Credits(); break; case ConsoleKey.D4: Quit(); break; } Console.ReadKey(); } //Quit function private static void Quit() { MenuSelector.Play(); Environment.Exit(0); } //Credits function private static void Credits() { MenuSelector.Play(); Console.Clear(); Zin("This game is made and designed by Stijn van der Neut"); Enter('\n'); Enter('\n'); Zin("Press enter to return to the menu"); ConsoleKeyInfo ReturnToMenu = Console.ReadKey(true); if (ReturnToMenu.Key == ConsoleKey.Enter) { Console.Clear(); Menu(); } } //Option function private static void Options() { MenuSelector.Play(); Console.Clear(); Zin("Please select the desired text color"); Enter('\n'); Enter('\n'); Zin("[1] White"); Enter('\n'); Zin("[2] Red"); Enter('\n'); Zin("[3] Blue"); Enter('\n'); Zin("[4] Green"); Enter('\n'); Zin("[5] Magenta"); Enter('\n'); Zin("[6] Cyan"); Enter('\n'); Enter('\n'); Zin("Press enter to return to the menu"); ConsoleKeyInfo ColorSelector = Console.ReadKey(true); //Get player input for ColorSelector switch (ColorSelector.Key) { case ConsoleKey.D1: MenuSelector.Play(); TextColor = ConsoleColor.White; break; case ConsoleKey.D2: MenuSelector.Play(); TextColor = ConsoleColor.Red; break; case ConsoleKey.D3: MenuSelector.Play(); TextColor = ConsoleColor.Blue; break; case ConsoleKey.D4: MenuSelector.Play(); TextColor = ConsoleColor.Green; break; case ConsoleKey.D5: MenuSelector.Play(); TextColor = ConsoleColor.Magenta; break; case ConsoleKey.D6: MenuSelector.Play(); TextColor = ConsoleColor.Cyan; break; case ConsoleKey.Enter: MenuSelector.Play(); Console.Clear(); Menu(); break; default: TextColor = ConsoleColor.Black; break; } Console.ForegroundColor = TextColor; Console.Clear(); Menu(); }