StyleCop clean OpenRA.Game

This commit is contained in:
Matthias Mailänder
2015-01-02 15:11:36 +01:00
parent 9dd607c846
commit 44cd174a8d
61 changed files with 628 additions and 581 deletions

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Traits
public class DeveloperMode : IResolveOrder, ISync
{
DeveloperModeInfo Info;
DeveloperModeInfo info;
[Sync] public bool FastCharge;
[Sync] public bool AllTech;
[Sync] public bool FastBuild;
@@ -46,7 +46,7 @@ namespace OpenRA.Traits
public DeveloperMode(DeveloperModeInfo info)
{
Info = info;
this.info = info;
FastBuild = info.FastBuild;
FastCharge = info.FastCharge;
DisableShroud = info.DisableShroud;
@@ -85,7 +85,7 @@ namespace OpenRA.Traits
case "DevGiveCash":
{
var amount = order.ExtraData != 0 ? (int)order.ExtraData : Info.Cash;
var amount = order.ExtraData != 0 ? (int)order.ExtraData : info.Cash;
self.Trait<PlayerResources>().GiveCash(amount);
break;
}
@@ -94,7 +94,7 @@ namespace OpenRA.Traits
{
foreach (var a in self.World.ActorsWithTrait<ISeedableResource>())
{
for (var i = 0; i < Info.ResourceGrowth; i++)
for (var i = 0; i < info.ResourceGrowth; i++)
a.Trait.Seed(a.Actor);
}

0
OpenRA.Game/Traits/Player/FrozenActorLayer.cs Executable file → Normal file
View File

View File

@@ -19,21 +19,21 @@ namespace OpenRA.Traits
{
[Desc("The prefix for the resulting player palettes")]
public readonly string BaseName = "highlight";
public object Create(ActorInitializer init) { return new PlayerHighlightPalette(init.self.Owner, this); }
}
public class PlayerHighlightPalette : ILoadsPalettes
{
readonly Player owner;
readonly PlayerHighlightPaletteInfo info;
public PlayerHighlightPalette(Player owner, PlayerHighlightPaletteInfo info)
{
this.owner = owner;
this.info = info;
}
public void LoadPalettes(WorldRenderer wr)
{
var argb = (uint)Color.FromArgb(128, owner.Color.RGB).ToArgb();

View File

@@ -24,17 +24,17 @@ namespace OpenRA.Traits
public class PlayerResources : ITick, ISync
{
const float displayCashFracPerFrame = .07f;
const int displayCashDeltaPerFrame = 37;
readonly Player Owner;
int AdviceInterval;
const float DisplayCashFracPerFrame = .07f;
const int DisplayCashDeltaPerFrame = 37;
readonly Player owner;
int adviceInterval;
public PlayerResources(Actor self, PlayerResourcesInfo info)
{
Owner = self.Owner;
owner = self.Owner;
Cash = self.World.LobbyInfo.GlobalSettings.StartingCash;
AdviceInterval = info.AdviceInterval;
adviceInterval = info.AdviceInterval;
}
[Sync] public int Cash;
@@ -108,7 +108,7 @@ namespace OpenRA.Traits
nextCashTickTime--;
ResourceCapacity = self.World.ActorsWithTrait<IStoreResources>()
.Where(a => a.Actor.Owner == Owner)
.Where(a => a.Actor.Owner == owner)
.Sum(a => a.Trait.Capacity);
if (Resources > ResourceCapacity)
@@ -118,53 +118,52 @@ namespace OpenRA.Traits
{
if (Resources > 0.8 * ResourceCapacity)
{
Sound.PlayNotification(self.World.Map.Rules, Owner, "Speech", "SilosNeeded", Owner.Country.Race);
Sound.PlayNotification(self.World.Map.Rules, owner, "Speech", "SilosNeeded", owner.Country.Race);
AlertSilo = true;
}
else
AlertSilo = false;
nextSiloAdviceTime = AdviceInterval;
nextSiloAdviceTime = adviceInterval;
}
var diff = Math.Abs(Cash - DisplayCash);
var move = Math.Min(Math.Max((int)(diff * displayCashFracPerFrame),
displayCashDeltaPerFrame), diff);
var move = Math.Min(Math.Max((int)(diff * DisplayCashFracPerFrame), DisplayCashDeltaPerFrame), diff);
if (DisplayCash < Cash)
{
DisplayCash += move;
playCashTickUp(self);
PlayCashTickUp(self);
}
else if (DisplayCash > Cash)
{
DisplayCash -= move;
playCashTickDown(self);
PlayCashTickDown(self);
}
diff = Math.Abs(Resources - DisplayResources);
move = Math.Min(Math.Max((int)(diff * displayCashFracPerFrame),
displayCashDeltaPerFrame), diff);
move = Math.Min(Math.Max((int)(diff * DisplayCashFracPerFrame),
DisplayCashDeltaPerFrame), diff);
if (DisplayResources < Resources)
{
DisplayResources += move;
playCashTickUp(self);
PlayCashTickUp(self);
}
else if (DisplayResources > Resources)
{
DisplayResources -= move;
playCashTickDown(self);
PlayCashTickDown(self);
}
}
public void playCashTickUp(Actor self)
public void PlayCashTickUp(Actor self)
{
if (Game.Settings.Sound.CashTicks)
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "CashTickUp", self.Owner.Country.Race);
}
public void playCashTickDown(Actor self)
public void PlayCashTickDown(Actor self)
{
if (Game.Settings.Sound.CashTicks && nextCashTickTime == 0)
{