eradicate 'delegate' misuse

This commit is contained in:
Chris Forbes
2011-05-22 21:58:39 +12:00
parent 4b12a19af0
commit ef03d46f13
72 changed files with 234 additions and 269 deletions

View File

@@ -22,9 +22,9 @@ using System;
using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncCheatsLogic : IWidgetDelegate
public class CncCheatsLogic
{
[ObjectCreator.UseCtor]
public CncCheatsLogic([ObjectCreator.Param] Widget widget,

View File

@@ -12,9 +12,9 @@ using System;
using OpenRA.Network;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncConnectingLogic : IWidgetDelegate
public class CncConnectingLogic
{
static bool staticSetup;
Action onConnect, onRetry, onAbort;
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc.Widgets
if (panel == null)
return;
var handler = panel.DelegateObject as CncConnectingLogic;
var handler = panel.LogicObject as CncConnectingLogic;
if (handler == null)
return;
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Cnc.Widgets
}
}
public class CncConnectionFailedLogic : IWidgetDelegate
public class CncConnectionFailedLogic
{
[ObjectCreator.UseCtor]
public CncConnectionFailedLogic([ObjectCreator.Param] Widget widget,

View File

@@ -9,17 +9,13 @@
#endregion
using System;
using System.Drawing;
using OpenRA.Mods.RA;
using OpenRA.Widgets;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
using System.Linq;
using System.Collections.Generic;
using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncDiplomacyLogic : IWidgetDelegate
public class CncDiplomacyLogic
{
World world;

View File

@@ -17,9 +17,9 @@ using System.Net;
using OpenRA.FileFormats;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncDownloadPackagesLogic : IWidgetDelegate
public class CncDownloadPackagesLogic
{
Widget panel;
Dictionary<string,string> installData;

View File

@@ -8,16 +8,13 @@
*/
#endregion
using System;
using System.Drawing;
using OpenRA.Mods.RA;
using OpenRA.Widgets;
using OpenRA.Mods.RA.Activities;
using System.Linq;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncIngameChromeLogic : IWidgetDelegate
public class CncIngameChromeLogic
{
enum MenuType { None, Diplomacy, Cheats }
MenuType menu = MenuType.None;
@@ -31,7 +28,7 @@ namespace OpenRA.Mods.Cnc.Widgets
if (panel == null)
return;
var handler = panel.DelegateObject as CncIngameChromeLogic;
var handler = panel.LogicObject as CncIngameChromeLogic;
if (handler == null)
return;

View File

@@ -9,14 +9,12 @@
#endregion
using System;
using System.Drawing;
using OpenRA.Mods.RA;
using OpenRA.Widgets;
using OpenRA.Mods.RA.Activities;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncIngameMenuLogic : IWidgetDelegate
public class CncIngameMenuLogic
{
Widget menu;

View File

@@ -16,9 +16,9 @@ using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncInstallFromCDLogic : IWidgetDelegate
public class CncInstallFromCDLogic
{
Widget panel;
ProgressBarWidget progressBar;

View File

@@ -12,9 +12,9 @@ using System;
using System.Collections.Generic;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncInstallLogic : IWidgetDelegate
public class CncInstallLogic
{
[ObjectCreator.UseCtor]
public CncInstallLogic([ObjectCreator.Param] Widget widget,

View File

@@ -18,9 +18,9 @@ using OpenRA.Network;
using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncLobbyLogic : IWidgetDelegate
public class CncLobbyLogic
{
Widget LocalPlayerTemplate, RemotePlayerTemplate, EmptySlotTemplate, EmptySlotTemplateHost;
ScrollPanelWidget chatPanel;
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Cnc.Widgets
if (panel == null)
return null;
return panel.DelegateObject as CncLobbyLogic;
return panel.LogicObject as CncLobbyLogic;
}
static void LobbyInfoChangedStub()
@@ -588,7 +588,7 @@ namespace OpenRA.Mods.Cnc.Widgets
}
}
public class CncColorPickerLogic : IWidgetDelegate
public class CncColorPickerLogic
{
ColorRamp ramp;
[ObjectCreator.UseCtor]

View File

@@ -11,12 +11,11 @@
using System;
using System.IO;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncMapChooserLogic : IWidgetDelegate
public class CncMapChooserLogic
{
Map map;
Widget scrollpanel;

View File

@@ -10,12 +10,11 @@
using System.Linq;
using System.Net;
using OpenRA.Mods.RA;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncMenuLogic : IWidgetDelegate
public class CncMenuLogic
{
enum MenuType
{

View File

@@ -12,12 +12,11 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncModBrowserLogic : IWidgetDelegate
public class CncModBrowserLogic
{
Mod currentMod;

View File

@@ -15,13 +15,12 @@ using System.Threading;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
using OpenRA.GameRules;
using OpenRA.Graphics;
using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncMusicPlayerLogic : IWidgetDelegate
public class CncMusicPlayerLogic
{
bool installed;
MusicInfo currentSong = null;
@@ -185,7 +184,7 @@ namespace OpenRA.Mods.Cnc.Widgets
}
public class CncInstallMusicLogic : IWidgetDelegate
public class CncInstallMusicLogic
{
Widget panel;
ProgressBarWidget progressBar;

View File

@@ -8,13 +8,12 @@
*/
#endregion
using System;
using OpenRA.Support;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncPerfDebugLogic : IWidgetDelegate
public class CncPerfDebugLogic
{
[ObjectCreator.UseCtor]
public CncPerfDebugLogic([ObjectCreator.Param] Widget widget)

View File

@@ -11,13 +11,12 @@
using System;
using System.IO;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Widgets.Delegates;
using OpenRA.Mods.RA.Widgets.Logic;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncReplayBrowserLogic : IWidgetDelegate
public class CncReplayBrowserLogic
{
Widget panel;

View File

@@ -11,13 +11,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Mods.RA.Widgets.Delegates;
using OpenRA.Mods.RA.Widgets.Logic;
using OpenRA.Network;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncServerBrowserLogic : IWidgetDelegate
public class CncServerBrowserLogic
{
GameServer currentServer;
ScrollItemWidget serverTemplate;
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Cnc.Widgets
};
var join = panel.GetWidget<ButtonWidget>("JOIN_BUTTON");
join.IsDisabled = () => currentServer == null || !ServerBrowserDelegate.CanJoin(currentServer);
join.IsDisabled = () => currentServer == null || !ServerBrowserLogic.CanJoin(currentServer);
join.OnClick = () =>
{
if (currentServer == null)
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Cnc.Widgets
var infoPanel = panel.GetWidget("SERVER_INFO");
infoPanel.IsVisible = () => currentServer != null;
infoPanel.GetWidget<LabelWidget>("SERVER_IP").GetText = () => currentServer.Address;
infoPanel.GetWidget<LabelWidget>("SERVER_MODS").GetText = () => ServerBrowserDelegate.GenerateModsLabel(currentServer);
infoPanel.GetWidget<LabelWidget>("SERVER_MODS").GetText = () => ServerBrowserLogic.GenerateModsLabel(currentServer);
infoPanel.GetWidget<LabelWidget>("MAP_TITLE").GetText = () => (CurrentMap() != null) ? CurrentMap().Title : "Unknown";
infoPanel.GetWidget<LabelWidget>("MAP_PLAYERS").GetText = () => GetPlayersLabel(currentServer);
@@ -142,7 +142,7 @@ namespace OpenRA.Mods.Cnc.Widgets
return;
}
var gamesWaiting = games.Where(g => ServerBrowserDelegate.CanJoin(g));
var gamesWaiting = games.Where(g => ServerBrowserLogic.CanJoin(g));
if (gamesWaiting.Count() == 0)
{
@@ -172,7 +172,7 @@ namespace OpenRA.Mods.Cnc.Widgets
}
}
public class CncDirectConnectLogic : IWidgetDelegate
public class CncDirectConnectLogic
{
[ObjectCreator.UseCtor]
public CncDirectConnectLogic([ObjectCreator.Param] Widget widget,

View File

@@ -14,9 +14,9 @@ using System.Net;
using OpenRA.GameRules;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncServerCreationLogic : IWidgetDelegate
public class CncServerCreationLogic
{
Widget panel;
Action onCreate;

View File

@@ -10,22 +10,22 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
using OpenRA.GameRules;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncSettingsLogic : IWidgetDelegate
public class CncSettingsLogic
{
enum PanelType
{
General,
Input
}
PanelType Settings = PanelType.General;
ColorRamp playerColor;
Modifiers groupAddModifier;