StyleCop clean D2k Mod DLL

This commit is contained in:
Matthias Mailänder
2013-08-07 14:12:12 +02:00
parent 1cd3a97772
commit 040e8eccd9
6 changed files with 686 additions and 686 deletions

View File

@@ -21,19 +21,18 @@ namespace OpenRA.Mods.RA
class CaptureNotification : INotifyCapture class CaptureNotification : INotifyCapture
{ {
CaptureNotificationInfo Info; CaptureNotificationInfo captureInfo;
public CaptureNotification(CaptureNotificationInfo info) public CaptureNotification(CaptureNotificationInfo info)
{ {
Info = info; captureInfo = info;
} }
public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner) public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
{ {
if (captor.World.LocalPlayer != captor.Owner) if (captor.World.LocalPlayer != captor.Owner)
return; return;
Sound.PlayNotification(captor.World.LocalPlayer, "Speech", Info.Notification, newOwner.Country.Race); Sound.PlayNotification(captor.World.LocalPlayer, "Speech", captureInfo.Notification, newOwner.Country.Race);
} }
} }
} }

View File

@@ -9,8 +9,8 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Drawing; using System.Drawing;
using System.IO;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Network; using OpenRA.Network;
@@ -21,27 +21,28 @@ namespace OpenRA.Mods.D2k
{ {
public class D2kLoadScreen : ILoadScreen public class D2kLoadScreen : ILoadScreen
{ {
Dictionary<string, string> Info; public static string[] Comments = new[] { "Filling Crates...", "Breeding Sandworms..." };
static string[] Comments = new[] {"Filling Crates...", "Breeding Sandworms..."}; public Dictionary<string, string> Info;
Stopwatch lastLoadScreen = new Stopwatch(); Stopwatch lastLoadScreen = new Stopwatch();
Rectangle StripeRect; Rectangle stripeRect;
Sprite Stripe, Logo; Sprite stripe, Logo;
float2 LogoPos; float2 logoPos;
Renderer r; Renderer r;
public void Init(Dictionary<string, string> info) public void Init(Dictionary<string, string> info)
{ {
Info = info; Info = info;
// Avoid standard loading mechanisms so we // Avoid standard loading mechanisms so we
// can display loadscreen as early as possible // can display loadscreen as early as possible
r = Game.Renderer; r = Game.Renderer;
if (r == null) return; if (r == null) return;
var s = new Sheet("mods/d2k/uibits/loadscreen.png"); var s = new Sheet("mods/d2k/uibits/loadscreen.png");
Logo = new Sprite(s, new Rectangle(0,0,256,256), TextureChannel.Alpha); Logo = new Sprite(s, new Rectangle(0, 0, 256, 256), TextureChannel.Alpha);
Stripe = new Sprite(s, new Rectangle(256,0,256,256), TextureChannel.Alpha); stripe = new Sprite(s, new Rectangle(256, 0, 256, 256), TextureChannel.Alpha);
StripeRect = new Rectangle(0, Renderer.Resolution.Height/2 - 128, Renderer.Resolution.Width, 256); stripeRect = new Rectangle(0, Renderer.Resolution.Height / 2 - 128, Renderer.Resolution.Width, 256);
LogoPos = new float2(Renderer.Resolution.Width/2 - 128, Renderer.Resolution.Height/2 - 128); logoPos = new float2(Renderer.Resolution.Width / 2 - 128, Renderer.Resolution.Height / 2 - 128);
} }
public void Display() public void Display()
@@ -61,10 +62,10 @@ namespace OpenRA.Mods.D2k
var textSize = r.Fonts["Bold"].Measure(text); var textSize = r.Fonts["Bold"].Measure(text);
r.BeginFrame(float2.Zero, 1f); r.BeginFrame(float2.Zero, 1f);
WidgetUtils.FillRectWithSprite(StripeRect, Stripe); WidgetUtils.FillRectWithSprite(stripeRect, stripe);
r.RgbaSpriteRenderer.DrawSprite(Logo, LogoPos); r.RgbaSpriteRenderer.DrawSprite(Logo, logoPos);
r.Fonts["Bold"].DrawText(text, new float2(Renderer.Resolution.Width - textSize.X - 20, Renderer.Resolution.Height - textSize.Y - 20), Color.White); r.Fonts["Bold"].DrawText(text, new float2(Renderer.Resolution.Width - textSize.X - 20, Renderer.Resolution.Height - textSize.Y - 20), Color.White);
r.EndFrame( new NullInputHandler() ); r.EndFrame(new NullInputHandler());
} }
public void StartGame() public void StartGame()

View File

@@ -22,13 +22,13 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
public class D2kDownloadPackagesLogic public class D2kDownloadPackagesLogic
{ {
Widget panel; Widget panel;
Dictionary<string,string> installData; Dictionary<string, string> installData;
ProgressBarWidget progressBar; ProgressBarWidget progressBar;
LabelWidget statusLabel; LabelWidget statusLabel;
Action afterInstall; Action afterInstall;
[ObjectCreator.UseCtor] [ObjectCreator.UseCtor]
public D2kDownloadPackagesLogic(Widget widget, Dictionary<string,string> installData, Action afterInstall) public D2kDownloadPackagesLogic(Widget widget, Dictionary<string, string> installData, Action afterInstall)
{ {
this.installData = installData; this.installData = installData;
this.afterInstall = afterInstall; this.afterInstall = afterInstall;
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
{ {
Game.RunAfterTick(() => Game.RunAfterTick(() =>
{ {
statusLabel.GetText = () => "Error: "+s; statusLabel.GetText = () => "Error: " + s;
retryButton.IsVisible = () => true; retryButton.IsVisible = () => true;
}); });
}; };

File diff suppressed because it is too large Load Diff

View File

@@ -14,8 +14,8 @@ using System.Linq;
using System.Threading; using System.Threading;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics; using OpenRA.FileFormats.Graphics;
using OpenRA.Widgets;
using OpenRA.Utility; using OpenRA.Utility;
using OpenRA.Widgets;
namespace OpenRA.Mods.D2k.Widgets.Logic namespace OpenRA.Mods.D2k.Widgets.Logic
{ {
@@ -51,8 +51,8 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
public static bool IsValidDisk(string diskRoot) public static bool IsValidDisk(string diskRoot)
{ {
var files = new string[][] { var files = new string[][] {
new [] { diskRoot, "music", "ambush.aud" }, new[] { diskRoot, "music", "ambush.aud" },
new [] { diskRoot, "setup", "setup.z" }, new[] { diskRoot, "setup", "setup.z" },
}; };
return files.All(f => File.Exists(f.Aggregate(Path.Combine))); return files.All(f => File.Exists(f.Aggregate(Path.Combine)));
@@ -79,8 +79,8 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
installingContainer.IsVisible = () => true; installingContainer.IsVisible = () => true;
var destMusic = new string[] { Platform.SupportDir, "Content", "d2k", "Music" }.Aggregate(Path.Combine); var destMusic = new string[] { Platform.SupportDir, "Content", "d2k", "Music" }.Aggregate(Path.Combine);
var destData = new [] { Platform.SupportDir, "Content", "d2k" }.Aggregate(Path.Combine); var destData = new[] { Platform.SupportDir, "Content", "d2k" }.Aggregate(Path.Combine);
var destSound = new [] { destData, "GAMESFX" }.Aggregate(Path.Combine); var destSound = new[] { destData, "GAMESFX" }.Aggregate(Path.Combine);
var copyFiles = new string[] { "music/ambush.aud", "music/arakatak.aud", "music/atregain.aud", "music/entordos.aud", "music/fightpwr.aud", "music/fremen.aud", "music/hark_bat.aud", "music/landsand.aud", "music/options.aud", "music/plotting.aud", "music/risehark.aud", "music/robotix.aud", "music/score.aud", "music/soldappr.aud", "music/spicesct.aud", "music/undercon.aud", "music/waitgame.aud" }; var copyFiles = new string[] { "music/ambush.aud", "music/arakatak.aud", "music/atregain.aud", "music/entordos.aud", "music/fightpwr.aud", "music/fremen.aud", "music/hark_bat.aud", "music/landsand.aud", "music/options.aud", "music/plotting.aud", "music/risehark.aud", "music/robotix.aud", "music/score.aud", "music/soldappr.aud", "music/spicesct.aud", "music/undercon.aud", "music/waitgame.aud" };
var extractPackage = "setup/setup.z"; var extractPackage = "setup/setup.z";
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
var onProgress = (Action<string>)(s => Game.RunAfterTick(() => var onProgress = (Action<string>)(s => Game.RunAfterTick(() =>
{ {
progressBar.Percentage = installCounter*100/installTotal; progressBar.Percentage = installCounter * 100 / installTotal;
installCounter++; installCounter++;
statusLabel.GetText = () => s; statusLabel.GetText = () => s;
@@ -131,12 +131,12 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
var onError = (Action<string>)(s => Game.RunAfterTick(() => var onError = (Action<string>)(s => Game.RunAfterTick(() =>
{ {
statusLabel.GetText = () => "Error: "+s; statusLabel.GetText = () => "Error: " + s;
backButton.IsDisabled = () => false; backButton.IsDisabled = () => false;
retryButton.IsDisabled = () => false; retryButton.IsDisabled = () => false;
})); }));
var t = new Thread( _ => var t = new Thread(_ =>
{ {
try try
{ {

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
public class D2kInstallLogic public class D2kInstallLogic
{ {
[ObjectCreator.UseCtor] [ObjectCreator.UseCtor]
public D2kInstallLogic(Widget widget, Dictionary<string,string> installData, Action continueLoading) public D2kInstallLogic(Widget widget, Dictionary<string, string> installData, Action continueLoading)
{ {
var panel = widget.Get("INSTALL_PANEL"); var panel = widget.Get("INSTALL_PANEL");
var args = new WidgetArgs() var args = new WidgetArgs()
@@ -41,9 +41,8 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
panel.Get<ButtonWidget>("MODS_BUTTON").OnClick = () => panel.Get<ButtonWidget>("MODS_BUTTON").OnClick = () =>
{ {
Ui.OpenWindow("MODS_PANEL", new WidgetArgs() Ui.OpenWindow("MODS_PANEL", new WidgetArgs()
{ {
{ "onExit", () => {} }, { "onExit", () => { } },
// Close this panel
{ "onSwitch", Ui.CloseWindow }, { "onSwitch", Ui.CloseWindow },
}); });
}; };