Refactor common fmv playing code

This commit is contained in:
Paul Chote
2010-08-22 11:15:32 +12:00
parent 3f08f16b9b
commit f635835b1c
2 changed files with 54 additions and 43 deletions

View File

@@ -102,6 +102,7 @@ namespace OpenRA
soundEngine.StopSound(video);
}
public static bool MusicPlaying { get; private set; }
public static void PlayMusic(string name)
{
if (name == "" || name == null)
@@ -115,22 +116,35 @@ namespace OpenRA
StopMusic();
currentMusic = name;
MusicPlaying = true;
var sound = sounds[name];
music = soundEngine.Play2D(sound, true, true, float2.Zero, MusicVolume);
}
public static void PlayMusic()
{
if (music == null)
return;
MusicPlaying = true;
soundEngine.PauseSound(music, false);
}
public static void StopMusic()
{
if (music != null)
soundEngine.StopSound(music);
MusicPlaying = false;
currentMusic = null;
}
public static void PauseMusic()
{
if (music != null)
soundEngine.PauseSound(music, true);
if (music == null)
return;
MusicPlaying = false;
soundEngine.PauseSound(music, true);
}
public static float GlobalVolume