remove ObjectCreator.Param and all associated nonsense
This commit is contained in:
@@ -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 {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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; };
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user