Make INotifyBuildComplete require explicit implementation

This commit is contained in:
reaperrr
2016-10-20 21:21:29 +02:00
parent d9ecba7b60
commit a6b09342bc
9 changed files with 16 additions and 10 deletions

View File

@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Cnc.Traits
}
}
public void BuildingComplete(Actor self)
void INotifyBuildComplete.BuildingComplete(Actor self)
{
if (skippedMakeAnimation)
{

View File

@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
self.QueueActivity(new FindResources(self));
}
public void BuildingComplete(Actor self)
void INotifyBuildComplete.BuildingComplete(Actor self)
{
if (Info.SearchOnCreation)
self.QueueActivity(new FindResources(self));

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits.Render
}
}
class WithGateSpriteBody : WithSpriteBody, INotifyRemovedFromWorld, INotifyBuildComplete, IWallConnector, ITick
class WithGateSpriteBody : WithSpriteBody, INotifyRemovedFromWorld, IWallConnector, ITick
{
readonly WithGateSpriteBodyInfo gateInfo;
readonly Gate gate;
@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits.Render
UpdateState(self);
}
public override void BuildingComplete(Actor self)
protected override void OnBuildComplete(Actor self)
{
UpdateState(self);
UpdateNeighbours(self);

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits.Render
playerResources = init.Self.Owner.PlayerActor.Trait<PlayerResources>();
}
public void BuildingComplete(Actor self)
void INotifyBuildComplete.BuildingComplete(Actor self)
{
wsb.DefaultAnimation.PlayFetchIndex(wsb.NormalizeSequence(self, info.Sequence),
() => playerResources.ResourceCapacity != 0

View File

@@ -75,12 +75,17 @@ namespace OpenRA.Mods.Common.Traits.Render
return RenderSprites.NormalizeSequence(DefaultAnimation, self.GetDamageState(), sequence);
}
// TODO: Get rid of INotifyBuildComplete in favor of using the upgrade system
public virtual void BuildingComplete(Actor self)
protected virtual void OnBuildComplete(Actor self)
{
DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence));
}
// TODO: Get rid of INotifyBuildComplete in favor of using the upgrade system
void INotifyBuildComplete.BuildingComplete(Actor self)
{
OnBuildComplete(self);
}
public void PlayCustomAnimation(Actor self, string name, Action after = null)
{
DefaultAnimation.PlayThen(NormalizeSequence(self, name), () =>

View File

@@ -136,7 +136,7 @@ namespace OpenRA.Mods.Common.Traits.Render
dirty = false;
}
public override void BuildingComplete(Actor self)
protected override void OnBuildComplete(Actor self)
{
DefaultAnimation.PlayFetchIndex(NormalizeSequence(self, Info.Sequence), () => adjacent);
UpdateNeighbours(self);

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
this.info = info;
}
public void BuildingComplete(Actor self)
void INotifyBuildComplete.BuildingComplete(Actor self)
{
self.PlayVoice(info.Voice);
}

View File

@@ -70,6 +70,7 @@ namespace OpenRA.Mods.Common.Traits
void PreparingAttack(Actor self, Target target, Armament a, Barrel barrel);
}
[RequireExplicitImplementation]
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
public interface INotifyBuildingPlaced { void BuildingPlaced(Actor self); }
public interface INotifyRepair { void Repairing(Actor self, Actor target); }

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.D2k.Traits.Render
rs.Add(anim, info.Palette, info.IsPlayerPalette);
}
public void BuildingComplete(Actor self)
void INotifyBuildComplete.BuildingComplete(Actor self)
{
buildComplete = true;
}