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

@@ -16,8 +16,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public class ButtonTooltipLogic
{
[ObjectCreator.UseCtor]
public ButtonTooltipLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] ToggleButtonWidget button)
public ButtonTooltipLogic(Widget widget, ToggleButtonWidget button)
{
var label = widget.GetWidget<LabelWidget>("LABEL");
var hotkey = widget.GetWidget<LabelWidget>("HOTKEY");

View File

@@ -27,9 +27,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public class CncCheatsLogic
{
[ObjectCreator.UseCtor]
public CncCheatsLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] Action onExit,
[ObjectCreator.Param] World world)
public CncCheatsLogic(Widget widget, Action onExit, World world)
{
var panel = widget.GetWidget("CHEATS_PANEL");

View File

@@ -19,11 +19,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
{
ColorRamp ramp;
[ObjectCreator.UseCtor]
public CncColorPickerLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] ColorRamp initialRamp,
[ObjectCreator.Param] Action<ColorRamp> onChange,
[ObjectCreator.Param] Action<ColorRamp> onSelect,
[ObjectCreator.Param] WorldRenderer worldRenderer)
public CncColorPickerLogic(Widget widget, ColorRamp initialRamp, Action<ColorRamp> onChange,
Action<ColorRamp> onSelect, WorldRenderer worldRenderer)
{
var panel = widget.GetWidget("COLOR_CHOOSER");
ramp = initialRamp;

View File

@@ -48,12 +48,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
}
[ObjectCreator.UseCtor]
public CncConnectingLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] string host,
[ObjectCreator.Param] int port,
[ObjectCreator.Param] Action onConnect,
[ObjectCreator.Param] Action onRetry,
[ObjectCreator.Param] Action onAbort)
public CncConnectingLogic(Widget widget, string host, int port, Action onConnect, Action onRetry, Action onAbort)
{
this.host = host;
this.port = port;
@@ -87,11 +82,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public class CncConnectionFailedLogic
{
[ObjectCreator.UseCtor]
public CncConnectionFailedLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] string host,
[ObjectCreator.Param] int port,
[ObjectCreator.Param] Action onRetry,
[ObjectCreator.Param] Action onAbort)
public CncConnectionFailedLogic(Widget widget, string host, int port, Action onRetry, Action onAbort)
{
var panel = widget.GetWidget("CONNECTIONFAILED_PANEL");
panel.GetWidget<ButtonWidget>("ABORT_BUTTON").OnClick = () => { Widget.CloseWindow(); onAbort(); };

View File

@@ -19,8 +19,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public class CncConquestObjectivesLogic
{
[ObjectCreator.UseCtor]
public CncConquestObjectivesLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] World world)
public CncConquestObjectivesLogic(Widget widget, World world)
{
var panel = widget.GetWidget("CONQUEST_OBJECTIVES");
panel.GetWidget<LabelWidget>("TITLE").GetText = () => "Conquest: " + world.Map.Title;

View File

@@ -17,9 +17,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public class CncDirectConnectLogic
{
[ObjectCreator.UseCtor]
public CncDirectConnectLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] Action onExit,
[ObjectCreator.Param] Action openLobby)
public CncDirectConnectLogic(Widget widget, Action onExit, Action openLobby)
{
var panel = widget.GetWidget("DIRECTCONNECT_PANEL");
var ipField = panel.GetWidget<TextFieldWidget>("IP");

View File

@@ -65,8 +65,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
}
[ObjectCreator.UseCtor]
public CncIngameChromeLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] World world )
public CncIngameChromeLogic(Widget widget, World world)
{
this.world = world;
world.WorldActor.Trait<CncMenuPaletteEffect>()

View File

@@ -20,9 +20,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
Widget menu;
[ObjectCreator.UseCtor]
public CncIngameMenuLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] World world,
[ObjectCreator.Param] Action onExit)
public CncIngameMenuLogic(Widget widget, World world, Action onExit)
{
var resumeDisabled = false;
menu = widget.GetWidget("INGAME_MENU");

View File

@@ -29,10 +29,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
string[] filesToCopy, filesToExtract;
[ObjectCreator.UseCtor]
public CncInstallFromCDLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] Action afterInstall,
[ObjectCreator.Param] string[] filesToCopy,
[ObjectCreator.Param] string[] filesToExtract)
public CncInstallFromCDLogic(Widget widget, Action afterInstall, string[] filesToCopy, string[] filesToExtract)
{
this.afterInstall = afterInstall;
this.filesToCopy = filesToCopy;

View File

@@ -17,9 +17,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public class CncInstallLogic
{
[ObjectCreator.UseCtor]
public CncInstallLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] Dictionary<string,string> installData,
[ObjectCreator.Param] Action continueLoading)
public CncInstallLogic(Widget widget, Dictionary<string,string> installData, Action continueLoading)
{
var panel = widget.GetWidget("INSTALL_PANEL");
var args = new WidgetArgs()

View File

@@ -85,13 +85,10 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
}
[ObjectCreator.UseCtor]
internal CncLobbyLogic([ObjectCreator.Param( "widget" )] Widget lobby,
[ObjectCreator.Param] World world, // Shellmap world
[ObjectCreator.Param] OrderManager orderManager,
[ObjectCreator.Param] Action onExit,
[ObjectCreator.Param] Action onStart,
[ObjectCreator.Param] bool addBots)
internal CncLobbyLogic(Widget widget, World world, OrderManager orderManager,
Action onExit, Action onStart, bool addBots)
{
var lobby = widget;
this.orderManager = orderManager;
this.OnGameStart = () => { CloseWindow(); onStart(); };
this.onExit = onExit;

View File

@@ -23,8 +23,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
Widget rootMenu;
[ObjectCreator.UseCtor]
public CncMenuLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] World world)
public CncMenuLogic(Widget widget, World world)
{
world.WorldActor.Trait<CncMenuPaletteEffect>()
.Fade(CncMenuPaletteEffect.EffectType.Desaturated);

View File

@@ -21,9 +21,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
Mod currentMod;
[ObjectCreator.UseCtor]
public CncModBrowserLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] Action onSwitch,
[ObjectCreator.Param] Action onExit)
public CncModBrowserLogic(Widget widget, Action onSwitch, Action onExit)
{
var panel = widget.GetWidget("MODS_PANEL");
var modList = panel.GetWidget<ScrollPanelWidget>("MOD_LIST");

View File

@@ -30,8 +30,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
ScrollItemWidget itemTemplate;
[ObjectCreator.UseCtor]
public CncMusicPlayerLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] Action onExit)
public CncMusicPlayerLogic(Widget widget, Action onExit)
{
panel = widget.GetWidget("MUSIC_PANEL");

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public class CncPerfDebugLogic
{
[ObjectCreator.UseCtor]
public CncPerfDebugLogic([ObjectCreator.Param] Widget widget)
public CncPerfDebugLogic(Widget widget)
{
// Performance info
var perfRoot = widget.GetWidget("PERFORMANCE_INFO");

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
@@ -21,9 +21,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
Widget panel;
[ObjectCreator.UseCtor]
public CncReplayBrowserLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] Action onExit,
[ObjectCreator.Param] Action onStart)
public CncReplayBrowserLogic(Widget widget, Action onExit, Action onStart)
{
panel = widget.GetWidget("REPLAYBROWSER_PANEL");

View File

@@ -41,9 +41,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
}
[ObjectCreator.UseCtor]
public CncServerBrowserLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] Action openLobby,
[ObjectCreator.Param] Action onExit)
public CncServerBrowserLogic(Widget widget, Action openLobby, Action onExit)
{
var panel = widget.GetWidget("SERVERBROWSER_PANEL");
var sl = panel.GetWidget<ScrollPanelWidget>("SERVER_LIST");

View File

@@ -25,9 +25,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
bool advertiseOnline;
[ObjectCreator.UseCtor]
public CncServerCreationLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] Action onExit,
[ObjectCreator.Param] Action openLobby)
public CncServerCreationLogic(Widget widget, Action onExit, Action openLobby)
{
panel = widget.GetWidget("CREATESERVER_PANEL");
onCreate = openLobby;

View File

@@ -29,9 +29,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
World world;
[ObjectCreator.UseCtor]
public CncSettingsLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] World world,
[ObjectCreator.Param] Action onExit)
public CncSettingsLogic(Widget widget, World world, Action onExit)
{
this.world = world;
var panel = widget.GetWidget("SETTINGS_PANEL");

View File

@@ -22,9 +22,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public class ProductionTooltipLogic
{
[ObjectCreator.UseCtor]
public ProductionTooltipLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
[ObjectCreator.Param] ProductionPaletteWidget palette)
public ProductionTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, ProductionPaletteWidget palette)
{
var pm = palette.world.LocalPlayer.PlayerActor.Trait<PowerManager>();
var pr = palette.world.LocalPlayer.PlayerActor.Trait<PlayerResources>();

View File

@@ -17,9 +17,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public class SimpleTooltipLogic
{
[ObjectCreator.UseCtor]
public SimpleTooltipLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
[ObjectCreator.Param] Func<string> getText)
public SimpleTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, Func<string> getText)
{
var label = widget.GetWidget<LabelWidget>("LABEL");

View File

@@ -18,9 +18,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public class SupportPowerTooltipLogic
{
[ObjectCreator.UseCtor]
public SupportPowerTooltipLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
[ObjectCreator.Param] SupportPowersWidget palette)
public SupportPowerTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, SupportPowersWidget palette)
{
widget.IsVisible = () => palette.TooltipPower != null;
var nameLabel = widget.GetWidget<LabelWidget>("NAME");

View File

@@ -12,18 +12,16 @@ using System;
using System.Drawing;
using OpenRA.Support;
using OpenRA.Widgets;
using Type = OpenRA.Mods.Cnc.Widgets.CncWorldInteractionControllerWidget.WorldTooltipType;
using TooltipType = OpenRA.Mods.Cnc.Widgets.CncWorldInteractionControllerWidget.WorldTooltipType;
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class WorldTooltipLogic
{
[ObjectCreator.UseCtor]
public WorldTooltipLogic([ObjectCreator.Param] Widget widget,
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
[ObjectCreator.Param] CncWorldInteractionControllerWidget wic)
public WorldTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, CncWorldInteractionControllerWidget wic)
{
widget.IsVisible = () => wic.TooltipType != Type.None;
widget.IsVisible = () => wic.TooltipType != TooltipType.None;
var label = widget.GetWidget<LabelWidget>("LABEL");
var flag = widget.GetWidget<ImageWidget>("FLAG");
var owner = widget.GetWidget<LabelWidget>("OWNER");
@@ -41,10 +39,10 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
tooltipContainer.BeforeRender = () =>
{
if (wic == null || wic.TooltipType == Type.None)
if (wic == null || wic.TooltipType == TooltipType.None)
return;
labelText = wic.TooltipType == Type.Unexplored ? "Unexplored Terrain" :
labelText = wic.TooltipType == TooltipType.Unexplored ? "Unexplored Terrain" :
wic.ActorTooltip.Name();
var textWidth = font.Measure(labelText).X;
if (textWidth != cachedWidth)
@@ -53,7 +51,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
widget.Bounds.Width = 2*label.Bounds.X + textWidth;
}
var o = wic.ActorTooltip != null ? wic.ActorTooltip.Owner() : null;
showOwner = wic.TooltipType == Type.Actor && o != null && !o.NonCombatant;
showOwner = wic.TooltipType == TooltipType.Actor && o != null && !o.NonCombatant;
if (showOwner)
{