Defer rollover checks while generating selection decorations
This commit is contained in:
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public class SelectionInfo : TraitInfo
|
||||
{
|
||||
public override object Create(ActorInitializer init) { return new Selection(this); }
|
||||
public override object Create(ActorInitializer init) { return new Selection(); }
|
||||
}
|
||||
|
||||
[TraitLocation(SystemActors.World | SystemActors.EditorWorld)]
|
||||
@@ -29,13 +29,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public IEnumerable<Actor> Actors => actors;
|
||||
|
||||
readonly HashSet<Actor> actors = new HashSet<Actor>();
|
||||
readonly List<Actor> rolloverActors = new List<Actor>();
|
||||
World world;
|
||||
IEnumerable<Actor> rolloverActors;
|
||||
|
||||
INotifySelection[] worldNotifySelection;
|
||||
|
||||
public Selection(SelectionInfo info) { }
|
||||
|
||||
void INotifyCreated.Created(Actor self)
|
||||
{
|
||||
worldNotifySelection = self.TraitsImplementing<INotifySelection>().ToArray();
|
||||
@@ -157,12 +155,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void SetRollover(IEnumerable<Actor> rollover)
|
||||
{
|
||||
rolloverActors = rollover;
|
||||
rolloverActors.Clear();
|
||||
rolloverActors.AddRange(rollover);
|
||||
}
|
||||
|
||||
public bool RolloverContains(Actor a)
|
||||
{
|
||||
return rolloverActors != null && rolloverActors.Contains(a);
|
||||
return rolloverActors.Contains(a);
|
||||
}
|
||||
|
||||
void ITick.Tick(Actor self)
|
||||
|
||||
Reference in New Issue
Block a user