Replace ITraitInfo interface with TraitInfo class.

This commit is contained in:
Paul Chote
2020-05-11 18:12:19 +01:00
committed by reaperrr
parent 3cd7ec3878
commit 86f61298e6
243 changed files with 510 additions and 505 deletions

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
public class WithBuildingBibInfo : ITraitInfo, Requires<BuildingInfo>, IRenderActorPreviewSpritesInfo, IActorPreviewInitInfo, Requires<RenderSpritesInfo>
public class WithBuildingBibInfo : TraitInfo, Requires<BuildingInfo>, IRenderActorPreviewSpritesInfo, IActorPreviewInitInfo, Requires<RenderSpritesInfo>
{
[SequenceReference]
public readonly string Sequence = "bib";
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly bool HasMinibib = false;
public object Create(ActorInitializer init) { return new WithBuildingBib(init.Self, this); }
public override object Create(ActorInitializer init) { return new WithBuildingBib(init.Self, this); }
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{

View File

@@ -21,7 +21,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
[Desc("Renders the cargo loaded into the unit.")]
public class WithCargoInfo : ITraitInfo, Requires<CargoInfo>, Requires<BodyOrientationInfo>
public class WithCargoInfo : TraitInfo, Requires<CargoInfo>, Requires<BodyOrientationInfo>
{
[Desc("Cargo position relative to turret or body in (forward, right, up) triples. The default offset should be in the middle of the list.")]
public readonly WVec[] LocalOffset = { WVec.Zero };
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Passenger CargoType to display.")]
public readonly HashSet<string> DisplayTypes = new HashSet<string>();
public object Create(ActorInitializer init) { return new WithCargo(init.Self, this); }
public override object Create(ActorInitializer init) { return new WithCargo(init.Self, this); }
}
public class WithCargo : ITick, IRender, INotifyPassengerEntered, INotifyPassengerExited

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
public class WithLandingCraftAnimationInfo : ITraitInfo, Requires<IMoveInfo>, Requires<WithSpriteBodyInfo>, Requires<CargoInfo>
public class WithLandingCraftAnimationInfo : TraitInfo, Requires<IMoveInfo>, Requires<WithSpriteBodyInfo>, Requires<CargoInfo>
{
public readonly HashSet<string> OpenTerrainTypes = new HashSet<string> { "Clear" };
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Which sprite body to play the animation on.")]
public readonly string Body = "body";
public object Create(ActorInitializer init) { return new WithLandingCraftAnimation(init, this); }
public override object Create(ActorInitializer init) { return new WithLandingCraftAnimation(init, this); }
}
public class WithLandingCraftAnimation : ITick

View File

@@ -16,12 +16,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
[Desc("Provides an overlay for the Tiberian Dawn hover craft.")]
public class WithRoofInfo : ITraitInfo, Requires<RenderSpritesInfo>
public class WithRoofInfo : TraitInfo, Requires<RenderSpritesInfo>
{
[SequenceReference]
public readonly string Sequence = "roof";
public object Create(ActorInitializer init) { return new WithRoof(init.Self, this); }
public override object Create(ActorInitializer init) { return new WithRoof(init.Self, this); }
}
public class WithRoof

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
[Desc("This actor displays a charge-up animation before firing.")]
public class WithTeslaChargeAnimationInfo : ITraitInfo, Requires<WithSpriteBodyInfo>, Requires<RenderSpritesInfo>
public class WithTeslaChargeAnimationInfo : TraitInfo, Requires<WithSpriteBodyInfo>, Requires<RenderSpritesInfo>
{
[SequenceReference]
[Desc("Sequence to use for charge animation.")]
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Which sprite body to play the animation on.")]
public readonly string Body = "body";
public object Create(ActorInitializer init) { return new WithTeslaChargeAnimation(init, this); }
public override object Create(ActorInitializer init) { return new WithTeslaChargeAnimation(init, this); }
}
public class WithTeslaChargeAnimation : INotifyTeslaCharging

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
[Desc("Rendered together with AttackCharge.")]
public class WithTeslaChargeOverlayInfo : ITraitInfo, Requires<RenderSpritesInfo>
public class WithTeslaChargeOverlayInfo : TraitInfo, Requires<RenderSpritesInfo>
{
[SequenceReference]
[Desc("Sequence name to use")]
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Custom palette is a player palette BaseName")]
public readonly bool IsPlayerPalette = false;
public object Create(ActorInitializer init) { return new WithTeslaChargeOverlay(init, this); }
public override object Create(ActorInitializer init) { return new WithTeslaChargeOverlay(init, this); }
}
public class WithTeslaChargeOverlay : INotifyTeslaCharging, INotifyDamageStateChanged, INotifySold

View File

@@ -21,7 +21,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
// TODO: This trait is hacky and should go away as soon as we support granting a condition on docking, in favor of toggling two regular WithVoxelBodies
public class WithVoxelUnloadBodyInfo : ITraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>
public class WithVoxelUnloadBodyInfo : TraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>
{
[Desc("Voxel sequence name to use when docked to a refinery.")]
public readonly string UnloadSequence = "unload";
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Defines if the Voxel should have a shadow.")]
public readonly bool ShowShadow = true;
public object Create(ActorInitializer init) { return new WithVoxelUnloadBody(init.Self, this); }
public override object Create(ActorInitializer init) { return new WithVoxelUnloadBody(init.Self, this); }
public IEnumerable<ModelAnimation> RenderPreviewVoxels(
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)

View File

@@ -20,7 +20,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
public class WithVoxelWalkerBodyInfo : ITraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
public class WithVoxelWalkerBodyInfo : TraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
{
public readonly string Sequence = "idle";
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Defines if the Voxel should have a shadow.")]
public readonly bool ShowShadow = true;
public object Create(ActorInitializer init) { return new WithVoxelWalkerBody(init.Self, this); }
public override object Create(ActorInitializer init) { return new WithVoxelWalkerBody(init.Self, this); }
public IEnumerable<ModelAnimation> RenderPreviewVoxels(
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)