Add Sound.DisableAllSounds property.
This commit is contained in:
@@ -111,7 +111,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
ISound Play(SoundType type, Player player, string name, bool headRelative, WPos pos, float volumeModifier = 1f, bool loop = false)
|
ISound Play(SoundType type, Player player, string name, bool headRelative, WPos pos, float volumeModifier = 1f, bool loop = false)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(name) || (DisableWorldSounds && type == SoundType.World))
|
if (string.IsNullOrEmpty(name) || DisableAllSounds || (DisableWorldSounds && type == SoundType.World))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (player != null && player != player.World.LocalPlayer)
|
if (player != null && player != player.World.LocalPlayer)
|
||||||
@@ -137,6 +137,7 @@ namespace OpenRA
|
|||||||
soundEngine.Volume = 1f;
|
soundEngine.Volume = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DisableAllSounds { get; set; }
|
||||||
public bool DisableWorldSounds { get; set; }
|
public bool DisableWorldSounds { get; set; }
|
||||||
public ISound Play(SoundType type, string name) { return Play(type, null, name, true, WPos.Zero, 1f); }
|
public ISound Play(SoundType type, string name) { return Play(type, null, name, true, WPos.Zero, 1f); }
|
||||||
public ISound Play(SoundType type, string name, WPos pos) { return Play(type, null, name, false, pos, 1f); }
|
public ISound Play(SoundType type, string name, WPos pos) { return Play(type, null, name, false, pos, 1f); }
|
||||||
@@ -350,7 +351,7 @@ namespace OpenRA
|
|||||||
if (ruleset == null)
|
if (ruleset == null)
|
||||||
throw new ArgumentNullException("ruleset");
|
throw new ArgumentNullException("ruleset");
|
||||||
|
|
||||||
if (definition == null || (DisableWorldSounds && soundType == SoundType.World))
|
if (definition == null || DisableAllSounds || (DisableWorldSounds && soundType == SoundType.World))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (ruleset.Voices == null || ruleset.Notifications == null)
|
if (ruleset.Voices == null || ruleset.Notifications == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user