More sound tweaks

This commit is contained in:
pchote
2010-02-27 17:54:52 +13:00
parent 6be93fdf4a
commit 16c0065005
7 changed files with 27 additions and 12 deletions

View File

@@ -929,9 +929,12 @@ namespace OpenRa
overlayBits.Add(Pair.New(cantBuild.Image, drawPos)); overlayBits.Add(Pair.New(cantBuild.Image, drawPos));
var closureItemName = item.Name; var closureItemName = item.Name;
var eva = world.LocalPlayer.PlayerActor.Info.Traits.Get<EvaAlertsInfo>();
AddButton(rect, buildableItems.Contains(item.Name) AddButton(rect, buildableItems.Contains(item.Name)
? isLmb => HandleBuildPalette(world, closureItemName, isLmb) ? isLmb => HandleBuildPalette(world, closureItemName, isLmb)
: (Action<bool>)(_ => Sound.Play("briefing.aud"))); : (Action<bool>)(_ => Sound.Play(eva.TabClick)));
if (++x == columns) { x = 0; y++; } if (++x == columns) { x = 0; y++; }
} }

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. * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA. * This file is part of OpenRA.
@@ -55,6 +55,9 @@ namespace OpenRa
public static void Play(string name) public static void Play(string name)
{ {
if (name == "" || name == null)
return;
var sound = sounds[name]; var sound = sounds[name];
// todo: positioning // todo: positioning
soundEngine.Play2D(sound, false); soundEngine.Play2D(sound, false);

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. * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA. * This file is part of OpenRA.
@@ -19,6 +19,7 @@
#endregion #endregion
using System; using System;
using OpenRa.Traits;
namespace OpenRa.Traits.Activities namespace OpenRa.Traits.Activities
{ {
@@ -46,7 +47,7 @@ namespace OpenRa.Traits.Activities
rb.PlayCustomAnimBackwards(self, "make", rb.PlayCustomAnimBackwards(self, "make",
() => self.World.AddFrameEndTask(w => DoUndeploy(w,self))); () => self.World.AddFrameEndTask(w => DoUndeploy(w,self)));
Sound.PlayToPlayer(self.Owner, "cashturn.aud"); Sound.PlayToPlayer(self.Owner, self.Owner.PlayerActor.Info.Traits.Get<PlaceBuildingInfo>().SellSound);
started = true; started = 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. * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA. * This file is part of OpenRA.
@@ -22,7 +22,11 @@ using System.Linq;
namespace OpenRa.Traits namespace OpenRa.Traits
{ {
class PlaceBuildingInfo : StatelessTraitInfo<PlaceBuilding> { } class PlaceBuildingInfo : StatelessTraitInfo<PlaceBuilding>
{
public readonly string[] BuildSounds = {"placbldg.aud", "build5.aud"};
public readonly string SellSound = "cashturn.aud";
}
class PlaceBuilding : IResolveOrder class PlaceBuilding : IResolveOrder
{ {
@@ -39,8 +43,10 @@ namespace OpenRa.Traits
return; return;
self.World.CreateActor( order.TargetString, order.TargetLocation, order.Player ); self.World.CreateActor( order.TargetString, order.TargetLocation, order.Player );
Sound.PlayToPlayer(order.Player, "placbldg.aud"); var info = self.Info.Traits.Get<PlaceBuildingInfo>();
Sound.PlayToPlayer(order.Player, "build5.aud");
foreach (var s in info.BuildSounds)
Sound.PlayToPlayer(order.Player, s);
var facts = self.World.Queries.OwnedBy[self.Owner] var facts = self.World.Queries.OwnedBy[self.Owner]
.WithTrait<ConstructionYard>().Select(x => x.Actor); .WithTrait<ConstructionYard>().Select(x => x.Actor);

View File

@@ -128,7 +128,7 @@ namespace OpenRa.Traits
if( !Game.skipMakeAnims && self.Info.Traits.Get<RenderBuildingInfo>().HasMakeAnimation ) if( !Game.skipMakeAnims && self.Info.Traits.Get<RenderBuildingInfo>().HasMakeAnimation )
anim.PlayBackwardsThen( "make", null ); anim.PlayBackwardsThen( "make", null );
Sound.PlayToPlayer(self.Owner, "cashturn.aud"); Sound.PlayToPlayer(self.Owner, self.Owner.PlayerActor.Info.Traits.Get<PlaceBuildingInfo>().SellSound);
} }
public void Sold(Actor self) { DoBib(self, true); } public void Sold(Actor self) { DoBib(self, true); }

View File

@@ -14,14 +14,16 @@ Player:
UnitReadyAudio: unitredy.aud UnitReadyAudio: unitredy.aud
OnHoldAudio: onhold1.aud OnHoldAudio: onhold1.aud
CancelledAudio: cancel1.aud CancelledAudio: cancel1.aud
# CashTickUp: clock1.aud CashTickUp: tone15.aud
# CashTickDown: clock1.aud CashTickDown:
LowPower: lopower1.aud LowPower: lopower1.aud
SilosNeeded: silos1.aud SilosNeeded: silos1.aud
UnitLost: unitlost.aud UnitLost: unitlost.aud
NavalUnitLost: unitlost.aud NavalUnitLost: unitlost.aud
PrimaryBuildingSelected: pribldg1.aud PrimaryBuildingSelected: pribldg1.aud
PlaceBuilding: PlaceBuilding:
BuildSounds: constru2.aud, hvydoor1.aud
SellSound: cashturn.aud
SpawnDefaultUnits: SpawnDefaultUnits:
World: World:

View File

@@ -20,7 +20,7 @@ MCV:
TransformsInto: fact TransformsInto: fact
Offset:-1,-1 Offset:-1,-1
DeployDirections: 96 DeployDirections: 96
TransformSounds: placbldg.aud, build5.aud TransformSounds: constru2.aud, hvydoor1.aud
NoTransformSounds: nodeply1.aud NoTransformSounds: nodeply1.aud
RenderUnit: RenderUnit: