diff --git a/OpenRA.FileFormats/Platform.cs b/OpenRA.FileFormats/Platform.cs index 5a27d573c1..f07398c460 100644 --- a/OpenRA.FileFormats/Platform.cs +++ b/OpenRA.FileFormats/Platform.cs @@ -21,7 +21,7 @@ namespace OpenRA { public static PlatformType CurrentPlatform { get { return currentPlatform.Value; } } - static Lazy currentPlatform = new Lazy(GetCurrentPlatform); + static Lazy currentPlatform = Lazy.New(GetCurrentPlatform); static PlatformType GetCurrentPlatform() { diff --git a/OpenRA.Game/ObjectCreator.cs b/OpenRA.Game/ObjectCreator.cs index f71eaea062..fe84654a78 100755 --- a/OpenRA.Game/ObjectCreator.cs +++ b/OpenRA.Game/ObjectCreator.cs @@ -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().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 {} } } diff --git a/OpenRA.Game/Widgets/ChatEntryWidget.cs b/OpenRA.Game/Widgets/ChatEntryWidget.cs index b4cac67d85..cf6932241f 100755 --- a/OpenRA.Game/Widgets/ChatEntryWidget.cs +++ b/OpenRA.Game/Widgets/ChatEntryWidget.cs @@ -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; } diff --git a/OpenRA.Game/Widgets/ShpImageWidget.cs b/OpenRA.Game/Widgets/ShpImageWidget.cs index aa12a14f43..88388f1aca 100644 --- a/OpenRA.Game/Widgets/ShpImageWidget.cs +++ b/OpenRA.Game/Widgets/ShpImageWidget.cs @@ -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; }; diff --git a/OpenRA.Game/Widgets/VqaPlayerWidget.cs b/OpenRA.Game/Widgets/VqaPlayerWidget.cs index 789108deaa..6c6933981f 100644 --- a/OpenRA.Game/Widgets/VqaPlayerWidget.cs +++ b/OpenRA.Game/Widgets/VqaPlayerWidget.cs @@ -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; } diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index 7e7710086a..df8d4f031c 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -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; diff --git a/OpenRA.Mods.Cnc/CncMenuPaletteEffect.cs b/OpenRA.Mods.Cnc/CncMenuPaletteEffect.cs index e4c997ff2d..9d8220ec8f 100644 --- a/OpenRA.Mods.Cnc/CncMenuPaletteEffect.cs +++ b/OpenRA.Mods.Cnc/CncMenuPaletteEffect.cs @@ -32,6 +32,7 @@ namespace OpenRA.Mods.Cnc EffectType to = EffectType.Black; public CncMenuPaletteEffect(CncMenuPaletteEffectInfo info) { Info = info; } + public void Fade(EffectType type) { remainingFrames = Info.FadeLength; diff --git a/OpenRA.Mods.Cnc/DeadBuildingState.cs b/OpenRA.Mods.Cnc/DeadBuildingState.cs index 0c6a8c62af..d4aa5c8fb7 100644 --- a/OpenRA.Mods.Cnc/DeadBuildingState.cs +++ b/OpenRA.Mods.Cnc/DeadBuildingState.cs @@ -16,6 +16,7 @@ namespace OpenRA.Mods.Cnc class DeadBuildingStateInfo : ITraitInfo, Requires, Requires { public readonly int LingerTime = 20; + public object Create(ActorInitializer init) { return new DeadBuildingState(init.self, this); } } @@ -23,6 +24,7 @@ namespace OpenRA.Mods.Cnc { DeadBuildingStateInfo info; RenderSimple rs; + public DeadBuildingState(Actor self, DeadBuildingStateInfo info) { this.info = info; diff --git a/OpenRA.Mods.Cnc/PoisonedByTiberium.cs b/OpenRA.Mods.Cnc/PoisonedByTiberium.cs index 6090f4b160..3bdb6330bf 100644 --- a/OpenRA.Mods.Cnc/PoisonedByTiberium.cs +++ b/OpenRA.Mods.Cnc/PoisonedByTiberium.cs @@ -15,8 +15,7 @@ namespace OpenRA.Mods.Cnc { class PoisonedByTiberiumInfo : ITraitInfo { - [WeaponReference] - public readonly string Weapon = "Tiberium"; + [WeaponReference] public readonly string Weapon = "Tiberium"; public readonly string[] Resources = { "Tiberium", "BlueTiberium" }; public object Create(ActorInitializer init) { return new PoisonedByTiberium(this); } diff --git a/OpenRA.Mods.Cnc/ProductionAirdrop.cs b/OpenRA.Mods.Cnc/ProductionAirdrop.cs index 755f62d56f..07d2debd6d 100644 --- a/OpenRA.Mods.Cnc/ProductionAirdrop.cs +++ b/OpenRA.Mods.Cnc/ProductionAirdrop.cs @@ -22,6 +22,7 @@ namespace OpenRA.Mods.Cnc { public readonly string ReadyAudio = "reinfor1.aud"; [ActorReference] public readonly string ActorType = "c17"; + public override object Create(ActorInitializer init) { return new ProductionAirdrop(this); } } diff --git a/OpenRA.Mods.Cnc/ProductionQueueFromSelection.cs b/OpenRA.Mods.Cnc/ProductionQueueFromSelection.cs index 9c786e0627..58320c41ac 100644 --- a/OpenRA.Mods.Cnc/ProductionQueueFromSelection.cs +++ b/OpenRA.Mods.Cnc/ProductionQueueFromSelection.cs @@ -19,6 +19,7 @@ namespace OpenRA.Mods.Cnc.Widgets class ProductionQueueFromSelectionInfo : ITraitInfo { public string ProductionTabsWidget = null; + public object Create( ActorInitializer init ) { return new ProductionQueueFromSelection(init.world, this); } } @@ -31,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Widgets { this.world = world; - tabsWidget = new Lazy(() => + tabsWidget = Lazy.New(() => Widget.RootWidget.GetWidget(info.ProductionTabsWidget)); } diff --git a/OpenRA.Mods.Cnc/RenderGunboat.cs b/OpenRA.Mods.Cnc/RenderGunboat.cs index 39916c4278..c11c5ab13e 100644 --- a/OpenRA.Mods.Cnc/RenderGunboat.cs +++ b/OpenRA.Mods.Cnc/RenderGunboat.cs @@ -22,6 +22,8 @@ namespace OpenRA.Mods.RA.Render class RenderGunboat : RenderSimple, INotifyDamageStateChanged { IFacing facing; + string lastDir = "left"; + string lastDamage = ""; public RenderGunboat(Actor self) : base(self, () => self.HasTrait() ? self.Trait().turretFacing : 0) @@ -35,8 +37,6 @@ namespace OpenRA.Mods.RA.Render anims.Add( "wake", new AnimationWithOffset( wake, offset, () => false ) { ZOffset = -2 } ); } - string lastDir = "left"; - string lastDamage = ""; public override void Tick(Actor self) { var dir = (facing.Facing > 128) ? "right" : "left"; diff --git a/OpenRA.Mods.Cnc/TiberiumRefinery.cs b/OpenRA.Mods.Cnc/TiberiumRefinery.cs index 63d923b77d..49a77be9ea 100644 --- a/OpenRA.Mods.Cnc/TiberiumRefinery.cs +++ b/OpenRA.Mods.Cnc/TiberiumRefinery.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Cnc public class TiberiumRefinery : OreRefinery { public TiberiumRefinery(Actor self, TiberiumRefineryInfo info) - : base(self, info as OreRefineryInfo) {} + : base(self, info) {} public override Activity DockSequence(Actor harv, Actor self) { diff --git a/OpenRA.Mods.Cnc/Widgets/CncWorldInteractionControllerWidget.cs b/OpenRA.Mods.Cnc/Widgets/CncWorldInteractionControllerWidget.cs index 751e645185..b4251dd5e0 100644 --- a/OpenRA.Mods.Cnc/Widgets/CncWorldInteractionControllerWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/CncWorldInteractionControllerWidget.cs @@ -32,18 +32,18 @@ namespace OpenRA.Mods.Cnc.Widgets ScrollDirection Edge; [ObjectCreator.UseCtor] - public CncWorldInteractionControllerWidget([ObjectCreator.Param] World world, - [ObjectCreator.Param] WorldRenderer worldRenderer) + public CncWorldInteractionControllerWidget(World world, WorldRenderer worldRenderer) : base(world, worldRenderer) { - tooltipContainer = new Lazy(() => + tooltipContainer = Lazy.New(() => Widget.RootWidget.GetWidget(TooltipContainer)); } public override void MouseEntered() { if (TooltipContainer == null) return; - tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs() {{ "world", world }, { "wic", this }}); + tooltipContainer.Value.SetTooltip(TooltipTemplate, + new WidgetArgs() {{ "world", world }, { "wic", this }}); } public override void MouseExited() diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/ButtonTooltipLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/ButtonTooltipLogic.cs index 1852f3af5f..f9aa825b24 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/ButtonTooltipLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/ButtonTooltipLogic.cs @@ -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("LABEL"); var hotkey = widget.GetWidget("HOTKEY"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncCheatsLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncCheatsLogic.cs index d77258ef25..456acc4f7a 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncCheatsLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncCheatsLogic.cs @@ -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"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncColorPickerLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncColorPickerLogic.cs index 0a2fc7aeb5..8c001be9dc 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncColorPickerLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncColorPickerLogic.cs @@ -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 onChange, - [ObjectCreator.Param] Action onSelect, - [ObjectCreator.Param] WorldRenderer worldRenderer) + public CncColorPickerLogic(Widget widget, ColorRamp initialRamp, Action onChange, + Action onSelect, WorldRenderer worldRenderer) { var panel = widget.GetWidget("COLOR_CHOOSER"); ramp = initialRamp; diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncConnectionLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncConnectionLogic.cs index 4181f90b86..fca61bfc6b 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncConnectionLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncConnectionLogic.cs @@ -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("ABORT_BUTTON").OnClick = () => { Widget.CloseWindow(); onAbort(); }; diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncConquestObjectivesLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncConquestObjectivesLogic.cs index cccc45d308..9d104792da 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncConquestObjectivesLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncConquestObjectivesLogic.cs @@ -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("TITLE").GetText = () => "Conquest: " + world.Map.Title; diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncDirectConnectLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncDirectConnectLogic.cs index 3eb3bdb937..3f34dfbf60 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncDirectConnectLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncDirectConnectLogic.cs @@ -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("IP"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs index f53bc569a6..a7d1c50b5f 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs @@ -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() diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs index 1fa66fd337..0bbe512cde 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs @@ -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"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs index 7c58dda988..c1816b2e05 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs @@ -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; diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallLogic.cs index af17fdcadb..6e7096598f 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallLogic.cs @@ -17,9 +17,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic public class CncInstallLogic { [ObjectCreator.UseCtor] - public CncInstallLogic([ObjectCreator.Param] Widget widget, - [ObjectCreator.Param] Dictionary installData, - [ObjectCreator.Param] Action continueLoading) + public CncInstallLogic(Widget widget, Dictionary installData, Action continueLoading) { var panel = widget.GetWidget("INSTALL_PANEL"); var args = new WidgetArgs() diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs index dc7ce3f781..16e0b37f40 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs @@ -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; diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncMenuLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncMenuLogic.cs index 8e488c1943..22851ec338 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncMenuLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncMenuLogic.cs @@ -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() .Fade(CncMenuPaletteEffect.EffectType.Desaturated); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncModBrowserLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncModBrowserLogic.cs index cd76582b22..f013b1ea88 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncModBrowserLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncModBrowserLogic.cs @@ -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("MOD_LIST"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs index 0dfa7c44ee..0c8f555355 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs @@ -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"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncPerfDebugLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncPerfDebugLogic.cs index c500f94dc7..4c723f2bf4 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncPerfDebugLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncPerfDebugLogic.cs @@ -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"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncReplayBrowserLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncReplayBrowserLogic.cs index cb5f700d09..ef00f05bd0 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncReplayBrowserLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncReplayBrowserLogic.cs @@ -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"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs index df6fa85b40..4ce8fced52 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs @@ -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("SERVER_LIST"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncServerCreationLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncServerCreationLogic.cs index f2bf75e6aa..dd6befebbf 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncServerCreationLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncServerCreationLogic.cs @@ -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; diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs index dc6cf375c8..e998a5a6ea 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs @@ -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"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs index ea72a0435c..52b44efe43 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs @@ -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(); var pr = palette.world.LocalPlayer.PlayerActor.Trait(); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/SimpleTooltipLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/SimpleTooltipLogic.cs index d92556ccda..e67c73726c 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/SimpleTooltipLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/SimpleTooltipLogic.cs @@ -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 getText) + public SimpleTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, Func getText) { var label = widget.GetWidget("LABEL"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/SupportPowerTooltipLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/SupportPowerTooltipLogic.cs index cf7b360066..7ed763bb5d 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/SupportPowerTooltipLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/SupportPowerTooltipLogic.cs @@ -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("NAME"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/WorldTooltipLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/WorldTooltipLogic.cs index 58e70cdc2b..4c8d790e85 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/WorldTooltipLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/WorldTooltipLogic.cs @@ -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("LABEL"); var flag = widget.GetWidget("FLAG"); var owner = widget.GetWidget("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) { diff --git a/OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs b/OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs index 3a2ab0b3ae..078e65d205 100755 --- a/OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs @@ -28,10 +28,10 @@ namespace OpenRA.Mods.Cnc.Widgets readonly PowerManager pm; [ObjectCreator.UseCtor] - public PowerBarWidget( [ObjectCreator.Param] World world ) + public PowerBarWidget(World world) { pm = world.LocalPlayer.PlayerActor.Trait(); - tooltipContainer = new Lazy(() => + tooltipContainer = Lazy.New(() => Widget.RootWidget.GetWidget(TooltipContainer)); } diff --git a/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs index d89871deba..08b1e8ec6a 100755 --- a/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs @@ -43,17 +43,11 @@ namespace OpenRA.Mods.Cnc.Widgets Lazy tooltipContainer; ProductionQueue currentQueue; + public ProductionQueue CurrentQueue { - get - { - return currentQueue; - } - set - { - currentQueue = value; - RefreshIcons(); - } + get { return currentQueue; } + set { currentQueue = value; RefreshIcons(); } } public override Rectangle EventBounds { get { return eventBounds; } } @@ -66,12 +60,11 @@ namespace OpenRA.Mods.Cnc.Widgets readonly float2 holdOffset, readyOffset, timeOffset, queuedOffset; [ObjectCreator.UseCtor] - public ProductionPaletteWidget([ObjectCreator.Param] World world, - [ObjectCreator.Param] WorldRenderer worldRenderer) + public ProductionPaletteWidget(World world, WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; - tooltipContainer = new Lazy(() => + tooltipContainer = Lazy.New(() => Widget.RootWidget.GetWidget(TooltipContainer)); cantBuild = new Animation("clock"); diff --git a/OpenRA.Mods.Cnc/Widgets/ProductionTabsWidget.cs b/OpenRA.Mods.Cnc/Widgets/ProductionTabsWidget.cs index ee6d5fcdfc..f1640b8767 100755 --- a/OpenRA.Mods.Cnc/Widgets/ProductionTabsWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/ProductionTabsWidget.cs @@ -78,7 +78,7 @@ namespace OpenRA.Mods.Cnc.Widgets string queueGroup; [ObjectCreator.UseCtor] - public ProductionTabsWidget([ObjectCreator.Param] World world) + public ProductionTabsWidget(World world) { Groups = Rules.Info.Values.SelectMany(a => a.Traits.WithInterface()) .Select(q => q.Group).Distinct().ToDictionary(g => g, g => new ProductionTabGroup() { Group = g }); @@ -86,8 +86,7 @@ namespace OpenRA.Mods.Cnc.Widgets // Only visible if the production palette has icons to display IsVisible = () => queueGroup != null && Groups[queueGroup].Tabs.Count > 0; - paletteWidget = new Lazy(() => - Widget.RootWidget.GetWidget(PaletteWidget)); + paletteWidget = Lazy.New(() => Widget.RootWidget.GetWidget(PaletteWidget)); } public void SelectNextTab(bool reverse) @@ -108,10 +107,7 @@ namespace OpenRA.Mods.Cnc.Widgets public string QueueGroup { - get - { - return queueGroup; - } + get { return queueGroup; } set { ListOffset = 0; @@ -122,10 +118,7 @@ namespace OpenRA.Mods.Cnc.Widgets public ProductionQueue CurrentQueue { - get - { - return paletteWidget.Value.CurrentQueue; - } + get { return paletteWidget.Value.CurrentQueue; } set { paletteWidget.Value.CurrentQueue = value; @@ -268,7 +261,7 @@ namespace OpenRA.Mods.Cnc.Widgets return true; } - return (leftPressed || rightPressed); + return leftPressed || rightPressed; } public override bool HandleKeyPress(KeyInput e) diff --git a/OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs b/OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs index ab665dd943..0223b10f6d 100755 --- a/OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs @@ -28,11 +28,12 @@ namespace OpenRA.Mods.Cnc.Widgets float? lastStoredFrac; readonly PlayerResources pr; + [ObjectCreator.UseCtor] - public SiloBarWidget( [ObjectCreator.Param] World world ) + public SiloBarWidget(World world) { pr = world.LocalPlayer.PlayerActor.Trait(); - tooltipContainer = new Lazy(() => + tooltipContainer = Lazy.New(() => Widget.RootWidget.GetWidget(TooltipContainer)); } diff --git a/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs index 4dd2fea7b0..5b65ff3de3 100755 --- a/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs @@ -40,12 +40,11 @@ namespace OpenRA.Mods.Cnc.Widgets readonly float2 holdOffset, readyOffset, timeOffset; [ObjectCreator.UseCtor] - public SupportPowersWidget([ObjectCreator.Param] World world, - [ObjectCreator.Param] WorldRenderer worldRenderer) + public SupportPowersWidget(World world, WorldRenderer worldRenderer) { this.worldRenderer = worldRenderer; spm = world.LocalPlayer.PlayerActor.Trait(); - tooltipContainer = new Lazy(() => + tooltipContainer = Lazy.New(() => Widget.RootWidget.GetWidget(TooltipContainer)); iconSprites = Rules.Info.Values.SelectMany( u => u.Traits.WithInterface() ) @@ -117,16 +116,16 @@ namespace OpenRA.Mods.Cnc.Widgets { if (p.Power.Ready) overlayFont.DrawTextWithContrast("Ready", - p.Pos + readyOffset, - Color.White, Color.Black, 1); + p.Pos + readyOffset, + Color.White, Color.Black, 1); else if (!p.Power.Active) overlayFont.DrawTextWithContrast("On Hold", - p.Pos + holdOffset, - Color.White, Color.Black, 1); + p.Pos + holdOffset, + Color.White, Color.Black, 1); else overlayFont.DrawTextWithContrast(WidgetUtils.FormatTime(p.Power.RemainingTime), - p.Pos + timeOffset, - Color.White, Color.Black, 1); + p.Pos + timeOffset, + Color.White, Color.Black, 1); } } @@ -139,7 +138,8 @@ namespace OpenRA.Mods.Cnc.Widgets public override void MouseEntered() { if (TooltipContainer == null) return; - tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs() {{ "palette", this }}); + tooltipContainer.Value.SetTooltip(TooltipTemplate, + new WidgetArgs() {{ "palette", this }}); } public override void MouseExited() diff --git a/OpenRA.Mods.Cnc/Widgets/ToggleButtonWidget.cs b/OpenRA.Mods.Cnc/Widgets/ToggleButtonWidget.cs index b1208c87ae..3870f93c85 100644 --- a/OpenRA.Mods.Cnc/Widgets/ToggleButtonWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/ToggleButtonWidget.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Cnc.Widgets public ToggleButtonWidget() : base() { - tooltipContainer = new Lazy(() => + tooltipContainer = Lazy.New(() => Widget.RootWidget.GetWidget(TooltipContainer)); } @@ -36,14 +36,15 @@ namespace OpenRA.Mods.Cnc.Widgets TooltipTemplate = other.TooltipTemplate; TooltipText = other.TooltipText; TooltipContainer = other.TooltipContainer; - tooltipContainer = new Lazy(() => + tooltipContainer = Lazy.New(() => Widget.RootWidget.GetWidget(TooltipContainer)); } public override void MouseEntered() { if (TooltipContainer == null) return; - tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs() {{ "button", this }}); + tooltipContainer.Value.SetTooltip(TooltipTemplate, + new WidgetArgs() {{ "button", this }}); } public override void MouseExited() diff --git a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs index 7bc41ea049..89c752a729 100755 --- a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs +++ b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs @@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA.Widgets readonly World world; [ObjectCreator.UseCtor] - public BuildPaletteWidget( [ObjectCreator.Param] World world, [ObjectCreator.Param] WorldRenderer worldRenderer ) + public BuildPaletteWidget(World world, WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; diff --git a/OpenRA.Mods.RA/Widgets/Logic/ConnectionDialogsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ConnectionDialogsLogic.cs index af57d27391..c27afca6c2 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ConnectionDialogsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ConnectionDialogsLogic.cs @@ -16,10 +16,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class ConnectionDialogsLogic { [ObjectCreator.UseCtor] - public ConnectionDialogsLogic( - [ObjectCreator.Param] Widget widget, - [ObjectCreator.Param] string host, - [ObjectCreator.Param] int port ) + public ConnectionDialogsLogic(Widget widget, string host, int port) { widget.GetWidget("CONNECTION_BUTTON_ABORT").OnClick = () => { widget.GetWidget("CONNECTION_BUTTON_ABORT").Parent.Visible = false; @@ -37,9 +34,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class ConnectionFailedLogic { [ObjectCreator.UseCtor] - public ConnectionFailedLogic( - [ObjectCreator.Param] Widget widget, - [ObjectCreator.Param] OrderManager orderManager) + public ConnectionFailedLogic(Widget widget, OrderManager orderManager) { widget.GetWidget("CONNECTION_BUTTON_CANCEL").OnClick = () => { widget.GetWidget("CONNECTION_BUTTON_CANCEL").Parent.Visible = false; diff --git a/OpenRA.Mods.RA/Widgets/Logic/CreateServerMenuLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/CreateServerMenuLogic.cs index 33a33316cd..ab94cf658e 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/CreateServerMenuLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/CreateServerMenuLogic.cs @@ -18,9 +18,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class CreateServerMenuLogic { [ObjectCreator.UseCtor] - public CreateServerMenuLogic( [ObjectCreator.Param( "widget" )] Widget cs ) + public CreateServerMenuLogic(Widget widget) { var settings = Game.Settings; + var cs = widget; cs.GetWidget("BUTTON_CANCEL").OnClick = () => Widget.CloseWindow(); cs.GetWidget("BUTTON_START").OnClick = () => diff --git a/OpenRA.Mods.RA/Widgets/Logic/DeveloperModeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/DeveloperModeLogic.cs index 040757c8c7..2e40e26e06 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/DeveloperModeLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/DeveloperModeLogic.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class DeveloperModeLogic { [ObjectCreator.UseCtor] - public DeveloperModeLogic( [ObjectCreator.Param] World world ) + public DeveloperModeLogic(World world) { var devmodeBG = Widget.RootWidget.GetWidget("INGAME_ROOT").GetWidget("DEVELOPERMODE_BG"); var devModeButton = Widget.RootWidget.GetWidget("INGAME_DEVELOPERMODE_BUTTON"); diff --git a/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs index e748bfeac3..2f832e9f3d 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic readonly World world; [ObjectCreator.UseCtor] - public DiplomacyLogic( [ObjectCreator.Param] World world ) + public DiplomacyLogic(World world) { this.world = world; var root = Widget.RootWidget.GetWidget("INGAME_ROOT"); diff --git a/OpenRA.Mods.RA/Widgets/Logic/DirectConnectLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/DirectConnectLogic.cs index bde8ad5bd3..83fa978d1b 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/DirectConnectLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/DirectConnectLogic.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class DirectConnectLogic { [ObjectCreator.UseCtor] - public DirectConnectLogic( [ObjectCreator.Param] Widget widget ) + public DirectConnectLogic(Widget widget) { var dc = widget.GetWidget("DIRECTCONNECT_BG"); diff --git a/OpenRA.Mods.RA/Widgets/Logic/DownloadPackagesLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/DownloadPackagesLogic.cs index 13f5f08ffc..2472491522 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/DownloadPackagesLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/DownloadPackagesLogic.cs @@ -26,11 +26,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic ProgressBarWidget progressBar; LabelWidget statusLabel; Action afterInstall; - + [ObjectCreator.UseCtor] - public DownloadPackagesLogic([ObjectCreator.Param] Widget widget, - [ObjectCreator.Param] Dictionary installData, - [ObjectCreator.Param] Action afterInstall) + public DownloadPackagesLogic(Widget widget, Dictionary installData, Action afterInstall) { this.installData = installData; this.afterInstall = afterInstall; diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs index df4c4727d0..8107afafcc 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Widget gameRoot; [ObjectCreator.UseCtor] - public IngameChromeLogic( [ObjectCreator.Param] World world ) + public IngameChromeLogic(World world) { Game.AddChatLine += AddChatLine; Game.BeforeGameStart += UnregisterEvents; diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameObserverChromeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameObserverChromeLogic.cs index 1623298288..befac04b1f 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/IngameObserverChromeLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/IngameObserverChromeLogic.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic // WTF duplication [ObjectCreator.UseCtor] - public IngameObserverChromeLogic([ObjectCreator.Param] World world) + public IngameObserverChromeLogic(World world) { Game.AddChatLine += AddChatLine; Game.BeforeGameStart += UnregisterEvents; diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 256bf0bb89..100a2a5873 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -36,14 +36,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic readonly WorldRenderer worldRenderer; [ObjectCreator.UseCtor] - internal LobbyLogic([ObjectCreator.Param( "widget" )] Widget lobby, - [ObjectCreator.Param] World world, // Shellmap world - [ObjectCreator.Param] OrderManager orderManager, - [ObjectCreator.Param] WorldRenderer worldRenderer) + internal LobbyLogic(Widget widget, World world, OrderManager orderManager, WorldRenderer worldRenderer) { this.orderManager = orderManager; this.worldRenderer = worldRenderer; - this.lobby = lobby; + this.lobby = widget; Game.BeforeGameStart += CloseWindow; Game.LobbyInfoChanged += UpdateCurrentMap; Game.LobbyInfoChanged += UpdatePlayerList; diff --git a/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs index 16550c5382..2480831dec 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class MainMenuButtonsLogic { [ObjectCreator.UseCtor] - public MainMenuButtonsLogic([ObjectCreator.Param] Widget widget) + public MainMenuButtonsLogic(Widget widget) { Game.modData.WidgetLoader.LoadWidget( new WidgetArgs(), Widget.RootWidget, "PERF_BG" ); widget.GetWidget("MAINMENU_BUTTON_JOIN").OnClick = () => Widget.OpenWindow("JOINSERVER_BG"); diff --git a/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs index 224375f089..70f7d4cc11 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs @@ -21,12 +21,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic ScrollPanelWidget scrollpanel; ScrollItemWidget itemTemplate; string gameMode; - + [ObjectCreator.UseCtor] - internal MapChooserLogic([ObjectCreator.Param] Widget widget, - [ObjectCreator.Param] string initialMap, - [ObjectCreator.Param] Action onExit, - [ObjectCreator.Param] Action onSelect) + internal MapChooserLogic(Widget widget, string initialMap, Action onExit, Action onSelect) { map = Game.modData.AvailableMaps[WidgetUtils.ChooseInitialMap(initialMap)]; diff --git a/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs index 2acf436ff7..5a131d4bbc 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class OrderButtonsChromeLogic { [ObjectCreator.UseCtor] - public OrderButtonsChromeLogic( [ObjectCreator.Param] World world ) + public OrderButtonsChromeLogic(World world) { var r = Widget.RootWidget; var gameRoot = r.GetWidget("INGAME_ROOT"); diff --git a/OpenRA.Mods.RA/Widgets/Logic/RAInstallFromCDLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/RAInstallFromCDLogic.cs index 9f75bc2f4d..736284675b 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/RAInstallFromCDLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/RAInstallFromCDLogic.cs @@ -28,8 +28,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Widget installingContainer, insertDiskContainer; [ObjectCreator.UseCtor] - public RAInstallFromCDLogic([ObjectCreator.Param] Widget widget, - [ObjectCreator.Param] Action continueLoading) + public RAInstallFromCDLogic(Widget widget, Action continueLoading) { this.continueLoading = continueLoading; panel = widget.GetWidget("INSTALL_FROMCD_PANEL"); diff --git a/OpenRA.Mods.RA/Widgets/Logic/RAInstallLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/RAInstallLogic.cs index 685445d529..cb2080fb1c 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/RAInstallLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/RAInstallLogic.cs @@ -17,9 +17,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class RAInstallLogic { [ObjectCreator.UseCtor] - public RAInstallLogic([ObjectCreator.Param] Widget widget, - [ObjectCreator.Param] Dictionary installData, - [ObjectCreator.Param] Action continueLoading) + public RAInstallLogic(Widget widget, Dictionary installData, Action continueLoading) { var panel = widget.GetWidget("INSTALL_PANEL"); var args = new WidgetArgs() diff --git a/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs index 38fe8d9096..f279760699 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs @@ -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,7 +21,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Widget widget; [ObjectCreator.UseCtor] - public ReplayBrowserLogic( [ObjectCreator.Param] Widget widget ) + public ReplayBrowserLogic(Widget widget) { this.widget = widget; diff --git a/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs index f0c8b502d4..9771098efe 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic ScrollItemWidget ServerTemplate; [ObjectCreator.UseCtor] - public ServerBrowserLogic( [ObjectCreator.Param] Widget widget ) + public ServerBrowserLogic(Widget widget) { var bg = widget.GetWidget("JOINSERVER_BG"); diff --git a/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs index a49bd80b74..0cf124bd72 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs @@ -20,6 +20,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class SettingsMenuLogic { Widget bg; + public SettingsMenuLogic() { bg = Widget.RootWidget.GetWidget("SETTINGS_MENU"); diff --git a/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs b/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs index 0fb3c6faf8..58b07ce3ba 100755 --- a/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Widgets readonly PlayerResources playerResources; [ObjectCreator.UseCtor] - public MoneyBinWidget( [ObjectCreator.Param] World world ) + public MoneyBinWidget(World world) { this.world = world; playerResources = world.LocalPlayer.PlayerActor.Trait(); diff --git a/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs b/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs index 6c66dd1963..d92108d79a 100755 --- a/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Widgets readonly World world; [ObjectCreator.UseCtor] - public PowerBinWidget( [ObjectCreator.Param] World world ) + public PowerBinWidget(World world) { this.world = world; diff --git a/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs b/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs index c711a2746a..bde714b493 100755 --- a/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs @@ -45,8 +45,9 @@ namespace OpenRA.Mods.RA.Widgets public float2 RadarOrigin { get { return radarOrigin; } } readonly World world; + [ObjectCreator.UseCtor] - public RadarBinWidget( [ObjectCreator.Param] World world ) + public RadarBinWidget(World world) { this.world = world; var size = Math.Max(world.Map.Bounds.Width, world.Map.Bounds.Height); diff --git a/OpenRA.Mods.RA/Widgets/RadarWidget.cs b/OpenRA.Mods.RA/Widgets/RadarWidget.cs index c6b3f708ca..64de3001ee 100755 --- a/OpenRA.Mods.RA/Widgets/RadarWidget.cs +++ b/OpenRA.Mods.RA/Widgets/RadarWidget.cs @@ -35,11 +35,9 @@ namespace OpenRA.Mods.RA.Widgets Sprite shroudSprite; readonly World world; + [ObjectCreator.UseCtor] - public RadarWidget( [ObjectCreator.Param] World world ) - { - this.world = world; - } + public RadarWidget(World world) { this.world = world; } public override void Initialize(WidgetArgs args) { diff --git a/OpenRA.Mods.RA/Widgets/StrategicProgressWidget.cs b/OpenRA.Mods.RA/Widgets/StrategicProgressWidget.cs index e308a86f56..2f17bff93d 100644 --- a/OpenRA.Mods.RA/Widgets/StrategicProgressWidget.cs +++ b/OpenRA.Mods.RA/Widgets/StrategicProgressWidget.cs @@ -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 @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Widgets readonly World world; [ObjectCreator.UseCtor] - public StrategicProgressWidget([ObjectCreator.Param] World world) + public StrategicProgressWidget(World world) { IsVisible = () => true; this.world = world; diff --git a/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs b/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs index 2d736b1be7..1c97c39c50 100755 --- a/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Widgets readonly WorldRenderer worldRenderer; [ObjectCreator.UseCtor] - public SupportPowerBinWidget([ObjectCreator.Param] World world, [ObjectCreator.Param] WorldRenderer worldRenderer) + public SupportPowerBinWidget(World world, WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; diff --git a/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs b/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs index 3f233ce333..c977d27455 100644 --- a/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs +++ b/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs @@ -32,10 +32,7 @@ namespace OpenRA.Mods.RA.Widgets public readonly OrderManager OrderManager; [ObjectCreator.UseCtor] - public WorldCommandWidget([ObjectCreator.Param] OrderManager orderManager ) - { - OrderManager = orderManager; - } + public WorldCommandWidget(OrderManager orderManager) { OrderManager = orderManager; } public override string GetCursor(int2 pos) { return null; } public override Rectangle GetEventBounds() { return Rectangle.Empty; } diff --git a/OpenRA.Mods.RA/Widgets/WorldTooltipWidget.cs b/OpenRA.Mods.RA/Widgets/WorldTooltipWidget.cs index a521184588..b9c297e278 100755 --- a/OpenRA.Mods.RA/Widgets/WorldTooltipWidget.cs +++ b/OpenRA.Mods.RA/Widgets/WorldTooltipWidget.cs @@ -21,11 +21,9 @@ namespace OpenRA.Mods.RA.Widgets { public int TooltipDelay = 10; readonly World world; + [ObjectCreator.UseCtor] - public WorldTooltipWidget( [ObjectCreator.Param] World world ) - { - this.world = world; - } + public WorldTooltipWidget(World world) { this.world = world; } public override void Draw() {