remove ObjectCreator.Param and all associated nonsense

This commit is contained in:
Chris Forbes
2011-10-21 18:16:07 +13:00
parent 4c8e048c2c
commit 6010034b4a
69 changed files with 120 additions and 213 deletions

View File

@@ -78,8 +78,7 @@ namespace OpenRA
var a = new object[ p.Length ];
for( int i = 0 ; i < p.Length ; i++ )
{
var attr = p[ i ].GetCustomAttributes<ParamAttribute>().FirstOrDefault();
var key = (attr != null ? attr.ParamName : null) ?? p[i].Name;
var key = p[i].Name;
if ( !args.ContainsKey(key) ) throw new InvalidOperationException("ObjectCreator: key `{0}' not found".F(key));
a[ i ] = args[ key ];
}
@@ -94,22 +93,7 @@ namespace OpenRA
.Where(t => t != it && it.IsAssignableFrom(t)));
}
[AttributeUsage( AttributeTargets.Parameter )]
public class ParamAttribute : Attribute
{
public string ParamName { get; private set; }
public ParamAttribute() { }
public ParamAttribute( string paramName )
{
ParamName = paramName;
}
}
[AttributeUsage( AttributeTargets.Constructor )]
public class UseCtorAttribute : Attribute
{
}
public class UseCtorAttribute : Attribute {}
}
}

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
@@ -26,7 +26,7 @@ namespace OpenRA.Widgets
readonly OrderManager orderManager;
[ObjectCreator.UseCtor]
internal ChatEntryWidget( [ObjectCreator.Param] OrderManager orderManager )
internal ChatEntryWidget( OrderManager orderManager )
{
this.orderManager = orderManager;
}

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Widgets
readonly WorldRenderer worldRenderer;
[ObjectCreator.UseCtor]
public ShpImageWidget([ObjectCreator.Param] WorldRenderer worldRenderer)
public ShpImageWidget( WorldRenderer worldRenderer)
: base()
{
GetImage = () => { return Image; };

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Widgets
readonly World world;
[ObjectCreator.UseCtor]
public VqaPlayerWidget( [ObjectCreator.Param] World world )
public VqaPlayerWidget( World world )
{
this.world = world;
}

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Widgets
readonly WorldRenderer worldRenderer;
[ObjectCreator.UseCtor]
public WorldInteractionControllerWidget([ObjectCreator.Param] World world, [ObjectCreator.Param] WorldRenderer worldRenderer)
public WorldInteractionControllerWidget(World world, WorldRenderer worldRenderer)
{
this.world = world;
this.worldRenderer = worldRenderer;