public MainWindow() { // Creates the window. InitializeComponent(); // Plays the background music when the window is launched. Bgm.Play(); }
private void BtnClosePlay_Click(object sender, EventArgs e) { countClose++; if ((countClose % 2) != 0) { Bgm.Close(); } else { Bgm.Play(); } }
private void BtnBgmPause_Click(object sender, EventArgs e) { countPause++; if ((countPause % 2) != 0) { Bgm.Pause(); } else { Bgm.Play(); } }
private void PlayBgm() { Bgm.BgmPath = BgmPath; Bgm.Play(); }
void OnDestroy() { EnemySpawner.Activate(); Bgm.Play(); Wall.Activate(); }
/// <summary> /// 播放 背景音乐 /// </summary> /// <param name="path">Sound.wz中路径</param> /// <param name="looping">是否循环</param> public void Play(string path, bool looping = true) { _bgm.Play(path, looping); }
/* * This Event starts the BGM over when it finishes playing, causing it to loop. */ private void Bgm_MediaEnded(object sender, RoutedEventArgs e) { Bgm.Position = TimeSpan.Zero; Bgm.Play(); }
public void Play() { bgm.Play(); }