Merge pull request #6705 from steelphase-forks/common-resharp

Mods.Common resharpered
This commit is contained in:
reaperrr
2014-10-08 22:15:00 +02:00
6 changed files with 15 additions and 12 deletions

View File

@@ -12,7 +12,7 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Mods.Common
namespace OpenRA.Mods.Common.Commands
{
[Desc("Enables commands triggered by typing them into the chatbox. Attach this to the world actor.")]
public class ChatCommandsInfo : TraitInfo<ChatCommands> { }

View File

@@ -9,10 +9,11 @@
#endregion
using System;
using System.Globalization;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.Common
namespace OpenRA.Mods.Common.Commands
{
[Desc("Enables developer cheats via the chatbox. Attach this to the world actor.")]
public class DevCommandsInfo : TraitInfo<DevCommands> { }
@@ -56,12 +57,12 @@ namespace OpenRA.Mods.Common
{
case "givecash":
var order = new Order("DevGiveCash", world.LocalPlayer.PlayerActor, false);
var cash = 0;
int cash;
if (int.TryParse(arg, out cash))
order.ExtraData = (uint)cash;
Game.Debug("Giving {0} credits to player {1}.", (cash == 0 ? "cheat default" : cash.ToString()), world.LocalPlayer.PlayerName);
Game.Debug("Giving {0} credits to player {1}.", cash == 0 ? "cheat default" : cash.ToString(CultureInfo.InvariantCulture), world.LocalPlayer.PlayerName);
world.IssueOrder(order);
break;

View File

@@ -12,16 +12,17 @@ using System.Collections.Generic;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.Common
namespace OpenRA.Mods.Common.Commands
{
[Desc("Shows a list of available commands in the chatbox. Attach this to the world actor.")]
public class HelpCommandInfo : TraitInfo<HelpCommand> { }
public class HelpCommand : IChatCommand, IWorldLoaded
{
readonly Dictionary<string, string> helpDescriptions;
World world;
ChatCommands console;
Dictionary<string, string> helpDescriptions;
public HelpCommand()
{
@@ -43,7 +44,7 @@ namespace OpenRA.Mods.Common
foreach (var key in console.Commands.Keys)
{
var description = "";
string description;
if (!helpDescriptions.TryGetValue(key, out description))
description = "no description available.";

View File

@@ -11,7 +11,7 @@
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.Common
namespace OpenRA.Mods.Common.Commands
{
[Desc("Allows the player to pause or surrender the game via the chatbox. Attach this to the world actor.")]
public class PlayerCommandsInfo : TraitInfo<PlayerCommands> { }

View File

@@ -55,10 +55,10 @@
<Compile Include="Effects\Missile.cs" />
<Compile Include="Effects\RallyPoint.cs" />
<Compile Include="Effects\Smoke.cs" />
<Compile Include="Console\ChatCommands.cs" />
<Compile Include="Console\DevCommands.cs" />
<Compile Include="Console\HelpCommand.cs" />
<Compile Include="Console\PlayerCommands.cs" />
<Compile Include="Commands\ChatCommands.cs" />
<Compile Include="Commands\DevCommands.cs" />
<Compile Include="Commands\HelpCommand.cs" />
<Compile Include="Commands\PlayerCommands.cs" />
<Compile Include="Graphics\ActorPreview.cs" />
<Compile Include="Graphics\BeamRenderable.cs" />
<Compile Include="Graphics\ContrailRenderable.cs" />

View File

@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Commands;
using OpenRA.Network;
using OpenRA.Widgets;