StyleCop clean Cnc DLL

This commit is contained in:
Matthias Mailänder
2013-08-03 18:14:54 +02:00
parent bcce9ea7f0
commit d278bc84d1
24 changed files with 315 additions and 307 deletions

View File

@@ -19,19 +19,19 @@ namespace OpenRA.Mods.Cnc
{
public class CncLoadScreen : ILoadScreen
{
Dictionary<string, string> Info;
Dictionary<string, string> loadInfo;
Stopwatch loadTimer = new Stopwatch();
Sprite[] ss;
int loadTick;
float2 nodPos, gdiPos, evaPos;
Sprite nodLogo, gdiLogo, evaLogo, brightBlock, dimBlock;
Rectangle Bounds;
Rectangle bounds;
Renderer r;
NullInputHandler nih = new NullInputHandler();
public void Init(Dictionary<string, string> info)
{
Info = info;
loadInfo = info;
// Avoid standard loading mechanisms so we
// can display loadscreen as early as possible
@@ -40,26 +40,26 @@ namespace OpenRA.Mods.Cnc
var s = new Sheet("mods/cnc/uibits/chrome.png");
var res = Renderer.Resolution;
Bounds = new Rectangle(0, 0, res.Width, res.Height);
bounds = new Rectangle(0, 0, res.Width, res.Height);
ss = new []
ss = new[]
{
new Sprite(s, new Rectangle(161,128,62,33), TextureChannel.Alpha),
new Sprite(s, new Rectangle(161,223,62,33), TextureChannel.Alpha),
new Sprite(s, new Rectangle(128,161,33,62), TextureChannel.Alpha),
new Sprite(s, new Rectangle(223,161,33,62), TextureChannel.Alpha),
new Sprite(s, new Rectangle(128,128,33,33), TextureChannel.Alpha),
new Sprite(s, new Rectangle(223,128,33,33), TextureChannel.Alpha),
new Sprite(s, new Rectangle(128,223,33,33), TextureChannel.Alpha),
new Sprite(s, new Rectangle(223,223,33,33), TextureChannel.Alpha)
new Sprite(s, new Rectangle(161, 128, 62, 33), TextureChannel.Alpha),
new Sprite(s, new Rectangle(161, 223, 62, 33), TextureChannel.Alpha),
new Sprite(s, new Rectangle(128, 161, 33, 62), TextureChannel.Alpha),
new Sprite(s, new Rectangle(223, 161, 33, 62), TextureChannel.Alpha),
new Sprite(s, new Rectangle(128, 128, 33, 33), TextureChannel.Alpha),
new Sprite(s, new Rectangle(223, 128, 33, 33), TextureChannel.Alpha),
new Sprite(s, new Rectangle(128, 223, 33, 33), TextureChannel.Alpha),
new Sprite(s, new Rectangle(223, 223, 33, 33), TextureChannel.Alpha)
};
nodLogo = new Sprite(s, new Rectangle(0, 256, 256, 256), TextureChannel.Alpha);
gdiLogo = new Sprite(s, new Rectangle(256, 256, 256, 256), TextureChannel.Alpha);
evaLogo = new Sprite(s, new Rectangle(256, 64, 128, 64), TextureChannel.Alpha);
nodPos = new float2(Bounds.Width / 2 - 384, Bounds.Height / 2 - 128);
gdiPos = new float2(Bounds.Width / 2 + 128, Bounds.Height / 2 - 128);
evaPos = new float2(Bounds.Width - 43 - 128, 43);
nodPos = new float2(bounds.Width / 2 - 384, bounds.Height / 2 - 128);
gdiPos = new float2(bounds.Width / 2 + 128, bounds.Height / 2 - 128);
evaPos = new float2(bounds.Width - 43 - 128, 43);
brightBlock = new Sprite(s, new Rectangle(320, 0, 16, 35), TextureChannel.Alpha);
dimBlock = new Sprite(s, new Rectangle(336, 0, 16, 35), TextureChannel.Alpha);
@@ -83,19 +83,19 @@ namespace OpenRA.Mods.Cnc
r.RgbaSpriteRenderer.DrawSprite(nodLogo, nodPos);
r.RgbaSpriteRenderer.DrawSprite(evaLogo, evaPos);
WidgetUtils.DrawPanelPartial(ss, Bounds, PanelSides.Edges);
var barY = Bounds.Height - 78;
WidgetUtils.DrawPanelPartial(ss, bounds, PanelSides.Edges);
var barY = bounds.Height - 78;
if (!setup && r.Fonts != null)
{
loadingFont = r.Fonts["BigBold"];
loadingText = "Loading";
loadingPos = new float2((Bounds.Width - loadingFont.Measure(loadingText).X) / 2, barY);
loadingPos = new float2((bounds.Width - loadingFont.Measure(loadingText).X) / 2, barY);
versionFont = r.Fonts["Regular"];
versionText = WidgetUtils.ActiveModVersion();
var versionSize = versionFont.Measure(versionText);
versionPos = new float2(Bounds.Width - 107 - versionSize.X/2, 115 - versionSize.Y/2);
versionPos = new float2(bounds.Width - 107 - versionSize.X / 2, 115 - versionSize.Y / 2);
setup = true;
}
@@ -109,9 +109,9 @@ namespace OpenRA.Mods.Cnc
{
var block = loadTick == i ? brightBlock : dimBlock;
r.RgbaSpriteRenderer.DrawSprite(block,
new float2(Bounds.Width / 2 - 114 - i * 32, barY));
new float2(bounds.Width / 2 - 114 - i * 32, barY));
r.RgbaSpriteRenderer.DrawSprite(block,
new float2(Bounds.Width / 2 + 114 + i * 32 - 16, barY));
new float2(bounds.Width / 2 + 114 + i * 32 - 16, barY));
}
r.EndFrame(nih);
@@ -125,19 +125,18 @@ namespace OpenRA.Mods.Cnc
void TestAndContinue()
{
Ui.ResetAll();
if (!FileSystem.Exists(Info["TestFile"]))
if (!FileSystem.Exists(loadInfo["TestFile"]))
{
var args = new WidgetArgs()
{
{ "continueLoading", () => TestAndContinue() },
{ "installData", Info }
{ "installData", loadInfo }
};
Ui.LoadWidget(Info["InstallerBackgroundWidget"], Ui.Root, args);
Ui.OpenWindow(Info["InstallerMenuWidget"], args);
Ui.LoadWidget(loadInfo["InstallerBackgroundWidget"], Ui.Root, args);
Ui.OpenWindow(loadInfo["InstallerMenuWidget"], args);
}
else
Game.LoadShellMap();
}
}
}
}