Some of fixing #36
This commit is contained in:
@@ -9,14 +9,14 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
|
|
||||||
namespace OpenRA.GameRules
|
namespace OpenRA.GameRules
|
||||||
{
|
{
|
||||||
public class VoiceInfo
|
public class VoiceInfo
|
||||||
{
|
{
|
||||||
public readonly string[] SovietVariants = { ".aud" };
|
public readonly Dictionary<string,string[]> Variants;
|
||||||
public readonly string[] AlliedVariants = { ".aud" };
|
|
||||||
public readonly string[] Select = { };
|
public readonly string[] Select = { };
|
||||||
public readonly string[] Move = { };
|
public readonly string[] Move = { };
|
||||||
public readonly string[] Attack = null;
|
public readonly string[] Attack = null;
|
||||||
@@ -26,7 +26,10 @@ namespace OpenRA.GameRules
|
|||||||
|
|
||||||
public VoiceInfo( MiniYaml y )
|
public VoiceInfo( MiniYaml y )
|
||||||
{
|
{
|
||||||
FieldLoader.Load(this, y);
|
FieldLoader.LoadFields(this, y.Nodes, new string[] { "Select", "Move", "Attack", "Die" });
|
||||||
|
Variants = (y.Nodes.ContainsKey("Variants"))? y.Nodes["Variants"].Nodes.ToDictionary(a => a.Key,
|
||||||
|
a => (string[])FieldLoader.GetValue( "(value)", typeof(string[]), a.Value.Value ))
|
||||||
|
: new Dictionary<string, string[]>();
|
||||||
|
|
||||||
Pools = Lazy.New(() =>
|
Pools = Lazy.New(() =>
|
||||||
new Dictionary<string, VoicePool>
|
new Dictionary<string, VoicePool>
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ namespace OpenRA
|
|||||||
actors = (isCombine ? oldSelection.Union(newSelection) : newSelection).ToList();
|
actors = (isCombine ? oldSelection.Union(newSelection) : newSelection).ToList();
|
||||||
|
|
||||||
var voicedUnit = actors.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.HasVoice());
|
var voicedUnit = actors.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.HasVoice());
|
||||||
Sound.PlayVoice("Select", voicedUnit);
|
if (voicedUnit != null)
|
||||||
|
Sound.PlayVoice("Select", voicedUnit, voicedUnit.Owner.Country.Race);
|
||||||
|
|
||||||
foreach (var ns in world.WorldActor.TraitsImplementing<INotifySelection>())
|
foreach (var ns in world.WorldActor.TraitsImplementing<INotifySelection>())
|
||||||
ns.SelectionChanged();
|
ns.SelectionChanged();
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if it played a phrase
|
// Returns true if it played a phrase
|
||||||
public static bool PlayVoice(string phrase, Actor voicedUnit)
|
public static bool PlayVoice(string phrase, Actor voicedUnit, string variant)
|
||||||
{
|
{
|
||||||
if (voicedUnit == null) return false;
|
if (voicedUnit == null) return false;
|
||||||
if (phrase == null) return false;
|
if (phrase == null) return false;
|
||||||
@@ -203,13 +203,8 @@ namespace OpenRA
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: fix this
|
var variantext = vi.Variants[variant][voicedUnit.ActorID % vi.Variants.Count];
|
||||||
var variants = (voicedUnit.Owner.Country.Race == "allies")
|
Play(clip + variantext);
|
||||||
? vi.AlliedVariants : vi.SovietVariants;
|
|
||||||
|
|
||||||
var variant = variants[voicedUnit.ActorID % variants.Length];
|
|
||||||
|
|
||||||
Play(clip + variant);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
foreach (var v in o.Subject.TraitsImplementing<IOrderVoice>())
|
foreach (var v in o.Subject.TraitsImplementing<IOrderVoice>())
|
||||||
{
|
{
|
||||||
if (Sound.PlayVoice(v.VoicePhraseForOrder(o.Subject, o), o.Subject))
|
if (Sound.PlayVoice(v.VoicePhraseForOrder(o.Subject, o), o.Subject, o.Subject.Owner.Country.Race))
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
if (e.DamageState == DamageState.Dead)
|
if (e.DamageState == DamageState.Dead)
|
||||||
{
|
{
|
||||||
var death = e.Warhead != null ? e.Warhead.InfDeath : 0;
|
var death = e.Warhead != null ? e.Warhead.InfDeath : 0;
|
||||||
Sound.PlayVoice("Die", self);
|
Sound.PlayVoice("Die", self, self.Owner.Country.Race);
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Corpse(self, death)));
|
self.World.AddFrameEndTask(w => w.Add(new Corpse(self, death)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
GenericVoice:
|
GenericVoice:
|
||||||
SovietVariants: .v01,.v03
|
Variants:
|
||||||
AlliedVariants: .v01,.v03
|
nod: .v01,.v03
|
||||||
|
gdi: .v01,.v03
|
||||||
Select: await1,ready,report1,yessir1
|
Select: await1,ready,report1,yessir1
|
||||||
Move: ackno,affirm1,noprob,ritaway,roger,ugotit
|
Move: ackno,affirm1,noprob,ritaway,roger,ugotit
|
||||||
Die: nuyell1.aud,nuyell3.aud,nuyell4.aud,nuyell5.aud
|
Die: nuyell1.aud,nuyell3.aud,nuyell4.aud,nuyell5.aud
|
||||||
|
|
||||||
VehicleVoice:
|
VehicleVoice:
|
||||||
SovietVariants: .v00,.v02
|
Variants:
|
||||||
AlliedVariants: .v00,.v02
|
nod: .v00,.v02
|
||||||
|
gdi: .v00,.v02
|
||||||
Select: vehic1,yessir1,report1,await1,unit1
|
Select: vehic1,yessir1,report1,await1,unit1
|
||||||
Move: ackno,affirm1,movout1
|
Move: ackno,affirm1,movout1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user