Fix a collection of whitespace-style issues in Mods.Common.
This commit is contained in:
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common
|
||||
}
|
||||
|
||||
public interface INotifyChat { bool OnChat(string from, string message); }
|
||||
public interface IRenderActorPreviewInfo { IEnumerable<IActorPreview> RenderPreview (ActorPreviewInitializer init); }
|
||||
public interface IRenderActorPreviewInfo { IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init); }
|
||||
public interface ICruiseAltitudeInfo { WRange GetCruiseAltitude(); }
|
||||
|
||||
public interface IUpgradable
|
||||
@@ -46,9 +46,9 @@ namespace OpenRA.Mods.Common
|
||||
|
||||
public interface ITechTreeElement
|
||||
{
|
||||
void PrerequisitesAvailable (string key);
|
||||
void PrerequisitesUnavailable (string key);
|
||||
void PrerequisitesItemHidden (string key);
|
||||
void PrerequisitesItemVisible (string key);
|
||||
void PrerequisitesAvailable(string key);
|
||||
void PrerequisitesUnavailable(string key);
|
||||
void PrerequisitesItemHidden(string key);
|
||||
void PrerequisitesItemVisible(string key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
namespace OpenRA.Mods.Common.Effects
|
||||
{
|
||||
[Desc("Not a sprite, but an engine effect.")]
|
||||
|
||||
@@ -59,7 +59,6 @@ namespace OpenRA.Mods.Common.Effects
|
||||
ticks = turn;
|
||||
}
|
||||
|
||||
|
||||
public void Tick(World world)
|
||||
{
|
||||
anim.Tick();
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Effects
|
||||
return SpriteRenderable.None;
|
||||
|
||||
var pos = wr.world.Map.CenterOfCell(cachedLocation);
|
||||
var palette = wr.Palette(palettePrefix+building.Owner.InternalName);
|
||||
var palette = wr.Palette(palettePrefix + building.Owner.InternalName);
|
||||
return circles.Render(pos, palette).Concat(flag.Render(pos, palette));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public IRenderable OffsetBy(WVec vec) { return new BeamRenderable(pos + vec, zOffset, length, width, color); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public void BeforeRender(WorldRenderer wr) {}
|
||||
public void BeforeRender(WorldRenderer wr) { }
|
||||
public void Render(WorldRenderer wr)
|
||||
{
|
||||
var wlr = Game.Renderer.WorldLineRenderer;
|
||||
@@ -55,6 +55,6 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
wlr.LineWidth = oldWidth;
|
||||
}
|
||||
|
||||
public void RenderDebugGeometry(WorldRenderer wr) {}
|
||||
public void RenderDebugGeometry(WorldRenderer wr) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
readonly int zOffset;
|
||||
|
||||
public ContrailRenderable(World world, Color color, int length, int skip, int zOffset)
|
||||
: this(world, new WPos[length], 0, 0, skip, color, zOffset) {}
|
||||
: this(world, new WPos[length], 0, 0, skip, color, zOffset) { }
|
||||
|
||||
ContrailRenderable(World world, WPos[] trail, int next, int length, int skip, Color color, int zOffset)
|
||||
{
|
||||
@@ -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[idx(next - 1)]; } }
|
||||
public float Scale { get { return 1f; } }
|
||||
public PaletteReference Palette { get { return null; } }
|
||||
public int ZOffset { get { return zOffset; } }
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public IRenderable OffsetBy(WVec vec) { return new ContrailRenderable(world, trail.Select(pos => pos + vec).ToArray(), next, length, skip, color, zOffset); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public void BeforeRender(WorldRenderer wr) {}
|
||||
public void BeforeRender(WorldRenderer wr) { }
|
||||
public void Render(WorldRenderer wr)
|
||||
{
|
||||
// Need at least 4 points to smooth the contrail over
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
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[idx(j)], trail[idx(j - 1)], trail[idx(j - 2)], trail[idx(j - 3)]);
|
||||
var nextCell = wr.world.Map.CellContaining(nextPos);
|
||||
var nextColor = Exts.ColorLerp(i * 1f / (length - 4), color, Color.Transparent);
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
wlr.LineWidth = oldWidth;
|
||||
}
|
||||
|
||||
public void RenderDebugGeometry(WorldRenderer wr) {}
|
||||
public void RenderDebugGeometry(WorldRenderer wr) { }
|
||||
|
||||
// Array index modulo length
|
||||
int idx(int i)
|
||||
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public void Update(WPos pos)
|
||||
{
|
||||
trail[next] = pos;
|
||||
next = idx(next+1);
|
||||
next = idx(next + 1);
|
||||
|
||||
if (length < trail.Length)
|
||||
length++;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public IRenderable OffsetBy(WVec vec) { return new RangeCircleRenderable(centerPosition + vec, radius, zOffset, color, contrastColor); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public void BeforeRender(WorldRenderer wr) {}
|
||||
public void BeforeRender(WorldRenderer wr) { }
|
||||
public void Render(WorldRenderer wr)
|
||||
{
|
||||
var wlr = Game.Renderer.WorldLineRenderer;
|
||||
@@ -54,6 +54,6 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
wlr.LineWidth = oldWidth;
|
||||
}
|
||||
|
||||
public void RenderDebugGeometry(WorldRenderer wr) {}
|
||||
public void RenderDebugGeometry(WorldRenderer wr) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public IRenderable OffsetBy(WVec vec) { return new TextRenderable(font, pos + vec, zOffset, color, text); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public void BeforeRender(WorldRenderer wr) {}
|
||||
public void BeforeRender(WorldRenderer wr) { }
|
||||
public void Render(WorldRenderer wr)
|
||||
{
|
||||
var screenPos = wr.Viewport.Zoom*(wr.ScreenPosition(pos) - wr.Viewport.TopLeft.ToFloat2()) - 0.5f*font.Measure(text).ToFloat2();
|
||||
var screenPos = wr.Viewport.Zoom * (wr.ScreenPosition(pos) - wr.Viewport.TopLeft.ToFloat2()) - 0.5f * font.Measure(text).ToFloat2();
|
||||
var screenPxPos = new float2((float)Math.Round(screenPos.X), (float)Math.Round(screenPos.Y));
|
||||
font.DrawTextWithContrast(text, screenPxPos, color, Color.Black, 1);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public void RenderDebugGeometry(WorldRenderer wr)
|
||||
{
|
||||
var size = font.Measure(text).ToFloat2();
|
||||
var offset = wr.ScreenPxPosition(pos) - 0.5f*size;
|
||||
var offset = wr.ScreenPxPosition(pos) - 0.5f * size;
|
||||
Game.Renderer.WorldLineRenderer.DrawRect(offset, offset + size, Color.Red);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ 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());
|
||||
@@ -107,7 +107,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
var groundZ = ts.Height * (groundPos.Z - pos.Z) / 1024f;
|
||||
|
||||
var pxOrigin = wr.ScreenPosition(pos);
|
||||
var shadowOrigin = pxOrigin - groundZ*(new float2(renderProxy.ShadowDirection, 1));
|
||||
var shadowOrigin = pxOrigin - groundZ * (new float2(renderProxy.ShadowDirection, 1));
|
||||
|
||||
var psb = renderProxy.ProjectedShadowBounds;
|
||||
var sa = shadowOrigin + psb[0];
|
||||
@@ -115,17 +115,17 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
var sc = shadowOrigin + psb[1];
|
||||
var sd = shadowOrigin + psb[3];
|
||||
Game.Renderer.WorldRgbaSpriteRenderer.DrawSprite(renderProxy.ShadowSprite, sa, sb, sc, sd);
|
||||
Game.Renderer.WorldRgbaSpriteRenderer.DrawSprite(renderProxy.Sprite, pxOrigin - 0.5f*renderProxy.Sprite.size);
|
||||
Game.Renderer.WorldRgbaSpriteRenderer.DrawSprite(renderProxy.Sprite, pxOrigin - 0.5f * renderProxy.Sprite.size);
|
||||
}
|
||||
|
||||
public void RenderDebugGeometry(WorldRenderer wr)
|
||||
{
|
||||
var pxOrigin = wr.ScreenPosition(pos);
|
||||
var groundZ = 0.5f*(pxOrigin.Y - wr.ScreenZPosition(pos, 0));
|
||||
var shadowOrigin = pxOrigin - groundZ*(new float2(renderProxy.ShadowDirection, 1));
|
||||
var groundZ = 0.5f * (pxOrigin.Y - wr.ScreenZPosition(pos, 0));
|
||||
var shadowOrigin = pxOrigin - groundZ * (new float2(renderProxy.ShadowDirection, 1));
|
||||
|
||||
// Draw sprite rect
|
||||
var offset = pxOrigin + renderProxy.Sprite.offset - 0.5f*renderProxy.Sprite.size;
|
||||
var offset = pxOrigin + renderProxy.Sprite.offset - 0.5f * renderProxy.Sprite.size;
|
||||
Game.Renderer.WorldLineRenderer.DrawRect(offset, offset + renderProxy.Sprite.size, Color.Red);
|
||||
|
||||
// Draw transformed shadow sprite rect
|
||||
@@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
{
|
||||
var bounds = v.Voxel.Bounds(v.FrameFunc());
|
||||
var worldTransform = v.RotationFunc().Reverse().Aggregate(scaleTransform,
|
||||
(x,y) => Util.MatrixMultiply(x, Util.MakeFloatMatrix(y.AsMatrix())));
|
||||
(x, y) => Util.MatrixMultiply(x, Util.MakeFloatMatrix(y.AsMatrix())));
|
||||
|
||||
var pxOffset = wr.ScreenVector(v.OffsetFunc());
|
||||
var pxPos = pxOrigin + new float2(pxOffset[0], pxOffset[1]);
|
||||
@@ -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[] 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 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[ix[i]], bounds[iy[i]], bounds[iz[i]], 1 };
|
||||
var screen = Util.MatrixVectorMultiply(transform, vec);
|
||||
corners[i] = pxPos + new float2(screen[0], screen[1]);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
||||
var sheet = new Sheet(info["Image"]);
|
||||
var res = Game.Renderer.Resolution;
|
||||
bounds = new Rectangle(0, 0, res.Width, res.Height);
|
||||
sprite = new Sprite(sheet, new Rectangle(0,0,1024,480), TextureChannel.Alpha);
|
||||
sprite = new Sprite(sheet, new Rectangle(0, 0, 1024, 480), TextureChannel.Alpha);
|
||||
}
|
||||
|
||||
public void Display()
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
||||
{
|
||||
public class NullLoadScreen : ILoadScreen
|
||||
{
|
||||
public void Init(Manifest m, Dictionary<string, string> info) {}
|
||||
public void Init(Manifest m, Dictionary<string, string> info) { }
|
||||
|
||||
public void Display()
|
||||
{
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
||||
|
||||
// Draw a black screen
|
||||
Game.Renderer.BeginFrame(int2.Zero, 1f);
|
||||
Game.Renderer.EndFrame( new NullInputHandler() );
|
||||
Game.Renderer.EndFrame(new NullInputHandler());
|
||||
}
|
||||
|
||||
public void StartGame()
|
||||
@@ -32,5 +32,4 @@ namespace OpenRA.Mods.Common.LoadScreens
|
||||
Ui.ResetAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,12 +18,12 @@ namespace OpenRA.Mods.Common.Orders
|
||||
{
|
||||
readonly Func<bool> useDeployCursor;
|
||||
|
||||
public DeployOrderTargeter( string order, int priority )
|
||||
: this( order, priority, () => true )
|
||||
public DeployOrderTargeter(string order, int priority)
|
||||
: this(order, priority, () => true)
|
||||
{
|
||||
}
|
||||
|
||||
public DeployOrderTargeter( string order, int priority, Func<bool> useDeployCursor )
|
||||
public DeployOrderTargeter(string order, int priority, Func<bool> useDeployCursor)
|
||||
{
|
||||
this.OrderID = order;
|
||||
this.OrderPriority = priority;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Orders
|
||||
|
||||
public EnterAlliedActorTargeter(string order, int priority,
|
||||
Func<Actor, bool> canTarget, Func<Actor, bool> useEnterCursor)
|
||||
: base (order, priority, "enter", false, true)
|
||||
: base(order, priority, "enter", false, true)
|
||||
{
|
||||
this.canTarget = canTarget;
|
||||
this.useEnterCursor = useEnterCursor;
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
world = context.World;
|
||||
}
|
||||
|
||||
[Desc("Play an announcer voice listed in notifications.yaml")]
|
||||
public void PlaySpeechNotification(Player player, string notification)
|
||||
{
|
||||
|
||||
@@ -36,8 +36,9 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
// Mute world sounds
|
||||
var oldModifier = Sound.SoundVolumeModifier;
|
||||
|
||||
// TODO: this also modifies vqa audio
|
||||
//Sound.SoundVolumeModifier = 0f;
|
||||
// Sound.SoundVolumeModifier = 0f;
|
||||
|
||||
// Stop music while fmv plays
|
||||
var music = Sound.MusicPlaying;
|
||||
|
||||
@@ -13,9 +13,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Eluant;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using PowerTrait = OpenRA.Mods.Common.Traits.Power;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
using PowerTrait = OpenRA.Mods.Common.Traits.Power;
|
||||
|
||||
namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
public enum Trigger { OnIdle, OnDamaged, OnKilled, OnProduction, OnOtherProduction, OnPlayerWon, OnPlayerLost,
|
||||
OnObjectiveAdded, OnObjectiveCompleted, OnObjectiveFailed, OnCapture, OnInfiltrated, OnAddedToWorld, OnRemovedFromWorld };
|
||||
OnObjectiveAdded, OnObjectiveCompleted, OnObjectiveFailed, OnCapture, OnInfiltrated, OnAddedToWorld, OnRemovedFromWorld }
|
||||
|
||||
[Desc("Allows map scripts to attach triggers to this actor via the Triggers global.")]
|
||||
public class ScriptTriggersInfo : ITraitInfo
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace OpenRA.Mods.Common.Server
|
||||
var client = server.GetClient(conn);
|
||||
|
||||
// Validate whether color is allowed and get an alternative if it isn't
|
||||
if (client.Slot == null ||!server.LobbyInfo.Slots[client.Slot].LockColor)
|
||||
if (client.Slot == null || !server.LobbyInfo.Slots[client.Slot].LockColor)
|
||||
client.Color = ColorValidator.ValidatePlayerColorAndGetAlternative(server, client.Color, client.Index);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
//TODO: Add functionality like a customizable Height that is compared to projectile altitude
|
||||
// TODO: Add functionality like a customizable Height that is compared to projectile altitude
|
||||
[Desc("This actor blocks bullets and missiles without 'High' property.")]
|
||||
public class BlocksBulletsInfo : TraitInfo<BlocksBullets> { }
|
||||
public class BlocksBullets : IBlocksBullets { }
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public static class CustomSellValueExts
|
||||
{
|
||||
public static int GetSellValue( this Actor a )
|
||||
public static int GetSellValue(this Actor a)
|
||||
{
|
||||
var csv = a.Info.Traits.GetOrDefault<CustomSellValueInfo>();
|
||||
if (csv != null) return csv.Value;
|
||||
|
||||
@@ -32,5 +32,4 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
position = init.world.Map.CenterOfCell(location);
|
||||
|
||||
if (info.OccupiesSpace)
|
||||
occupied = new [] { Pair.New(TopLeft, SubCell.FullCell) };
|
||||
occupied = new[] { Pair.New(TopLeft, SubCell.FullCell) };
|
||||
else
|
||||
occupied = new Pair<CPos, SubCell>[0];
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class UpgradeOverlay : UpgradableTrait<UpgradeOverlayInfo>, IRenderModifier
|
||||
{
|
||||
public UpgradeOverlay(UpgradeOverlayInfo info)
|
||||
: base (info) { }
|
||||
: base(info) { }
|
||||
|
||||
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class ProvidesTechPrerequisiteInfo : ITraitInfo
|
||||
{
|
||||
public readonly string Name;
|
||||
public readonly string[] Prerequisites = {};
|
||||
public readonly string[] Prerequisites = { };
|
||||
|
||||
public object Create(ActorInitializer init) { return new ProvidesTechPrerequisite(this, init); }
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public void Update(Cache<string, List<Actor>> ownedPrerequisites)
|
||||
{
|
||||
var hasReachedLimit = limit > 0 && ownedPrerequisites.ContainsKey(Key) && ownedPrerequisites[Key].Count >= limit;
|
||||
|
||||
// The '!' annotation inverts prerequisites: "I'm buildable if this prerequisite *isn't* met"
|
||||
var nowHasPrerequisites = HasPrerequisites(ownedPrerequisites) && !hasReachedLimit;
|
||||
var nowHidden = IsHidden(ownedPrerequisites);
|
||||
|
||||
@@ -13,8 +13,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
@@ -49,7 +49,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
foreach (var preview in spi.RenderPreviewSprites(init, this, image, facings, palette))
|
||||
yield return preview;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class RenderSprites : IRender, ITick, INotifyOwnerChanged, INotifyEffectiveOwnerChanged
|
||||
@@ -202,7 +201,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
return anims.Values.Where(b => b.IsVisible
|
||||
&& b.Animation.Animation.CurrentSequence != null)
|
||||
.Select(a => (a.Animation.Animation.Image.size*info.Scale).ToInt2())
|
||||
.Select(a => (a.Animation.Animation.Image.size * info.Scale).ToInt2())
|
||||
.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
anim, null, () => !buildComplete, 1024));
|
||||
}
|
||||
|
||||
public void BuildingComplete( Actor self )
|
||||
public void BuildingComplete(Actor self)
|
||||
{
|
||||
buildComplete = true;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
var player = (info.NotifyAll) ? self.World.LocalPlayer : self.Owner;
|
||||
var player = info.NotifyAll ? self.World.LocalPlayer : self.Owner;
|
||||
Sound.PlayNotification(self.World.Map.Rules, player, "Speech", info.Notification, self.Owner.Country.Race);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void AppliedDamage(Actor self, Actor damaged, AttackInfo e)
|
||||
{
|
||||
if (e.DamageState == DamageState.Dead && damaged != e.Attacker) // don't notify suicides
|
||||
// Don't notify suicides
|
||||
if (e.DamageState == DamageState.Dead && damaged != e.Attacker)
|
||||
{
|
||||
if (self.World.WorldTick - lastAnnounce > info.Interval * 25)
|
||||
Sound.PlayVoice("Kill", self, self.Owner.Country.Race);
|
||||
|
||||
@@ -17,14 +17,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string DamagedSound;
|
||||
public readonly string DestroyedSound;
|
||||
|
||||
public object Create(ActorInitializer init) { return new SoundOnDamageTransition(this);}
|
||||
public object Create(ActorInitializer init) { return new SoundOnDamageTransition(this); }
|
||||
}
|
||||
|
||||
public class SoundOnDamageTransition : INotifyDamageStateChanged
|
||||
{
|
||||
readonly SoundOnDamageTransitionInfo Info;
|
||||
|
||||
public SoundOnDamageTransition( SoundOnDamageTransitionInfo info )
|
||||
public SoundOnDamageTransition(SoundOnDamageTransitionInfo info)
|
||||
{
|
||||
Info = info;
|
||||
}
|
||||
|
||||
@@ -21,21 +21,21 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public object Create(ActorInitializer init) { return new LoadWidgetAtGameStart(this); }
|
||||
}
|
||||
|
||||
public class LoadWidgetAtGameStart: IWorldLoaded
|
||||
public class LoadWidgetAtGameStart : IWorldLoaded
|
||||
{
|
||||
readonly LoadWidgetAtGameStartInfo Info;
|
||||
public LoadWidgetAtGameStart(LoadWidgetAtGameStartInfo Info)
|
||||
readonly LoadWidgetAtGameStartInfo info;
|
||||
public LoadWidgetAtGameStart(LoadWidgetAtGameStartInfo info)
|
||||
{
|
||||
this.Info = Info;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public void WorldLoaded(World world, WorldRenderer wr)
|
||||
{
|
||||
// Clear any existing widget state
|
||||
if (Info.ClearRoot)
|
||||
if (info.ClearRoot)
|
||||
Ui.ResetAll();
|
||||
|
||||
Game.LoadWidget(world, Info.Widget, Ui.Root, new WidgetArgs());
|
||||
Game.LoadWidget(world, info.Widget, Ui.Root, new WidgetArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var spawns = world.Map.GetSpawnPoints().ToList();
|
||||
var taken = world.LobbyInfo.Clients.Where(c => c.SpawnPoint != 0 && c.Slot != null)
|
||||
.Select(c => spawns[c.SpawnPoint-1]).ToList();
|
||||
.Select(c => spawns[c.SpawnPoint - 1]).ToList();
|
||||
var available = spawns.Except(taken).ToList();
|
||||
|
||||
// Set spawn
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var client = world.LobbyInfo.ClientInSlot(kv.Key);
|
||||
var spid = (client == null || client.SpawnPoint == 0)
|
||||
? ChooseSpawnPoint(world, available, taken)
|
||||
: spawns[client.SpawnPoint-1];
|
||||
: spawns[client.SpawnPoint - 1];
|
||||
|
||||
Start.Add(player, spid);
|
||||
|
||||
@@ -85,5 +85,4 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,12 +40,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void PlayMusic()
|
||||
{
|
||||
var onComplete = info.Loop ? (Action)PlayMusic : () => {};
|
||||
var onComplete = info.Loop ? (Action)PlayMusic : () => { };
|
||||
|
||||
if (Game.Settings.Sound.MapMusic &&
|
||||
world.Map.Rules.Music.ContainsKey(info.Music))
|
||||
Sound.PlayMusicThen(world.Map.Rules.Music[info.Music], onComplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,22 +39,24 @@ 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 Color[] Fog = new[]
|
||||
{
|
||||
Color.Transparent, Color.Green,
|
||||
Color.Blue, Color.Yellow,
|
||||
Color.FromArgb(128,0,0,0),
|
||||
Color.FromArgb(96,0,0,0),
|
||||
Color.FromArgb(64,0,0,0),
|
||||
Color.FromArgb(32,0,0,0)
|
||||
Color.FromArgb(128, 0, 0, 0),
|
||||
Color.FromArgb(96, 0, 0, 0),
|
||||
Color.FromArgb(64, 0, 0, 0),
|
||||
Color.FromArgb(32, 0, 0, 0)
|
||||
};
|
||||
|
||||
static Color[] Shroud = new[] {
|
||||
static Color[] Shroud = new[]
|
||||
{
|
||||
Color.Transparent, Color.Green,
|
||||
Color.Blue, Color.Yellow,
|
||||
Color.Black,
|
||||
Color.FromArgb(160,0,0,0),
|
||||
Color.FromArgb(128,0,0,0),
|
||||
Color.FromArgb(64,0,0,0)
|
||||
Color.FromArgb(160, 0, 0, 0),
|
||||
Color.FromArgb(128, 0, 0, 0),
|
||||
Color.FromArgb(64, 0, 0, 0)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var desc = m.HasAttribute<DescAttribute>() ? m.GetCustomAttributes<DescAttribute>(true).First().Lines.JoinWith("\n") : "";
|
||||
Console.WriteLine("<tr><td align=\"right\" width=\"50%\"><strong>{0}</strong></td><td>{1}</td></tr>".F(m.LuaDocString(), desc));
|
||||
}
|
||||
|
||||
Console.WriteLine("</table>");
|
||||
}
|
||||
|
||||
@@ -108,6 +109,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
Console.WriteLine("</td></tr>");
|
||||
}
|
||||
|
||||
Console.WriteLine("</table>");
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
doc.Append(line + " ");
|
||||
doc.AppendLine("</td></tr>");
|
||||
}
|
||||
|
||||
doc.AppendLine("</table>");
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
|
||||
@@ -269,7 +269,6 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
for (var j = 0; j < mapSize; j++)
|
||||
for (var i = 0; i < mapSize; i++)
|
||||
map.MapTiles.Value[new CPos(i, j)] = new TerrainTile(types[i, j], ms.ReadUInt8());
|
||||
|
||||
}
|
||||
|
||||
void UnpackRAOverlayData(MemoryStream ms)
|
||||
|
||||
@@ -14,11 +14,11 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.SpriteLoaders;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
// make animation is now its own trait
|
||||
if (engineVersion < 20140621)
|
||||
{
|
||||
if (depth == 1 && (node.Key.StartsWith("RenderBuilding")))
|
||||
if (depth == 1 && node.Key.StartsWith("RenderBuilding"))
|
||||
node.Value.Nodes.RemoveAll(n => n.Key == "HasMakeAnimation");
|
||||
|
||||
if (node.Value.Nodes.Any(n => n.Key.StartsWith("RenderBuilding"))
|
||||
@@ -382,7 +382,6 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
node.Value.Nodes.RemoveAll(_ => true);
|
||||
node.Value.Nodes.Add(new MiniYamlNode("PanelName", new MiniYaml("SKIRMISH_STATS")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Veterancy was changed to use the upgrades system
|
||||
@@ -459,6 +458,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
node.Value.Value = string.Join(", ", node.Value.Value.Split(',')
|
||||
.Select(s => ((int)(100 * 100 / float.Parse(s))).ToString()));
|
||||
}
|
||||
|
||||
if (depth == 3 && parentKey == "Upgrades")
|
||||
node.Value.Value = node.Value.Value.Replace("armor", "damage");
|
||||
}
|
||||
@@ -477,7 +477,6 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
// InfDeath was renamed to DeathType
|
||||
if (engineVersion < 20140830)
|
||||
{
|
||||
|
||||
if (depth == 2 && parentKey.StartsWith("DeathSounds") && node.Key == "InfDeaths")
|
||||
node.Key = "DeathTypes";
|
||||
|
||||
@@ -735,6 +734,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
ConvertPxToRange(ref node.Value.Value, 2, 5);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -768,7 +768,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var invalidTargets = node.Value.Nodes.FirstOrDefault(n => n.Key == "InvalidTargets"); // Weapon's InvalidTargets need to be copied to the warheads, so find it
|
||||
|
||||
var warheadCounter = 0;
|
||||
foreach(var curNode in node.Value.Nodes.ToArray())
|
||||
foreach (var curNode in node.Value.Nodes.ToArray())
|
||||
{
|
||||
if (curNode.Key.Contains("Warhead") && curNode.Value.Value == null)
|
||||
{
|
||||
@@ -794,7 +794,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var keywords = new List<string> { "Damage", "InfDeath", "PreventProne", "ProneModifier", "Delay" };
|
||||
|
||||
foreach(var keyword in keywords)
|
||||
foreach (var keyword in keywords)
|
||||
{
|
||||
var temp2 = curNode.Value.Nodes.FirstOrDefault(n => n.Key == keyword);
|
||||
if (temp2 != null)
|
||||
@@ -830,7 +830,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var keywords = new List<string> { "Damage", "InfDeath", "PreventProne", "ProneModifier", "Delay" };
|
||||
|
||||
foreach(var keyword in keywords)
|
||||
foreach (var keyword in keywords)
|
||||
{
|
||||
var temp2 = curNode.Value.Nodes.FirstOrDefault(n => n.Key == keyword);
|
||||
if (temp2 != null)
|
||||
@@ -857,7 +857,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var keywords = new List<string> { "Spread", "Damage", "InfDeath", "PreventProne", "ProneModifier", "Delay" };
|
||||
|
||||
foreach(var keyword in keywords)
|
||||
foreach (var keyword in keywords)
|
||||
{
|
||||
var temp = curNode.Value.Nodes.FirstOrDefault(n => n.Key == keyword);
|
||||
if (temp != null)
|
||||
@@ -885,7 +885,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var newYaml = new List<MiniYamlNode>();
|
||||
|
||||
var keywords = new List<string> { "Size", "Delay", "ValidTargets", "InvalidTargets" };
|
||||
foreach(var keyword in keywords)
|
||||
foreach (var keyword in keywords)
|
||||
{
|
||||
var temp = curNode.Value.Nodes.FirstOrDefault(n => n.Key == keyword);
|
||||
if (temp != null)
|
||||
@@ -904,7 +904,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var keywords = new List<string> { "AddsResourceType", "Size", "Delay", "ValidTargets", "InvalidTargets" };
|
||||
|
||||
foreach(var keyword in keywords)
|
||||
foreach (var keyword in keywords)
|
||||
{
|
||||
var temp = curNode.Value.Nodes.FirstOrDefault(n => n.Key == keyword);
|
||||
if (temp != null)
|
||||
@@ -923,7 +923,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var keywords = new List<string> { "SmudgeType", "Size", "Delay", "ValidTargets", "InvalidTargets" };
|
||||
|
||||
foreach(var keyword in keywords)
|
||||
foreach (var keyword in keywords)
|
||||
{
|
||||
var temp = curNode.Value.Nodes.FirstOrDefault(n => n.Key == keyword);
|
||||
if (temp != null)
|
||||
@@ -943,14 +943,14 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var keywords = new List<string> { "Explosion", "ImpactSound", "Delay", "ValidTargets", "InvalidTargets", "ValidImpactTypes", "InvalidImpactTypes" };
|
||||
|
||||
foreach(var keyword in keywords)
|
||||
foreach (var keyword in keywords)
|
||||
{
|
||||
var temp = curNode.Value.Nodes.FirstOrDefault(n => n.Key == keyword);
|
||||
if (temp != null)
|
||||
newYaml.Add(new MiniYamlNode(keyword, temp.Value.Value));
|
||||
}
|
||||
newYaml.Add(new MiniYamlNode("InvalidImpactTypes", "Water"));
|
||||
|
||||
newYaml.Add(new MiniYamlNode("InvalidImpactTypes", "Water"));
|
||||
newNodes.Add(new MiniYamlNode("Warhead@" + warheadCounter.ToString() + "Eff" + oldNodeAtName, "CreateEffect", newYaml));
|
||||
}
|
||||
|
||||
@@ -964,7 +964,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var keywords = new List<string> { "WaterExplosion", "WaterImpactSound", "Delay", "ValidTargets", "InvalidTargets", "ValidImpactTypes", "InvalidImpactTypes" };
|
||||
|
||||
foreach(var keyword in keywords)
|
||||
foreach (var keyword in keywords)
|
||||
{
|
||||
var temp = curNode.Value.Nodes.FirstOrDefault(n => n.Key == keyword);
|
||||
if (temp != null)
|
||||
@@ -976,11 +976,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
newYaml.Add(new MiniYamlNode(temp.Key, temp.Value.Value));
|
||||
}
|
||||
}
|
||||
|
||||
newYaml.Add(new MiniYamlNode("ValidImpactTypes", "Water"));
|
||||
|
||||
newNodes.Add(new MiniYamlNode("Warhead@" + warheadCounter.ToString() + "Eff" + oldNodeAtName, "CreateEffect", newYaml));
|
||||
}
|
||||
node.Value.Nodes.InsertRange(node.Value.Nodes.IndexOf(curNode),newNodes);
|
||||
|
||||
node.Value.Nodes.InsertRange(node.Value.Nodes.IndexOf(curNode), newNodes);
|
||||
node.Value.Nodes.Remove(curNode);
|
||||
}
|
||||
}
|
||||
@@ -1028,11 +1030,11 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
if (depth == 2 && parentKey == "TerrainType" && node.Key.Split('@').First() == "Type")
|
||||
addNodes.Add(new MiniYamlNode("TargetTypes", node.Value.Value == "Water" ? "Water" : "Ground"));
|
||||
}
|
||||
|
||||
UpgradeTileset(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
|
||||
nodes.AddRange(addNodes);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common
|
||||
{
|
||||
@@ -42,16 +42,12 @@ namespace OpenRA.Mods.Common
|
||||
|
||||
if (isAir && !isDirectHit)
|
||||
return ImpactType.Air;
|
||||
|
||||
else if (isWater && !isDirectHit)
|
||||
return ImpactType.Water;
|
||||
|
||||
else if (isAir && isDirectHit)
|
||||
return ImpactType.AirHit;
|
||||
|
||||
else if (isWater && isDirectHit)
|
||||
return ImpactType.WaterHit;
|
||||
|
||||
else if (isDirectHit)
|
||||
return ImpactType.GroundHit;
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
public class ColorMixerWidget : Widget
|
||||
{
|
||||
public float[] SRange = {0.0f, 1.0f};
|
||||
public float[] VRange = {0.2f, 1.0f};
|
||||
public event Action OnChange = () => {};
|
||||
public float[] SRange = { 0.0f, 1.0f };
|
||||
public float[] VRange = { 0.2f, 1.0f };
|
||||
public event Action OnChange = () => { };
|
||||
|
||||
float H, S, V;
|
||||
byte[] front, back;
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
Thread workerThread;
|
||||
bool workerAlive;
|
||||
|
||||
public ColorMixerWidget() {}
|
||||
public ColorMixerWidget() { }
|
||||
public ColorMixerWidget(ColorMixerWidget other)
|
||||
: base(other)
|
||||
{
|
||||
@@ -47,10 +47,10 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
base.Initialize(args);
|
||||
|
||||
// Bitmap data is generated in a background thread and then flipped
|
||||
front = new byte[4*256*256];
|
||||
back = new byte[4*256*256];
|
||||
front = new byte[4 * 256 * 256];
|
||||
back = new byte[4 * 256 * 256];
|
||||
|
||||
var rect = new Rectangle((int)(255*SRange[0]), (int)(255*(1 - VRange[1])), (int)(255*(SRange[1] - SRange[0]))+1, (int)(255*(VRange[1] - VRange[0])) + 1);
|
||||
var rect = new Rectangle((int)(255 * SRange[0]), (int)(255 * (1 - VRange[1])), (int)(255 * (SRange[1] - SRange[0])) + 1, (int)(255 * (VRange[1] - VRange[0])) + 1);
|
||||
var mixerSheet = new Sheet(new Size(256, 256));
|
||||
mixerSheet.GetTexture().SetData(front, 256, 256);
|
||||
mixerSprite = new Sprite(mixerSheet, rect, TextureChannel.Alpha);
|
||||
@@ -87,6 +87,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
workerAlive = false;
|
||||
break;
|
||||
}
|
||||
|
||||
update = false;
|
||||
|
||||
// Take a local copy of the hue to generate to avoid tearing
|
||||
@@ -142,8 +143,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
void SetValueFromPx(int2 xy)
|
||||
{
|
||||
var rb = RenderBounds;
|
||||
var s = SRange[0] + xy.X*(SRange[1] - SRange[0])/rb.Width;
|
||||
var v = SRange[1] - xy.Y*(VRange[1] - VRange[0])/rb.Height;
|
||||
var s = SRange[0] + xy.X * (SRange[1] - SRange[0]) / rb.Width;
|
||||
var v = SRange[1] - xy.Y * (VRange[1] - VRange[0]) / rb.Height;
|
||||
S = s.Clamp(SRange[0], SRange[1]);
|
||||
V = v.Clamp(VRange[0], VRange[1]);
|
||||
}
|
||||
@@ -151,8 +152,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
int2 PxFromValue()
|
||||
{
|
||||
var rb = RenderBounds;
|
||||
var x = RenderBounds.Width*(S - SRange[0])/(SRange[1] - SRange[0]);
|
||||
var y = RenderBounds.Height*(1 - (V - VRange[0])/(VRange[1] - VRange[0]));
|
||||
var x = RenderBounds.Width * (S - SRange[0]) / (SRange[1] - SRange[0]);
|
||||
var y = RenderBounds.Height * (1 - (V - VRange[0]) / (VRange[1] - VRange[0]));
|
||||
return new int2((int)x.Clamp(0, rb.Width), (int)y.Clamp(0, rb.Height));
|
||||
}
|
||||
|
||||
@@ -184,6 +185,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
SetValueFromPx(mi.Location - RenderOrigin);
|
||||
OnChange();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -204,7 +206,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
public void Set(HSLColor color)
|
||||
{
|
||||
float h,s,v;
|
||||
float h, s, v;
|
||||
color.ToHSV(out h, out s, out v);
|
||||
|
||||
if (H != h || S != s || V != v)
|
||||
|
||||
@@ -49,19 +49,13 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
Func<bool> doValidate = null;
|
||||
ButtonWidget acceptButton = null, cancelButton = null;
|
||||
|
||||
//
|
||||
// Title
|
||||
//
|
||||
panel.Get<LabelWidget>("PROMPT_TITLE").GetText = () => title;
|
||||
|
||||
//
|
||||
// Prompt
|
||||
//
|
||||
panel.Get<LabelWidget>("PROMPT_TEXT").GetText = () => prompt;
|
||||
|
||||
//
|
||||
// Text input
|
||||
//
|
||||
var input = panel.Get<TextFieldWidget>("INPUT_TEXT");
|
||||
var isValid = false;
|
||||
input.Text = initialText;
|
||||
@@ -86,9 +80,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
input.CursorPosition = input.Text.Length;
|
||||
input.OnTextEdited = () => doValidate();
|
||||
|
||||
//
|
||||
// Buttons
|
||||
//
|
||||
acceptButton = panel.Get<ButtonWidget>("ACCEPT_BUTTON");
|
||||
if (!string.IsNullOrEmpty(acceptText))
|
||||
acceptButton.GetText = () => acceptText;
|
||||
@@ -113,9 +105,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
onCancel();
|
||||
};
|
||||
|
||||
//
|
||||
// Validation
|
||||
//
|
||||
doValidate = () =>
|
||||
{
|
||||
if (inputValidator == null)
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
for (var h = 0; h < 256; h++)
|
||||
*(c + h) = HSLColor.FromHSV(h / 255f, 1, 1).RGB.ToArgb();
|
||||
}
|
||||
|
||||
hueBitmap.UnlockBits(bitmapData);
|
||||
hueSheet.GetTexture().SetData(hueBitmap);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (TooltipContainer == null)
|
||||
return;
|
||||
|
||||
tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs() {{ "getText", GetTooltipText }});
|
||||
tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs() { { "getText", GetTooltipText } });
|
||||
}
|
||||
|
||||
public override void MouseExited()
|
||||
|
||||
@@ -74,5 +74,4 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
color.AttachPanel(colorChooser, onExit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -94,7 +94,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
|
||||
ModMetadata initialMod = null;
|
||||
ModMetadata.AllMods.TryGetValue(Game.Settings.Game.PreviousMod, out initialMod);
|
||||
SelectMod(initialMod ?? ModMetadata.AllMods["ra"]);
|
||||
|
||||
@@ -333,6 +333,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var productionTemplate = hotkeyList.Get("PRODUCTION_TEMPLATE");
|
||||
hotkeyList.RemoveChildren();
|
||||
|
||||
Func<bool> returnTrue = () => true;
|
||||
Action doNothing = () => { };
|
||||
|
||||
// Game
|
||||
{
|
||||
var hotkeys = new Dictionary<string, string>()
|
||||
@@ -358,7 +361,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ "TogglePixelDoubleKey", "Toggle pixel doubling" },
|
||||
};
|
||||
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, () => true, () => {});
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
||||
header.Get<LabelWidget>("LABEL").GetText = () => "Game Commands";
|
||||
hotkeyList.AddChild(header);
|
||||
|
||||
@@ -374,7 +377,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ "ObserverWorldView", "Disable Shroud" }
|
||||
};
|
||||
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, () => true, () => {});
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
||||
header.Get<LabelWidget>("LABEL").GetText = () => "Observer Commands";
|
||||
hotkeyList.AddChild(header);
|
||||
|
||||
@@ -394,7 +397,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ "GuardKey", "Guard" }
|
||||
};
|
||||
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, () => true, () => {});
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
||||
header.Get<LabelWidget>("LABEL").GetText = () => "Unit Commands";
|
||||
hotkeyList.AddChild(header);
|
||||
|
||||
@@ -408,7 +411,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
for (var i = 1; i <= 24; i++)
|
||||
hotkeys.Add("Production{0:D2}Key".F(i), "Slot {0}".F(i));
|
||||
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, () => true, () => {});
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
||||
header.Get<LabelWidget>("LABEL").GetText = () => "Production Commands";
|
||||
hotkeyList.AddChild(header);
|
||||
|
||||
@@ -423,7 +426,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ "DevReloadChromeKey", "Reload Chrome" }
|
||||
};
|
||||
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, () => true, () => {});
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
||||
header.Get<LabelWidget>("LABEL").GetText = () => "Developer commands";
|
||||
hotkeyList.AddChild(header);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public Func<bool> IsEnabled = () => true;
|
||||
public Action AfterOpen = () => { };
|
||||
public Action AfterClose = () => { };
|
||||
public Action<float> Animating = _ => {};
|
||||
public Action<float> Animating = _ => { };
|
||||
|
||||
float radarMinimapHeight;
|
||||
int frame;
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
return;
|
||||
|
||||
Func<string> getText = () => TooltipFormat.F(GetUsed(), GetProvided());
|
||||
tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs() {{ "getText", getText }});
|
||||
tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs() { { "getText", getText } });
|
||||
}
|
||||
|
||||
public override void MouseExited()
|
||||
@@ -67,8 +67,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
while (max >= scaleBy)
|
||||
scaleBy *= 2;
|
||||
|
||||
var providedFrac = providedLerp.Update(provided/scaleBy);
|
||||
var usedFrac = usedLerp.Update(used/scaleBy);
|
||||
var providedFrac = providedLerp.Update(provided / scaleBy);
|
||||
var usedFrac = usedLerp.Update(used / scaleBy);
|
||||
|
||||
var b = RenderBounds;
|
||||
var indicator = ChromeProvider.GetImage(IndicatorCollection, IndicatorImage);
|
||||
@@ -83,10 +83,10 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
color = (i - 1 < b.Height / 2) ? color : colorDark;
|
||||
var bottom = new float2(b.Left + i, b.Bottom);
|
||||
var top = new float2(b.Left + i, b.Bottom + providedFrac*b.Height);
|
||||
var top = new float2(b.Left + i, b.Bottom + providedFrac * b.Height);
|
||||
|
||||
// Indent corners
|
||||
if ((i == 0 || i == b.Width - 1) && providedFrac*b.Height > 1)
|
||||
if ((i == 0 || i == b.Width - 1) && providedFrac * b.Height > 1)
|
||||
{
|
||||
bottom.Y += 1;
|
||||
top.Y -= 1;
|
||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
}
|
||||
else
|
||||
Game.Renderer.LineRenderer.FillRect(new Rectangle(b.X, (int)float2.Lerp(b.Bottom, b.Top, providedFrac),
|
||||
b.Width, (int)(providedFrac*b.Height)), color);
|
||||
b.Width, (int)(providedFrac * b.Height)), color);
|
||||
|
||||
var x = (b.Left + b.Right - indicator.size.X) / 2;
|
||||
var y = float2.Lerp(b.Bottom, b.Top, usedFrac) - indicator.size.Y / 2;
|
||||
@@ -112,10 +112,10 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
color = (i - 1 < b.Height / 2) ? color : colorDark;
|
||||
var left = new float2(b.Left, b.Top + i);
|
||||
var right = new float2(b.Left + providedFrac*b.Width, b.Top + i);
|
||||
var right = new float2(b.Left + providedFrac * b.Width, b.Top + i);
|
||||
|
||||
// Indent corners
|
||||
if ((i == 0 || i == b.Height - 1) && providedFrac*b.Width > 1)
|
||||
if ((i == 0 || i == b.Height - 1) && providedFrac * b.Width > 1)
|
||||
{
|
||||
left.X += 1;
|
||||
right.X -= 1;
|
||||
@@ -125,7 +125,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
}
|
||||
}
|
||||
else
|
||||
Game.Renderer.LineRenderer.FillRect(new Rectangle(b.X, b.Y, (int)(providedFrac*b.Width), b.Height), color);
|
||||
Game.Renderer.LineRenderer.FillRect(new Rectangle(b.X, b.Y, (int)(providedFrac * b.Width), b.Height), color);
|
||||
|
||||
var x = float2.Lerp(b.Left, b.Right, usedFrac) - indicator.size.X / 2;
|
||||
var y = (b.Bottom + b.Top - indicator.size.Y) / 2;
|
||||
|
||||
Reference in New Issue
Block a user