From 0fbabfc3aa73a81cd1c6de9a71df8db3804e1fe3 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 8 Feb 2010 19:19:35 +1300 Subject: [PATCH] added selection-changed hook --- OpenRa.Game/Selection.cs | 3 +++ OpenRa.Game/Traits/TraitsInterfaces.cs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenRa.Game/Selection.cs b/OpenRa.Game/Selection.cs index 61e441d386..696d7c54cb 100644 --- a/OpenRa.Game/Selection.cs +++ b/OpenRa.Game/Selection.cs @@ -25,6 +25,9 @@ namespace OpenRa var voicedUnit = actors.FirstOrDefault(a => a.traits.Contains() && a.Owner == world.LocalPlayer); Sound.PlayVoice("Select", voicedUnit); + + foreach (var ns in world.WorldActor.traits.WithInterface()) + ns.SelectionChanged(); } public IEnumerable Actors { get { return actors; } } diff --git a/OpenRa.Game/Traits/TraitsInterfaces.cs b/OpenRa.Game/Traits/TraitsInterfaces.cs index 7d08e53276..4108aefc00 100644 --- a/OpenRa.Game/Traits/TraitsInterfaces.cs +++ b/OpenRa.Game/Traits/TraitsInterfaces.cs @@ -99,5 +99,7 @@ namespace OpenRa.Traits public object Create(Actor self) { return Instance.Value; } } - interface ITraitPrerequisite { } + public interface ITraitPrerequisite { } + + public interface INotifySelection { void SelectionChanged(); } }