Shift production audio onto ProductionQueue.

This commit is contained in:
Paul Chote
2011-01-29 12:58:56 +13:00
parent 9a4fb0a5b9
commit d45db9eb9c
6 changed files with 50 additions and 32 deletions

View File

@@ -21,6 +21,13 @@ namespace OpenRA.Mods.RA
public readonly string Type = null;
public float BuildSpeed = 0.4f;
public readonly int LowPowerSlowdown = 3;
public readonly string ReadyAudio = "unitrdy1.aud";
public readonly string BlockedAudio = "nobuild1.aud";
public readonly string QueuedAudio = "train1.aud";
public readonly string OnHoldAudio = "onhold1.aud";
public readonly string CancelledAudio = "cancld1.aud";
public virtual object Create(ActorInitializer init) { return new ProductionQueue(init.self, init.self.Owner.PlayerActor, this); }
}
@@ -153,20 +160,19 @@ namespace OpenRA.Mods.RA
_ =>
{
var isBuilding = unit.Traits.Contains<BuildingInfo>();
var eva = self.World.WorldActor.Info.Traits.Get<EvaAlertsInfo>();
if (isBuilding && !hasPlayedSound)
{
Sound.PlayToPlayer(order.Player, eva.BuildingReadyAudio);
Sound.PlayToPlayer(order.Player, Info.ReadyAudio);
hasPlayedSound = true;
}
else if (!isBuilding)
{
if (BuildUnit(order.TargetString))
Sound.PlayToPlayer(order.Player, eva.UnitReadyAudio);
Sound.PlayToPlayer(order.Player, Info.ReadyAudio);
else if (!hasPlayedSound && time > 0)
{
Sound.PlayToPlayer(order.Player, eva.UnitReadyBlockedAudio);
Sound.PlayToPlayer(order.Player, Info.BlockedAudio);
hasPlayedSound = true;
}
}

View File

@@ -333,7 +333,6 @@ namespace OpenRA.Mods.RA.Widgets
void HandleBuildPalette( World world, string item, bool isLmb )
{
var unit = Rules.Info[item];
var eva = world.WorldActor.Info.Traits.Get<EvaAlertsInfo>();
var producing = CurrentQueue.AllQueued().FirstOrDefault( a => a.Item == item );
if (isLmb)
@@ -365,7 +364,7 @@ namespace OpenRA.Mods.RA.Widgets
// instant cancel of things we havent really started yet, and things that are finished
if (producing.Paused || producing.Done || producing.TotalCost == producing.RemainingCost)
{
Sound.Play(eva.CancelledAudio);
Sound.Play(CurrentQueue.Info.CancelledAudio);
int numberToCancel = Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1;
if (Game.GetModifierKeys().HasModifier(Modifiers.Shift) &&
Game.GetModifierKeys().HasModifier(Modifiers.Ctrl))
@@ -376,7 +375,7 @@ namespace OpenRA.Mods.RA.Widgets
}
else
{
Sound.Play(eva.OnHoldAudio);
Sound.Play(CurrentQueue.Info.OnHoldAudio);
world.IssueOrder(Order.PauseProduction(CurrentQueue.self, item, true));
}
}
@@ -385,11 +384,7 @@ namespace OpenRA.Mods.RA.Widgets
void StartProduction( World world, string item )
{
var eva = world.WorldActor.Info.Traits.Get<EvaAlertsInfo>();
var unit = Rules.Info[item];
Sound.Play(unit.Traits.Contains<BuildingInfo>() ? eva.BuildingSelectAudio : eva.UnitSelectAudio);
Sound.Play(CurrentQueue.Info.QueuedAudio);
world.IssueOrder(Order.StartProduction(CurrentQueue.self, item,
Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1));
}