Fix capitalization.

This commit is contained in:
Paul Chote
2014-12-26 11:02:57 +13:00
parent 4ea7b5a908
commit 22ab35f681
9 changed files with 42 additions and 37 deletions

View File

@@ -17,6 +17,8 @@ namespace OpenRA.Mods.Common.Effects
{
public class Beacon : IEffect
{
static readonly int MaxArrowHeight = 512;
readonly Player owner;
readonly WPos position;
readonly string palettePrefix;
@@ -26,8 +28,7 @@ namespace OpenRA.Mods.Common.Effects
readonly Animation poster;
readonly Animation clock;
static readonly int maxArrowHeight = 512;
int arrowHeight = maxArrowHeight;
int arrowHeight = MaxArrowHeight;
int arrowSpeed = 50;
// Player-placed beacons are removed after a delay
@@ -69,7 +70,7 @@ namespace OpenRA.Mods.Common.Effects
public void Tick(World world)
{
arrowHeight += arrowSpeed;
var clamped = arrowHeight.Clamp(0, maxArrowHeight);
var clamped = arrowHeight.Clamp(0, MaxArrowHeight);
if (arrowHeight != clamped)
{
arrowHeight = clamped;

View File

@@ -19,6 +19,8 @@ namespace OpenRA.Mods.Common.Effects
{
public class FloatingText : IEffect
{
static readonly WVec Velocity = new WVec(0, 0, 86);
readonly SpriteFont font;
readonly string text;
Color color;
@@ -34,13 +36,12 @@ namespace OpenRA.Mods.Common.Effects
this.remaining = duration;
}
static readonly WVec velocity = new WVec(0, 0, 86);
public void Tick(World world)
{
if (--remaining <= 0)
world.AddFrameEndTask(w => w.Remove(this));
pos += velocity;
pos += Velocity;
}
public IEnumerable<IRenderable> Render(WorldRenderer wr)

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Graphics
this.zOffset = zOffset;
}
public WPos Pos { get { return trail[idx(next - 1)]; } }
public WPos Pos { get { return trail[Index(next - 1)]; } }
public float Scale { get { return 1f; } }
public PaletteReference Palette { get { return null; } }
public int ZOffset { get { return zOffset; } }
@@ -67,13 +67,13 @@ namespace OpenRA.Mods.Common.Graphics
wlr.LineWidth = wr.Viewport.Zoom;
// Start of the first line segment is the tail of the list - don't smooth it.
var curPos = trail[idx(next - skip - 1)];
var curPos = trail[Index(next - skip - 1)];
var curCell = wr.world.Map.CellContaining(curPos);
var curColor = color;
for (var i = 0; i < length - skip - 4; i++)
{
var j = next - skip - i - 2;
var nextPos = Average(trail[idx(j)], trail[idx(j - 1)], trail[idx(j - 2)], trail[idx(j - 3)]);
var nextPos = Average(trail[Index(j)], trail[Index(j - 1)], trail[Index(j - 2)], trail[Index(j - 3)]);
var nextCell = wr.world.Map.CellContaining(nextPos);
var nextColor = Exts.ColorLerp(i * 1f / (length - 4), color, Color.Transparent);
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Graphics
public void RenderDebugGeometry(WorldRenderer wr) { }
// Array index modulo length
int idx(int i)
int Index(int i)
{
var j = i % trail.Length;
return j < 0 ? j + trail.Length : j;
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Graphics
public void Update(WPos pos)
{
trail[next] = pos;
next = idx(next + 1);
next = Index(next + 1);
if (length < trail.Length)
length++;

View File

@@ -87,13 +87,13 @@ namespace OpenRA.Mods.Common.Graphics
public IRenderable AsDecoration() { return this; }
// This will need generalizing once we support TS/RA2 terrain
static readonly float[] groundNormal = new float[] { 0, 0, 1, 1 };
static readonly float[] GroundNormal = new float[] { 0, 0, 1, 1 };
public void BeforeRender(WorldRenderer wr)
{
var draw = voxels.Where(v => v.DisableFunc == null || !v.DisableFunc());
renderProxy = Game.Renderer.WorldVoxelRenderer.RenderAsync(
wr, draw, camera, scale, groundNormal, lightSource,
wr, draw, camera, scale, GroundNormal, lightSource,
lightAmbientColor, lightDiffuseColor,
palette, normalsPalette, shadowPalette);
}
@@ -154,15 +154,15 @@ namespace OpenRA.Mods.Common.Graphics
}
}
static readonly uint[] ix = new uint[] { 0, 0, 0, 0, 3, 3, 3, 3 };
static readonly uint[] iy = new uint[] { 1, 1, 4, 4, 1, 1, 4, 4 };
static readonly uint[] iz = new uint[] { 2, 5, 2, 5, 2, 5, 2, 5 };
static readonly uint[] CornerXIndex = new uint[] { 0, 0, 0, 0, 3, 3, 3, 3 };
static readonly uint[] CornerYIndex = new uint[] { 1, 1, 4, 4, 1, 1, 4, 4 };
static readonly uint[] CornerZIndex = new uint[] { 2, 5, 2, 5, 2, 5, 2, 5 };
static void DrawBoundsBox(float2 pxPos, float[] transform, float[] bounds, Color c)
{
var corners = new float2[8];
for (var i = 0; i < 8; i++)
{
var vec = new float[] { bounds[ix[i]], bounds[iy[i]], bounds[iz[i]], 1 };
var vec = new float[] { bounds[CornerXIndex[i]], bounds[CornerYIndex[i]], bounds[CornerZIndex[i]], 1 };
var screen = Util.MatrixVectorMultiply(transform, vec);
corners[i] = pxPos + new float2(screen[0], screen[1]);
}

View File

@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Scripting
{
var group = actors.ToList();
var copy = (LuaFunction)func.CopyReference();
Action<Actor> OnMemberKilled = m =>
Action<Actor> onMemberKilled = m =>
{
try
{
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Scripting
};
foreach (var a in group)
GetScriptTriggers(a).OnKilledInternal += OnMemberKilled;
GetScriptTriggers(a).OnKilledInternal += onMemberKilled;
}
[Desc("Call a function when one of the actors in a group is killed. The callback " +
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Scripting
{
var called = false;
var copy = (LuaFunction)func.CopyReference();
Action<Actor> OnMemberKilled = m =>
Action<Actor> onMemberKilled = m =>
{
try
{
@@ -126,7 +126,7 @@ namespace OpenRA.Mods.Common.Scripting
};
foreach (var a in actors)
GetScriptTriggers(a).OnKilledInternal += OnMemberKilled;
GetScriptTriggers(a).OnKilledInternal += onMemberKilled;
}
[Desc("Call a function when this actor produces another actor. " +
@@ -192,7 +192,7 @@ namespace OpenRA.Mods.Common.Scripting
var group = actors.ToList();
var copy = (LuaFunction)func.CopyReference();
Action<Actor> OnMemberRemoved = m =>
Action<Actor> onMemberRemoved = m =>
{
try
{
@@ -210,7 +210,7 @@ namespace OpenRA.Mods.Common.Scripting
};
foreach (var a in group)
GetScriptTriggers(a).OnRemovedInternal += OnMemberRemoved;
GetScriptTriggers(a).OnRemovedInternal += onMemberRemoved;
}
[Desc("Call a function when this actor is captured. The callback function " +
@@ -227,7 +227,7 @@ namespace OpenRA.Mods.Common.Scripting
var called = false;
var copy = (LuaFunction)func.CopyReference();
Action<Actor> OnKilledOrCaptured = m =>
Action<Actor> onKilledOrCaptured = m =>
{
try
{
@@ -244,8 +244,8 @@ namespace OpenRA.Mods.Common.Scripting
}
};
GetScriptTriggers(a).OnCapturedInternal += OnKilledOrCaptured;
GetScriptTriggers(a).OnKilledInternal += OnKilledOrCaptured;
GetScriptTriggers(a).OnCapturedInternal += onKilledOrCaptured;
GetScriptTriggers(a).OnKilledInternal += onKilledOrCaptured;
}
[Desc("Call a function when all of the actors in a group have been killed or captured. " +
@@ -255,7 +255,7 @@ namespace OpenRA.Mods.Common.Scripting
var group = actors.ToList();
var copy = (LuaFunction)func.CopyReference();
Action<Actor> OnMemberKilledOrCaptured = m =>
Action<Actor> onMemberKilledOrCaptured = m =>
{
try
{
@@ -277,8 +277,8 @@ namespace OpenRA.Mods.Common.Scripting
foreach (var a in group)
{
GetScriptTriggers(a).OnCapturedInternal += OnMemberKilledOrCaptured;
GetScriptTriggers(a).OnKilledInternal += OnMemberKilledOrCaptured;
GetScriptTriggers(a).OnCapturedInternal += onMemberKilledOrCaptured;
GetScriptTriggers(a).OnKilledInternal += onMemberKilledOrCaptured;
}
}

View File

@@ -17,9 +17,9 @@ namespace OpenRA.Mods.Common.Server
{
public class PlayerPinger : ServerTrait, ITick
{
int PingInterval = 5000; // Ping every 5 seconds
int ConnReportInterval = 20000; // Report every 20 seconds
int ConnTimeout = 90000; // Drop unresponsive clients after 90 seconds
static readonly int PingInterval = 5000; // Ping every 5 seconds
static readonly int ConnReportInterval = 20000; // Report every 20 seconds
static readonly int ConnTimeout = 90000; // Drop unresponsive clients after 90 seconds
// TickTimeout is in microseconds
public int TickTimeout { get { return PingInterval * 100; } }

View File

@@ -20,12 +20,12 @@ namespace OpenRA.Mods.Common.Traits
public class NukePaletteEffect : IPaletteModifier, ITick
{
const int nukeEffectLength = 20;
const int NukeEffectLength = 20;
int remainingFrames;
public void Enable()
{
remainingFrames = nukeEffectLength;
remainingFrames = NukeEffectLength;
}
public void Tick(Actor self)
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
if (remainingFrames == 0)
return;
var frac = (float)remainingFrames / nukeEffectLength;
var frac = (float)remainingFrames / NukeEffectLength;
foreach (var pal in palettes)
{

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
wr.AddPalette(info.Name, new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => (uint)c[i % 8].ToArgb())));
}
static Color[] Fog = new[]
static readonly Color[] Fog = new[]
{
Color.Transparent, Color.Green,
Color.Blue, Color.Yellow,
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
Color.FromArgb(32, 0, 0, 0)
};
static Color[] Shroud = new[]
static readonly Color[] Shroud = new[]
{
Color.Transparent, Color.Green,
Color.Blue, Color.Yellow,

View File

@@ -22,7 +22,10 @@ namespace OpenRA.Mods.Common.Widgets
public float[] VRange = { 0.2f, 1.0f };
public event Action OnChange = () => { };
float H, S, V;
public float H { get; private set; }
public float S { get; private set; }
public float V { get; private set; }
byte[] front, back;
Sprite mixerSprite;
bool isMoving;