remove redundant parameter from ObjectCreator.Param attribute
This commit is contained in:
@@ -67,7 +67,7 @@ namespace OpenRA
|
||||
{
|
||||
var attrs = p[ i ].GetCustomAttributes<ParamAttribute>();
|
||||
if( attrs.Length != 1 ) throw new InvalidOperationException( "ObjectCreator: argument in [UseCtor] doesn't have [Param]" );
|
||||
a[ i ] = args[ attrs[ 0 ].ParamName ];
|
||||
a[ i ] = args[ attrs[ 0 ].ParamName ?? p[i].Name ];
|
||||
}
|
||||
return ctor.Invoke( a );
|
||||
}
|
||||
@@ -77,6 +77,8 @@ namespace OpenRA
|
||||
{
|
||||
public string ParamName { get; private set; }
|
||||
|
||||
public ParamAttribute() { }
|
||||
|
||||
public ParamAttribute( string paramName )
|
||||
{
|
||||
ParamName = paramName;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
public class ConnectionDialogsDelegate : IWidgetDelegate
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public ConnectionDialogsDelegate( [ObjectCreator.Param( "widget" )] Widget widget )
|
||||
public ConnectionDialogsDelegate( [ObjectCreator.Param] Widget widget )
|
||||
{
|
||||
widget.GetWidget("CONNECTION_BUTTON_ABORT").OnMouseUp = mi => {
|
||||
widget.GetWidget("CONNECTION_BUTTON_ABORT").Parent.Visible = false;
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
public class ConnectionFailedDelegate : IWidgetDelegate
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public ConnectionFailedDelegate( [ObjectCreator.Param( "widget" )] Widget widget )
|
||||
public ConnectionFailedDelegate( [ObjectCreator.Param] Widget widget )
|
||||
{
|
||||
widget.GetWidget("CONNECTION_BUTTON_CANCEL").OnMouseUp = mi => {
|
||||
widget.GetWidget("CONNECTION_BUTTON_CANCEL").Parent.Visible = false;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
{
|
||||
readonly World world;
|
||||
[ObjectCreator.UseCtor]
|
||||
public DeveloperModeDelegate( [ObjectCreator.Param("world")] World world )
|
||||
public DeveloperModeDelegate( [ObjectCreator.Param] World world )
|
||||
{
|
||||
this.world = world;
|
||||
var devmodeBG = Widget.RootWidget.GetWidget("INGAME_ROOT").GetWidget("DEVELOPERMODE_BG");
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
int validPlayers = 0;
|
||||
readonly World world;
|
||||
[ObjectCreator.UseCtor]
|
||||
public DiplomacyDelegate( [ObjectCreator.Param("world")] World world )
|
||||
public DiplomacyDelegate( [ObjectCreator.Param] World world )
|
||||
{
|
||||
this.world = world;
|
||||
var root = Widget.RootWidget.GetWidget("INGAME_ROOT");
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
public class MainMenuButtonsDelegate : IWidgetDelegate
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public MainMenuButtonsDelegate( [ObjectCreator.Param( "widget" )] Widget widget )
|
||||
public MainMenuButtonsDelegate( [ObjectCreator.Param] Widget widget )
|
||||
{
|
||||
// Main menu is the default window
|
||||
widget.GetWidget( "MAINMENU_BUTTON_JOIN" ).OnMouseUp = mi => { Widget.OpenWindow( "JOINSERVER_BG" ); return true; };
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
Widget ServerTemplate;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public ServerBrowserDelegate( [ObjectCreator.Param( "widget" )] Widget widget )
|
||||
public ServerBrowserDelegate( [ObjectCreator.Param] Widget widget )
|
||||
{
|
||||
var bg = widget.GetWidget("JOINSERVER_BG");
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
public class DirectConnectDelegate : IWidgetDelegate
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public DirectConnectDelegate( [ObjectCreator.Param( "widget" )] Widget widget )
|
||||
public DirectConnectDelegate( [ObjectCreator.Param] Widget widget )
|
||||
{
|
||||
var dc = widget.GetWidget("DIRECTCONNECT_BG");
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
readonly World world;
|
||||
[ObjectCreator.UseCtor]
|
||||
public WorldInteractionControllerWidget( [ObjectCreator.Param( "world" )] World world )
|
||||
public WorldInteractionControllerWidget( [ObjectCreator.Param] World world )
|
||||
{
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
|
||||
readonly World world;
|
||||
[ObjectCreator.UseCtor]
|
||||
public BuildPaletteWidget( [ObjectCreator.Param("world")] World world )
|
||||
public BuildPaletteWidget( [ObjectCreator.Param] World world )
|
||||
{
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
{
|
||||
readonly World world;
|
||||
[ObjectCreator.UseCtor]
|
||||
public IngameChromeDelegate( [ObjectCreator.Param("world")] World world )
|
||||
public IngameChromeDelegate( [ObjectCreator.Param] World world )
|
||||
{
|
||||
this.world = world;
|
||||
var r = Widget.RootWidget;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
{
|
||||
readonly World world;
|
||||
[ObjectCreator.UseCtor]
|
||||
public OrderButtonsChromeDelegate( [ObjectCreator.Param("world")] World world )
|
||||
public OrderButtonsChromeDelegate( [ObjectCreator.Param] World world )
|
||||
{
|
||||
this.world = world;
|
||||
var r = Widget.RootWidget;
|
||||
|
||||
Reference in New Issue
Block a user