Merge the sounds in ProductionQueue into EvaAlerts

This commit is contained in:
pchote
2010-02-27 17:15:58 +13:00
parent 1d9f5c8362
commit 6be93fdf4a
5 changed files with 84 additions and 30 deletions

View File

@@ -966,10 +966,10 @@ namespace OpenRa
void StartProduction( World world, string item )
{
var queueInfo = world.LocalPlayer.PlayerActor.Info.Traits.Get<ProductionQueueInfo>();
var eva = world.LocalPlayer.PlayerActor.Info.Traits.Get<EvaAlertsInfo>();
var unit = Rules.Info[item];
Sound.Play(unit.Traits.Contains<BuildingInfo>() ? queueInfo.BuildingSelectAudio : queueInfo.UnitSelectAudio);
Sound.Play(unit.Traits.Contains<BuildingInfo>() ? eva.BuildingSelectAudio : eva.UnitSelectAudio);
Game.IssueOrder(Order.StartProduction(world.LocalPlayer, item));
}
@@ -978,10 +978,10 @@ namespace OpenRa
var player = world.LocalPlayer;
var unit = Rules.Info[item];
var queue = player.PlayerActor.traits.Get<Traits.ProductionQueue>();
var queueInfo = player.PlayerActor.Info.Traits.Get<Traits.ProductionQueueInfo>();
var eva = player.PlayerActor.Info.Traits.Get<EvaAlertsInfo>();
var producing = queue.AllItems(unit.Category).FirstOrDefault( a => a.Item == item );
Sound.Play(queueInfo.ClickAudio);
Sound.Play(eva.TabClick);
if (isLmb)
{
@@ -1010,12 +1010,12 @@ namespace OpenRa
// 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(queueInfo.CancelledAudio);
Sound.Play(eva.CancelledAudio);
Game.IssueOrder(Order.CancelProduction(player, item));
}
else
{
Sound.Play(queueInfo.OnHoldAudio);
Sound.Play(eva.OnHoldAudio);
Game.IssueOrder(Order.PauseProduction(player, item, true));
}
}

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information
#region Copyright & License Information
/*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA.
@@ -52,8 +52,8 @@ namespace OpenRa.Orders
if (!world.CanPlaceBuilding( Building, BuildingInfo, topLeft, null)
|| !world.IsCloseEnoughToBase(Producer.Owner, Building, BuildingInfo, topLeft))
{
var queueInfo = world.LocalPlayer.PlayerActor.Info.Traits.Get<ProductionQueueInfo>();
Sound.Play(queueInfo.BuildingCannotPlaceAudio);
var eva = world.LocalPlayer.PlayerActor.Info.Traits.Get<EvaAlertsInfo>();
Sound.Play(eva.BuildingCannotPlaceAudio);
yield break;
}

View File

@@ -0,0 +1,63 @@
#region Copyright & License Information
/*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA.
*
* OpenRA is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenRA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
*/
#endregion
namespace OpenRa.Traits
{
class EvaAlertsInfo : StatelessTraitInfo<EvaAlerts>
{
// Sound effects
public readonly string TabClick = "ramenu1.aud";
public readonly string ChatBeep = "rabeep1.aud";
public readonly string RadarUp = "radaron2.aud";
public readonly string RadarDown = "radardn1.aud";
public readonly string CashTickUp = "cashup1.aud";
public readonly string CashTickDown = "cashdn1.aud";
// Build Palette
public readonly string BuildPaletteOpen = "bleep13.aud";
public readonly string BuildPaletteClose = "bleep13.aud";
public readonly string BuildingSelectAudio = "abldgin1.aud";
public readonly string BuildingReadyAudio = "conscmp1.aud";
public readonly string BuildingCannotPlaceAudio = "nodeply1.aud";
public readonly string UnitSelectAudio = "train1.aud";
public readonly string UnitReadyAudio = "unitrdy1.aud";
public readonly string OnHoldAudio = "onhold1.aud";
public readonly string CancelledAudio = "cancld1.aud";
public readonly string ClickAudio = "ramenu1.aud";
// For manual powerup/down in ra-ng
public readonly string DisablePower = "bleep11.aud";
public readonly string EnablePower = "bleep12.aud";
// Eva speech
public readonly string LowPower = "lopower1.aud";
public readonly string SilosNeeded = "silond1.aud";
public readonly string UnitLost = "unitlst1.aud";
public readonly string NavalUnitLost = "navylst1.aud";
public readonly string PrimaryBuildingSelected = "pribldg1.aud";
public readonly string CreditsStolen = "credit1.aud";
}
class EvaAlerts {}
}

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information
#region Copyright & License Information
/*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA.
@@ -27,15 +27,6 @@ namespace OpenRa.Traits
{
class ProductionQueueInfo : ITraitInfo
{
public readonly string BuildingSelectAudio = "abldgin1.aud";
public readonly string BuildingReadyAudio = "conscmp1.aud";
public readonly string BuildingCannotPlaceAudio = "nodeply1.aud";
public readonly string UnitSelectAudio = "train1.aud";
public readonly string UnitReadyAudio = "unitrdy1.aud";
public readonly string OnHoldAudio = "onhold1.aud";
public readonly string CancelledAudio = "cancld1.aud";
public readonly string ClickAudio = "ramenu1.aud";
public object Create(Actor self) { return new ProductionQueue(self); }
}
@@ -83,7 +74,8 @@ namespace OpenRa.Traits
var isBuilding = unit.Traits.Contains<BuildingInfo>();
if( !hasPlayedSound )
{
Sound.PlayToPlayer( order.Player, isBuilding ? self.Info.Traits.Get<ProductionQueueInfo>().BuildingReadyAudio : self.Info.Traits.Get<ProductionQueueInfo>().UnitReadyAudio );
var eva = self.Info.Traits.Get<EvaAlertsInfo>();
Sound.PlayToPlayer( order.Player, isBuilding ? eva.BuildingReadyAudio : eva.UnitReadyAudio );
hasPlayedSound = true;
}
if( !isBuilding )

View File

@@ -1,5 +1,12 @@
Player:
ProductionQueue:
EvaAlerts:
TabClick: button.aud
ChatBeep: beepy2.aud
RadarUp: comcntr1.aud
RadarDown: powrdn1.aud
BuildPaletteOpen: appear1.aud
BuildPaletteClose: appear1.aud
BuildingSelectAudio: bldging1.aud
BuildingReadyAudio: constru1.aud
BuildingCannotPlaceAudio: deploy1.aud
@@ -7,16 +14,8 @@ Player:
UnitReadyAudio: unitredy.aud
OnHoldAudio: onhold1.aud
CancelledAudio: cancel1.aud
ClickAudio: button.aud
EvaAlerts:
TabClick: button.aud
ChatBeep: target1.aud
RadarUp: comcntr1.aud
RadarDown: powrdn1.aud
BuildPaletteOpen: appear1.aud
BuildPaletteClose: appear1.aud
CashTickUp: clock1.aud
CashTickDown: clock1.aud
# CashTickUp: clock1.aud
# CashTickDown: clock1.aud
LowPower: lopower1.aud
SilosNeeded: silos1.aud
UnitLost: unitlost.aud