Unstatic the Sound class.

This commit is contained in:
Paul Chote
2015-09-05 18:31:21 +01:00
parent ff10fe3e07
commit ef55d646f7
82 changed files with 207 additions and 206 deletions

View File

@@ -203,7 +203,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
chatScrollPanel.ScrollToBottom(smooth: true);
if (!replayCache)
Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null);
Game.Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null);
}
}
}

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Action onQuit = () =>
{
if (world.Type == WorldType.Regular)
Sound.PlayNotification(world.Map.Rules, null, "Speech", "Leave", world.LocalPlayer == null ? null : world.LocalPlayer.Faction.InternalName);
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", "Leave", world.LocalPlayer == null ? null : world.LocalPlayer.Faction.InternalName);
leaving = true;

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
.Any(a => a.Actor.Owner == world.LocalPlayer && a.Trait.IsActive);
if (radarEnabled != cachedRadarEnabled)
Sound.PlayNotification(world.Map.Rules, null, "Sounds", radarEnabled ? "RadarUp" : "RadarDown", null);
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", radarEnabled ? "RadarUp" : "RadarDown", null);
cachedRadarEnabled = radarEnabled;
};

View File

@@ -653,7 +653,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (scrolledToBottom)
chatPanel.ScrollToBottom(smooth: true);
Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null);
Game.Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null);
}
bool SwitchTeamChat()

View File

@@ -213,18 +213,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
float cachedMusicVolume;
void MuteSounds()
{
cachedSoundVolume = Sound.SoundVolume;
cachedMusicVolume = Sound.MusicVolume;
Sound.SoundVolume = Sound.MusicVolume = 0;
cachedSoundVolume = Game.Sound.SoundVolume;
cachedMusicVolume = Game.Sound.MusicVolume;
Game.Sound.SoundVolume = Game.Sound.MusicVolume = 0;
}
void UnMuteSounds()
{
if (cachedSoundVolume > 0)
Sound.SoundVolume = cachedSoundVolume;
Game.Sound.SoundVolume = cachedSoundVolume;
if (cachedMusicVolume > 0)
Sound.MusicVolume = cachedMusicVolume;
Game.Sound.MusicVolume = cachedMusicVolume;
}
void PlayVideo(VqaPlayerWidget player, string video, PlayingVideo pv, Action onComplete)

View File

@@ -41,12 +41,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var playButton = panel.Get<ButtonWidget>("BUTTON_PLAY");
playButton.OnClick = Play;
playButton.IsDisabled = noMusic;
playButton.IsVisible = () => !Sound.MusicPlaying;
playButton.IsVisible = () => !Game.Sound.MusicPlaying;
var pauseButton = panel.Get<ButtonWidget>("BUTTON_PAUSE");
pauseButton.OnClick = Sound.PauseMusic;
pauseButton.OnClick = Game.Sound.PauseMusic;
pauseButton.IsDisabled = noMusic;
pauseButton.IsVisible = () => Sound.MusicPlaying;
pauseButton.IsVisible = () => Game.Sound.MusicPlaying;
var stopButton = panel.Get<ButtonWidget>("BUTTON_STOP");
stopButton.OnClick = () => { musicPlaylist.Stop(); };
@@ -75,8 +75,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (currentSong == null || musicPlaylist.CurrentSongIsBackground)
return "";
var minutes = (int)Sound.MusicSeekPosition / 60;
var seconds = (int)Sound.MusicSeekPosition % 60;
var minutes = (int)Game.Sound.MusicSeekPosition / 60;
var seconds = (int)Game.Sound.MusicSeekPosition % 60;
var totalMinutes = currentSong.Length / 60;
var totalSeconds = currentSong.Length % 60;
@@ -84,8 +84,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
};
var musicSlider = panel.Get<SliderWidget>("MUSIC_SLIDER");
musicSlider.OnChange += x => Sound.MusicVolume = x;
musicSlider.Value = Sound.MusicVolume;
musicSlider.OnChange += x => Game.Sound.MusicVolume = x;
musicSlider.Value = Game.Sound.MusicVolume;
var installButton = widget.GetOrNull<ButtonWidget>("INSTALL_BUTTON");
if (installButton != null)
@@ -108,10 +108,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (musicPlaylist.CurrentSongIsBackground && currentSong != null)
currentSong = null;
if (Sound.CurrentMusic == null || currentSong == Sound.CurrentMusic || musicPlaylist.CurrentSongIsBackground)
if (Game.Sound.CurrentMusic == null || currentSong == Game.Sound.CurrentMusic || musicPlaylist.CurrentSongIsBackground)
return;
currentSong = Sound.CurrentMusic;
currentSong = Game.Sound.CurrentMusic;
};
}

View File

@@ -307,11 +307,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
BindSliderPref(panel, "VIDEO_VOLUME", ss, "VideoVolume");
// Update volume immediately
panel.Get<SliderWidget>("SOUND_VOLUME").OnChange += x => Sound.SoundVolume = x;
panel.Get<SliderWidget>("MUSIC_VOLUME").OnChange += x => Sound.MusicVolume = x;
panel.Get<SliderWidget>("VIDEO_VOLUME").OnChange += x => Sound.VideoVolume = x;
panel.Get<SliderWidget>("SOUND_VOLUME").OnChange += x => Game.Sound.SoundVolume = x;
panel.Get<SliderWidget>("MUSIC_VOLUME").OnChange += x => Game.Sound.MusicVolume = x;
panel.Get<SliderWidget>("VIDEO_VOLUME").OnChange += x => Game.Sound.VideoVolume = x;
var devices = Sound.AvailableDevices();
var devices = Game.Sound.AvailableDevices();
soundDevice = devices.FirstOrDefault(d => d.Engine == ss.Engine && d.Device == ss.Device) ?? devices.First();
var audioDeviceDropdown = panel.Get<DropDownButtonWidget>("AUDIO_DEVICE");
@@ -339,12 +339,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ss.Engine = dss.Engine;
panel.Get<SliderWidget>("SOUND_VOLUME").Value = ss.SoundVolume;
Sound.SoundVolume = ss.SoundVolume;
Game.Sound.SoundVolume = ss.SoundVolume;
panel.Get<SliderWidget>("MUSIC_VOLUME").Value = ss.MusicVolume;
Sound.MusicVolume = ss.MusicVolume;
Game.Sound.MusicVolume = ss.MusicVolume;
panel.Get<SliderWidget>("VIDEO_VOLUME").Value = ss.VideoVolume;
Sound.VideoVolume = ss.VideoVolume;
soundDevice = Sound.AvailableDevices().First();
Game.Sound.VideoVolume = ss.VideoVolume;
soundDevice = Game.Sound.AvailableDevices().First();
};
}