Unstatic the Sound class.
This commit is contained in:
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
if (!playedSound && helicopter.Info.TakeoffSound != null && self.IsAtGroundLevel())
|
||||
{
|
||||
Sound.Play(helicopter.Info.TakeoffSound);
|
||||
Game.Sound.Play(helicopter.Info.TakeoffSound);
|
||||
playedSound = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
if (!playedSound && helicopter.Info.LandingSound != null && !self.IsAtGroundLevel())
|
||||
{
|
||||
Sound.Play(helicopter.Info.LandingSound);
|
||||
Game.Sound.Play(helicopter.Info.LandingSound);
|
||||
playedSound = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
var sound = pool.Info.RearmSound;
|
||||
if (sound != null)
|
||||
Sound.Play(sound, self.CenterPosition);
|
||||
Game.Sound.Play(sound, self.CenterPosition);
|
||||
|
||||
ammoPoolsReloadTimes[pool] = pool.Info.ReloadTicks;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
if (health.DamageState == DamageState.Undamaged)
|
||||
{
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.FinishRepairingNotification, self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.FinishRepairingNotification, self.Owner.Faction.InternalName);
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (!played)
|
||||
{
|
||||
played = true;
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.StartRepairingNotification, self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.StartRepairingNotification, self.Owner.Faction.InternalName);
|
||||
}
|
||||
|
||||
if (!self.Owner.PlayerActor.Trait<PlayerResources>().TakeCash(cost))
|
||||
|
||||
@@ -50,9 +50,9 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
self.Dispose();
|
||||
foreach (var s in Sounds)
|
||||
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
||||
Game.Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
||||
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Notification, self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Notification, self.Owner.Faction.InternalName);
|
||||
|
||||
var init = new TypeDictionary
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Effects
|
||||
pos = launchPos;
|
||||
var weaponRules = firedBy.World.Map.Rules.Weapons[weapon.ToLowerInvariant()];
|
||||
if (weaponRules.Report != null && weaponRules.Report.Any())
|
||||
Sound.Play(weaponRules.Report.Random(firedBy.World.SharedRandom), pos);
|
||||
Game.Sound.Play(weaponRules.Report.Random(firedBy.World.SharedRandom), pos);
|
||||
|
||||
if (skipAscent)
|
||||
ticks = turn;
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Orders
|
||||
orderType = "PlacePlug";
|
||||
if (!AcceptsPlug(topLeft, plugInfo))
|
||||
{
|
||||
Sound.PlayNotification(world.Map.Rules, producer.Owner, "Speech", "BuildingCannotPlaceAudio", producer.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, producer.Owner, "Speech", "BuildingCannotPlaceAudio", producer.Owner.Faction.InternalName);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Orders
|
||||
if (!world.CanPlaceBuilding(building, buildingInfo, topLeft, null)
|
||||
|| !buildingInfo.IsCloseEnoughToBase(world, producer.Owner, building, topLeft))
|
||||
{
|
||||
Sound.PlayNotification(world.Map.Rules, producer.Owner, "Speech", "BuildingCannotPlaceAudio", producer.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, producer.Owner, "Speech", "BuildingCannotPlaceAudio", producer.Owner.Faction.InternalName);
|
||||
yield break;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,19 +39,19 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Play an announcer voice listed in notifications.yaml")]
|
||||
public void PlaySpeechNotification(Player player, string notification)
|
||||
{
|
||||
Sound.PlayNotification(world.Map.Rules, player, "Speech", notification, player != null ? player.Faction.InternalName : null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, player, "Speech", notification, player != null ? player.Faction.InternalName : null);
|
||||
}
|
||||
|
||||
[Desc("Play a sound listed in notifications.yaml")]
|
||||
public void PlaySoundNotification(Player player, string notification)
|
||||
{
|
||||
Sound.PlayNotification(world.Map.Rules, player, "Sounds", notification, player != null ? player.Faction.InternalName : null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, player, "Sounds", notification, player != null ? player.Faction.InternalName : null);
|
||||
}
|
||||
|
||||
[Desc("Play a sound file")]
|
||||
public void PlaySound(string file)
|
||||
{
|
||||
Sound.Play(file);
|
||||
Game.Sound.Play(file);
|
||||
}
|
||||
|
||||
Action onComplete;
|
||||
|
||||
@@ -37,23 +37,23 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
w.SetPauseState(true);
|
||||
|
||||
// Mute world sounds
|
||||
var oldModifier = Sound.SoundVolumeModifier;
|
||||
var oldModifier = Game.Sound.SoundVolumeModifier;
|
||||
|
||||
// TODO: this also modifies vqa audio
|
||||
// Sound.SoundVolumeModifier = 0f;
|
||||
// Game.Sound.SoundVolumeModifier = 0f;
|
||||
|
||||
// Stop music while fmv plays
|
||||
var music = Sound.MusicPlaying;
|
||||
var music = Game.Sound.MusicPlaying;
|
||||
if (music)
|
||||
Sound.PauseMusic();
|
||||
Game.Sound.PauseMusic();
|
||||
|
||||
player.PlayThen(() =>
|
||||
{
|
||||
if (music)
|
||||
Sound.PlayMusic();
|
||||
Game.Sound.PlayMusic();
|
||||
|
||||
Ui.CloseWindow();
|
||||
Sound.SoundVolumeModifier = oldModifier;
|
||||
Game.Sound.SoundVolumeModifier = oldModifier;
|
||||
w.SetPauseState(false);
|
||||
onComplete();
|
||||
});
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.World.Add(projectile);
|
||||
|
||||
if (args.Weapon.Report != null && args.Weapon.Report.Any())
|
||||
Sound.Play(args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition);
|
||||
Game.Sound.Play(args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
notify.Charging(self, target);
|
||||
|
||||
if (!string.IsNullOrEmpty(attack.info.ChargeAudio))
|
||||
Sound.Play(attack.info.ChargeAudio, self.CenterPosition);
|
||||
Game.Sound.Play(attack.info.ChargeAudio, self.CenterPosition);
|
||||
|
||||
return Util.SequenceActivities(new Wait(attack.info.InitialChargeDelay), new ChargeFire(attack, target), this);
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public void BeforeTransform(Actor self)
|
||||
{
|
||||
foreach (var s in Info.UndeploySounds)
|
||||
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
||||
Game.Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
||||
}
|
||||
|
||||
public void OnTransform(Actor self) { }
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
isPrimary = true;
|
||||
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", "PrimaryBuildingSelected", self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", "PrimaryBuildingSelected", self.Owner.Faction.InternalName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!Repairers.Remove(player) && Repairers.Count < Info.RepairBonuses.Length)
|
||||
{
|
||||
Repairers.Add(player);
|
||||
Sound.PlayNotification(self.World.Map.Rules, player, "Speech", "Repairing", player.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, player, "Speech", "Repairing", player.Faction.InternalName);
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
var faction = info.NewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName;
|
||||
Sound.PlayNotification(self.World.Map.Rules, captor.World.LocalPlayer, "Speech", info.Notification, faction);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, captor.World.LocalPlayer, "Speech", info.Notification, faction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
if (Cloaked)
|
||||
{
|
||||
Sound.Play(Info.UncloakSound, self.CenterPosition);
|
||||
Game.Sound.Play(Info.UncloakSound, self.CenterPosition);
|
||||
if (upgradeManager != null)
|
||||
foreach (var u in Info.WhileCloakedUpgrades)
|
||||
upgradeManager.RevokeUpgrade(self, u, this);
|
||||
@@ -131,7 +131,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (remainingTime > 0 && !IsTraitDisabled && !damageDisabled && --remainingTime <= 0)
|
||||
{
|
||||
Sound.Play(Info.CloakSound, self.CenterPosition);
|
||||
Game.Sound.Play(Info.CloakSound, self.CenterPosition);
|
||||
if (upgradeManager != null)
|
||||
foreach (var u in Info.WhileCloakedUpgrades)
|
||||
upgradeManager.GrantUpgrade(self, u, this);
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public virtual void Activate(Actor collector)
|
||||
{
|
||||
Sound.PlayToPlayer(collector.Owner, info.Notification);
|
||||
Game.Sound.PlayToPlayer(collector.Owner, info.Notification);
|
||||
|
||||
if (info.Effect != null)
|
||||
collector.World.AddFrameEndTask(w => w.Add(new CrateEffect(collector, info.Effect, info.Palette)));
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void OnCrush(Actor crusher)
|
||||
{
|
||||
Sound.Play(info.CrushSound, crusher.CenterPosition);
|
||||
Game.Sound.Play(info.CrushSound, crusher.CenterPosition);
|
||||
var wda = self.TraitsImplementing<WithDeathAnimation>()
|
||||
.FirstOrDefault(s => s.Info.CrushedSequence != null);
|
||||
if (wda != null)
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
w.Add(pilot);
|
||||
pilot.QueueActivity(new Parachute(pilot, cp));
|
||||
});
|
||||
Sound.Play(info.ChuteSound, cp);
|
||||
Game.Sound.Play(info.ChuteSound, cp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var weapon = e.Attacker.World.Map.Rules.Weapons[weaponName.ToLowerInvariant()];
|
||||
if (weapon.Report != null && weapon.Report.Any())
|
||||
Sound.Play(weapon.Report.Random(e.Attacker.World.SharedRandom), self.CenterPosition);
|
||||
Game.Sound.Play(weapon.Report.Random(e.Attacker.World.SharedRandom), self.CenterPosition);
|
||||
|
||||
// Use .FromPos since this actor is killed. Cannot use Target.FromActor
|
||||
weapon.Impact(Target.FromPos(self.CenterPosition), e.Attacker, Enumerable.Empty<int>());
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "LevelUp", self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "LevelUp", self.Owner.Faction.InternalName);
|
||||
self.World.AddFrameEndTask(w => w.Add(new CrateEffect(self, "levelup", info.LevelUpPalette)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
w.Add(a);
|
||||
a.QueueActivity(new Parachute(a, self.CenterPosition));
|
||||
});
|
||||
Sound.Play(info.ChuteSound, self.CenterPosition);
|
||||
Game.Sound.Play(info.ChuteSound, self.CenterPosition);
|
||||
}
|
||||
|
||||
static bool IsSuitableCell(Actor actorToDrop, CPos p)
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var terrain = self.World.Map.GetTerrainInfo(self.Location);
|
||||
|
||||
var sound = terrain.IsWater ? info.WaterImpactSound : info.GroundImpactSound;
|
||||
Sound.Play(sound, self.CenterPosition);
|
||||
Game.Sound.Play(sound, self.CenterPosition);
|
||||
|
||||
var sequence = terrain.IsWater ? info.WaterCorpseSequence : info.GroundCorpseSequence;
|
||||
var palette = terrain.IsWater ? info.WaterCorpsePalette : info.GroundCorpsePalette;
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25)
|
||||
{
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName);
|
||||
|
||||
if (radarPings != null)
|
||||
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||
{
|
||||
if (Game.IsCurrentWorld(player.World))
|
||||
Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Lose", player.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Lose", player.Faction.InternalName);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Game.Debug("{0} is victorious.", player.PlayerName);
|
||||
|
||||
if (player == player.World.LocalPlayer)
|
||||
Game.RunAfterDelay(info.NotificationDelay, () => Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Win", player.Faction.InternalName));
|
||||
Game.RunAfterDelay(info.NotificationDelay, () => Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Win", player.Faction.InternalName));
|
||||
}
|
||||
|
||||
public void OnObjectiveAdded(Player player, int id) { }
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25)
|
||||
{
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName);
|
||||
|
||||
if (radarPings != null)
|
||||
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.World.Add(playerBeacon);
|
||||
|
||||
if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||
Sound.PlayNotification(self.World.Map.Rules, null, info.NotificationType, info.Notification,
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, null, info.NotificationType, info.Notification,
|
||||
self.World.RenderPlayer != null ? self.World.RenderPlayer.Faction.InternalName : null);
|
||||
|
||||
if (radarPings != null)
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (playSounds)
|
||||
foreach (var s in buildingInfo.BuildSounds)
|
||||
Sound.PlayToPlayer(order.Player, s, building.CenterPosition);
|
||||
Game.Sound.PlayToPlayer(order.Player, s, building.CenterPosition);
|
||||
|
||||
playSounds = false;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
pluggable.EnablePlug(host, plugInfo.Type);
|
||||
foreach (var s in buildingInfo.BuildSounds)
|
||||
Sound.PlayToPlayer(order.Player, s, host.CenterPosition);
|
||||
Game.Sound.PlayToPlayer(order.Player, s, host.CenterPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
|
||||
foreach (var s in buildingInfo.BuildSounds)
|
||||
Sound.PlayToPlayer(order.Player, s, building.CenterPosition);
|
||||
Game.Sound.PlayToPlayer(order.Player, s, building.CenterPosition);
|
||||
}
|
||||
|
||||
if (producer.Actor != null)
|
||||
@@ -155,7 +155,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (GetNumBuildables(self.Owner) > prevItems)
|
||||
w.Add(new DelayedAction(info.NewOptionsNotificationDelay,
|
||||
() => Sound.PlayNotification(self.World.Map.Rules, order.Player, "Speech", info.NewOptionsNotification, order.Player.Faction.InternalName)));
|
||||
() => Game.Sound.PlayNotification(self.World.Map.Rules, order.Player, "Speech", info.NewOptionsNotification, order.Player.Faction.InternalName)));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -281,13 +281,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var isBuilding = unit.HasTraitInfo<BuildingInfo>();
|
||||
|
||||
if (isBuilding && !hasPlayedSound)
|
||||
hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName);
|
||||
hasPlayedSound = Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName);
|
||||
else if (!isBuilding)
|
||||
{
|
||||
if (BuildUnit(order.TargetString))
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName);
|
||||
else if (!hasPlayedSound && time > 0)
|
||||
hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Faction.InternalName);
|
||||
hasPlayedSound = Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Faction.InternalName);
|
||||
}
|
||||
})));
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||
{
|
||||
if (Game.IsCurrentWorld(player.World))
|
||||
Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Lose", player.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Lose", player.Faction.InternalName);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Game.Debug("{0} is victorious.", player.PlayerName);
|
||||
|
||||
if (player == player.World.LocalPlayer)
|
||||
Game.RunAfterDelay(info.NotificationDelay, () => Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Win", player.Faction.InternalName));
|
||||
Game.RunAfterDelay(info.NotificationDelay, () => Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Win", player.Faction.InternalName));
|
||||
}
|
||||
|
||||
public void OnObjectiveAdded(Player player, int id) { }
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!IsTraitDisabled && order.OrderString == "PowerDown")
|
||||
{
|
||||
disabled = !disabled;
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", disabled ? "EnablePower" : "DisablePower", self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", disabled ? "EnablePower" : "DisablePower", self.Owner.Faction.InternalName);
|
||||
power.UpdateActor(self);
|
||||
|
||||
if (disabled)
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!disabled || !Info.CancelWhenDisabled)
|
||||
return;
|
||||
disabled = false;
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "EnablePower", self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "EnablePower", self.Owner.Faction.InternalName);
|
||||
power.UpdateActor(self);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (--nextPowerAdviceTime <= 0)
|
||||
{
|
||||
if (lowPower)
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.SpeechNotification, self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.SpeechNotification, self.Owner.Faction.InternalName);
|
||||
nextPowerAdviceTime = info.AdviceInterval;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.CancelActivity();
|
||||
|
||||
foreach (var s in info.SellSounds)
|
||||
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
||||
Game.Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
||||
|
||||
foreach (var ns in self.TraitsImplementing<INotifySold>())
|
||||
ns.Selling(self);
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public void Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
var player = info.NotifyAll ? self.World.LocalPlayer : self.Owner;
|
||||
Sound.PlayNotification(self.World.Map.Rules, player, "Speech", info.Notification, self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, player, "Speech", info.Notification, self.Owner.Faction.InternalName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public AmbientSound(Actor self, AmbientSoundInfo info)
|
||||
{
|
||||
if (self.Info.HasTraitInfo<IOccupySpaceInfo>())
|
||||
Sound.PlayLooped(info.SoundFile, self.CenterPosition);
|
||||
Game.Sound.PlayLooped(info.SoundFile, self.CenterPosition);
|
||||
else
|
||||
Sound.PlayLooped(info.SoundFile);
|
||||
Game.Sound.PlayLooped(info.SoundFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// Audio notification
|
||||
if (discoverer != null && !string.IsNullOrEmpty(Info.Notification))
|
||||
Sound.PlayNotification(self.World.Map.Rules, discoverer, "Speech", Info.Notification, discoverer.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, discoverer, "Speech", Info.Notification, discoverer.Faction.InternalName);
|
||||
|
||||
// Radar notificaion
|
||||
if (Info.PingRadar && radarPings.Value != null)
|
||||
|
||||
@@ -40,12 +40,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (e.DamageState == DamageState.Dead)
|
||||
{
|
||||
var sound = info.DestroyedSounds.RandomOrDefault(rand);
|
||||
Sound.Play(sound, self.CenterPosition);
|
||||
Game.Sound.Play(sound, self.CenterPosition);
|
||||
}
|
||||
else if (e.DamageState >= DamageState.Heavy && e.PreviousDamageState < DamageState.Heavy)
|
||||
{
|
||||
var sound = info.DamagedSounds.RandomOrDefault(rand);
|
||||
Sound.Play(sound, self.CenterPosition);
|
||||
Game.Sound.Play(sound, self.CenterPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
var notification = self.Owner.IsAlliedWith(self.World.RenderPlayer) ? Info.LaunchSound : Info.IncomingSound;
|
||||
Sound.Play(notification);
|
||||
Game.Sound.Play(notification);
|
||||
|
||||
Actor distanceTestActor = null;
|
||||
for (var i = -info.SquadSize / 2; i <= info.SquadSize / 2; i++)
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public override IOrderGenerator OrderGenerator(string order, SupportPowerManager manager)
|
||||
{
|
||||
Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound);
|
||||
Game.Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound);
|
||||
return new SelectTarget(Self.World, order, manager, this);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
self.Trait<WithSpriteBody>().PlayCustomAnimation(self, info.GrantUpgradeSequence);
|
||||
|
||||
Sound.Play(info.GrantUpgradeSound, self.World.Map.CenterOfCell(order.TargetLocation));
|
||||
Game.Sound.Play(info.GrantUpgradeSound, self.World.Map.CenterOfCell(order.TargetLocation));
|
||||
|
||||
foreach (var a in UnitsInRange(order.TargetLocation))
|
||||
{
|
||||
|
||||
@@ -71,9 +71,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
base.Activate(self, order, manager);
|
||||
|
||||
if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||
Sound.Play(Info.LaunchSound);
|
||||
Game.Sound.Play(Info.LaunchSound);
|
||||
else
|
||||
Sound.Play(Info.IncomingSound);
|
||||
Game.Sound.Play(Info.IncomingSound);
|
||||
|
||||
if (!string.IsNullOrEmpty(info.ActivationSequence))
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var location = self.World.Map.CenterOfCell(order.TargetLocation);
|
||||
|
||||
Sound.Play(info.DeploySound, location);
|
||||
Game.Sound.Play(info.DeploySound, location);
|
||||
|
||||
if (!string.IsNullOrEmpty(info.EffectSequence) && !string.IsNullOrEmpty(info.EffectPalette))
|
||||
w.Add(new SpriteEffect(location, w, info.EffectSequence, info.EffectPalette));
|
||||
|
||||
@@ -73,12 +73,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public virtual void Charging(Actor self, string key)
|
||||
{
|
||||
Sound.PlayToPlayer(self.Owner, Info.BeginChargeSound);
|
||||
Game.Sound.PlayToPlayer(self.Owner, Info.BeginChargeSound);
|
||||
}
|
||||
|
||||
public virtual void Charged(Actor self, string key)
|
||||
{
|
||||
Sound.PlayToPlayer(self.Owner, Info.EndChargeSound);
|
||||
Game.Sound.PlayToPlayer(self.Owner, Info.EndChargeSound);
|
||||
}
|
||||
|
||||
public virtual void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public virtual IOrderGenerator OrderGenerator(string order, SupportPowerManager manager)
|
||||
{
|
||||
Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound);
|
||||
Game.Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound);
|
||||
return new SelectGenericPowerTarget(order, manager, info.Cursor, MouseButton.Left);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.World.Add(projectile);
|
||||
|
||||
if (args.Weapon.Report != null && args.Weapon.Report.Any())
|
||||
Sound.Play(args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition);
|
||||
Game.Sound.Play(args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -99,9 +99,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!CanDeploy() || (building != null && !building.Lock()))
|
||||
{
|
||||
foreach (var s in info.NoTransformSounds)
|
||||
Sound.PlayToPlayer(self.Owner, s);
|
||||
Game.Sound.PlayToPlayer(self.Owner, s);
|
||||
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.NoTransformNotification, self.Owner.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.NoTransformNotification, self.Owner.Faction.InternalName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.QueueActivity(false, new CallFunc(() =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(info.UndeploySound))
|
||||
Sound.Play(info.UndeploySound, self.CenterPosition);
|
||||
Game.Sound.Play(info.UndeploySound, self.CenterPosition);
|
||||
|
||||
if (string.IsNullOrEmpty(info.DeployAnimation))
|
||||
{
|
||||
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.QueueActivity(new CallFunc(() =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(info.DeploySound))
|
||||
Sound.Play(info.DeploySound, self.CenterPosition);
|
||||
Game.Sound.Play(info.DeploySound, self.CenterPosition);
|
||||
|
||||
if (string.IsNullOrEmpty(info.DeployAnimation))
|
||||
return;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (cachedDisabled != disabled)
|
||||
{
|
||||
Sound.Play(disabled ? info.DisableSound : info.EnableSound, self.CenterPosition);
|
||||
Game.Sound.Play(disabled ? info.DisableSound : info.EnableSound, self.CenterPosition);
|
||||
desiredRange = disabled ? WDist.Zero : info.Range;
|
||||
cachedDisabled = disabled;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var type = Info.VoiceSet.ToLowerInvariant();
|
||||
var volume = Info.Volume;
|
||||
return Sound.PlayPredefined(self.World.Map.Rules, null, self, type, phrase, variant, true, WPos.Zero, volume, true);
|
||||
return Game.Sound.PlayPredefined(self.World.Map.Rules, null, self, type, phrase, variant, true, WPos.Zero, volume, true);
|
||||
}
|
||||
|
||||
public bool PlayVoiceLocal(Actor self, string phrase, string variant, float volume)
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return false;
|
||||
|
||||
var type = Info.VoiceSet.ToLowerInvariant();
|
||||
return Sound.PlayPredefined(self.World.Map.Rules, null, self, type, phrase, variant, false, self.CenterPosition, volume, true);
|
||||
return Game.Sound.PlayPredefined(self.World.Map.Rules, null, self, type, phrase, variant, false, self.CenterPosition, volume, true);
|
||||
}
|
||||
|
||||
public bool HasVoice(Actor self, string voice)
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!SongExists(currentSong))
|
||||
return;
|
||||
|
||||
Sound.PlayMusicThen(currentSong, () =>
|
||||
Game.Sound.PlayMusicThen(currentSong, () =>
|
||||
{
|
||||
if (!CurrentSongIsBackground && !Game.Settings.Sound.Repeat)
|
||||
currentSong = GetNextSong();
|
||||
@@ -161,7 +161,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
currentSong = music;
|
||||
CurrentSongIsBackground = false;
|
||||
Sound.PlayMusicThen(music, onComplete);
|
||||
Game.Sound.PlayMusicThen(music, onComplete);
|
||||
}
|
||||
|
||||
public MusicInfo GetNextSong()
|
||||
@@ -195,7 +195,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public void Stop()
|
||||
{
|
||||
currentSong = null;
|
||||
Sound.StopMusic();
|
||||
Game.Sound.StopMusic();
|
||||
|
||||
if (currentBackgroundSong != null)
|
||||
{
|
||||
@@ -208,7 +208,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public void Disposing(Actor self)
|
||||
{
|
||||
if (currentSong != null)
|
||||
Sound.StopMusic();
|
||||
Game.Sound.StopMusic();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void WorldLoaded(World world, WorldRenderer wr)
|
||||
{
|
||||
Sound.PlayNotification(world.Map.Rules, null, "Speech", info.Notification, world.RenderPlayer == null ? null : world.RenderPlayer.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.Notification, world.RenderPlayer == null ? null : world.RenderPlayer.Faction.InternalName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
world.AddFrameEndTask(w => w.Add(new Explosion(w, pos, Explosion, palette)));
|
||||
|
||||
if (ImpactSound != null)
|
||||
Sound.Play(ImpactSound, pos);
|
||||
Game.Sound.Play(ImpactSound, pos);
|
||||
}
|
||||
|
||||
public bool IsValidImpact(WPos pos, Actor firedBy)
|
||||
|
||||
@@ -126,10 +126,10 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (!IsDisabled())
|
||||
{
|
||||
OnKeyPress(e);
|
||||
Sound.PlayNotification(ModRules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", "ClickSound", null);
|
||||
}
|
||||
else
|
||||
Sound.PlayNotification(ModRules, null, "Sounds", "ClickDisabledSound", null);
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", "ClickDisabledSound", null);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -167,12 +167,12 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
OnMouseDown(mi);
|
||||
Depressed = true;
|
||||
Sound.PlayNotification(ModRules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", "ClickSound", null);
|
||||
}
|
||||
else
|
||||
{
|
||||
YieldMouseFocus(mi);
|
||||
Sound.PlayNotification(ModRules, null, "Sounds", "ClickDisabledSound", null);
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", "ClickDisabledSound", null);
|
||||
}
|
||||
}
|
||||
else if (mi.Event == MouseInputEvent.Move && HasMouseFocus)
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
recentLines.Add(new ChatLine(from, text, Game.LocalTick + RemoveTime, c));
|
||||
|
||||
if (Notification != null)
|
||||
Sound.Play(Notification);
|
||||
Game.Sound.Play(Notification);
|
||||
|
||||
while (recentLines.Count > LogLength)
|
||||
recentLines.RemoveAt(0);
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
// Mask to prevent any clicks from being sent to other widgets
|
||||
fullscreenMask = new MaskWidget();
|
||||
fullscreenMask.Bounds = new Rectangle(0, 0, Game.Renderer.Resolution.Width, Game.Renderer.Resolution.Height);
|
||||
fullscreenMask.OnMouseDown += mi => { Sound.PlayNotification(this.ModRules, null, "Sounds", "ClickSound", null); RemovePanel(); };
|
||||
fullscreenMask.OnMouseDown += mi => { Game.Sound.PlayNotification(this.ModRules, null, "Sounds", "ClickSound", null); RemovePanel(); };
|
||||
if (onCancel != null)
|
||||
fullscreenMask.OnMouseDown += _ => onCancel();
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -220,14 +220,14 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
if (PickUpCompletedBuildingIcon(icon, item))
|
||||
{
|
||||
Sound.Play(TabClick);
|
||||
Game.Sound.Play(TabClick);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item != null && item.Paused)
|
||||
{
|
||||
// Resume a paused item
|
||||
Sound.Play(TabClick);
|
||||
Game.Sound.Play(TabClick);
|
||||
World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, false));
|
||||
return true;
|
||||
}
|
||||
@@ -235,8 +235,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (CurrentQueue.BuildableItems().Any(a => a.Name == icon.Name))
|
||||
{
|
||||
// Queue a new item
|
||||
Sound.Play(TabClick);
|
||||
Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, World.LocalPlayer.Faction.InternalName);
|
||||
Game.Sound.Play(TabClick);
|
||||
Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, World.LocalPlayer.Faction.InternalName);
|
||||
World.IssueOrder(Order.StartProduction(CurrentQueue.Actor, icon.Name,
|
||||
handleMultiple ? 5 : 1));
|
||||
return true;
|
||||
@@ -250,19 +250,19 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (item == null)
|
||||
return false;
|
||||
|
||||
Sound.Play(TabClick);
|
||||
Game.Sound.Play(TabClick);
|
||||
|
||||
if (item.Paused || item.Done || item.TotalCost == item.RemainingCost)
|
||||
{
|
||||
// Instant cancel of things we have not started yet and things that are finished
|
||||
Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.CancelledAudio, World.LocalPlayer.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.CancelledAudio, World.LocalPlayer.Faction.InternalName);
|
||||
World.IssueOrder(Order.CancelProduction(CurrentQueue.Actor, icon.Name,
|
||||
handleMultiple ? 5 : 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pause an existing item
|
||||
Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.OnHoldAudio, World.LocalPlayer.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.OnHoldAudio, World.LocalPlayer.Faction.InternalName);
|
||||
World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, true));
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
: HandleRightClick(item, icon, handleMultiple);
|
||||
|
||||
if (!handled)
|
||||
Sound.Play(DisabledTabClick);
|
||||
Game.Sound.Play(DisabledTabClick);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -261,9 +261,9 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (leftPressed || rightPressed)
|
||||
{
|
||||
if ((leftPressed && !leftDisabled) || (rightPressed && !rightDisabled))
|
||||
Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
else
|
||||
Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickDisabledSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickDisabledSound", null);
|
||||
}
|
||||
|
||||
// Check production tabs
|
||||
@@ -271,7 +271,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (offsetloc.X > 0 && offsetloc.X < contentWidth)
|
||||
{
|
||||
CurrentQueue = Groups[queueGroup].Tabs[offsetloc.X / (TabWidth - 1)].Queue;
|
||||
Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -286,12 +286,12 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
if (hotkey == Game.Settings.Keys.NextProductionTabKey)
|
||||
{
|
||||
Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
return SelectNextTab(false);
|
||||
}
|
||||
else if (hotkey == Game.Settings.Keys.PreviousProductionTabKey)
|
||||
{
|
||||
Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
return SelectNextTab(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
// Enable/Disable the radar
|
||||
var enabled = IsEnabled();
|
||||
if (enabled != cachedEnabled)
|
||||
Sound.Play(enabled ? RadarOnlineSound : RadarOfflineSound);
|
||||
Game.Sound.Play(enabled ? RadarOnlineSound : RadarOfflineSound);
|
||||
cachedEnabled = enabled;
|
||||
|
||||
if (enabled)
|
||||
|
||||
@@ -321,7 +321,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
lastMouseLocation = mi.Location;
|
||||
|
||||
if (mi.Event == MouseInputEvent.Down && ((upPressed && !upDisabled) || (downPressed && !downDisabled) || thumbPressed))
|
||||
Sound.PlayNotification(modRules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(modRules, null, "Sounds", "ClickSound", null);
|
||||
}
|
||||
|
||||
return upPressed || downPressed || thumbPressed;
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
protected void ClickIcon(SupportPowerIcon clicked)
|
||||
{
|
||||
if (!clicked.Power.Active)
|
||||
Sound.PlayToPlayer(spm.Self.Owner, clicked.Power.Info.InsufficientPowerSound);
|
||||
Game.Sound.PlayToPlayer(spm.Self.Owner, clicked.Power.Info.InsufficientPowerSound);
|
||||
else
|
||||
clicked.Power.Target();
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
stopped = true;
|
||||
paused = true;
|
||||
Sound.StopVideo();
|
||||
Game.Sound.StopVideo();
|
||||
onComplete = () => { };
|
||||
|
||||
invLength = video.Framerate * 1f / video.Frames;
|
||||
@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
var nextFrame = 0;
|
||||
if (video.HasAudio)
|
||||
nextFrame = (int)float2.Lerp(0, video.Frames, Sound.VideoSeekPosition * invLength);
|
||||
nextFrame = (int)float2.Lerp(0, video.Frames, Game.Sound.VideoSeekPosition * invLength);
|
||||
else
|
||||
nextFrame = video.CurrentFrame + 1;
|
||||
|
||||
@@ -176,9 +176,9 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
onComplete = after;
|
||||
if (stopped)
|
||||
Sound.PlayVideo(video.AudioData, video.AudioChannels, video.SampleBits, video.SampleRate);
|
||||
Game.Sound.PlayVideo(video.AudioData, video.AudioChannels, video.SampleBits, video.SampleRate);
|
||||
else
|
||||
Sound.PlayVideo();
|
||||
Game.Sound.PlayVideo();
|
||||
|
||||
stopped = paused = false;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
return;
|
||||
|
||||
paused = true;
|
||||
Sound.PauseVideo();
|
||||
Game.Sound.PauseVideo();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
@@ -199,7 +199,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
stopped = true;
|
||||
paused = true;
|
||||
Sound.StopVideo();
|
||||
Game.Sound.StopVideo();
|
||||
video.Reset();
|
||||
videoSprite.Sheet.GetTexture().SetData(video.FrameData);
|
||||
world.AddFrameEndTask(_ => onComplete());
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
world.Selection.Combine(world, new Actor[] { next }, false, true);
|
||||
|
||||
Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
|
||||
return ToSelection();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user