reinstate range circles; IRenderSelection allows arb. plugging in of these things
This commit is contained in:
@@ -37,26 +37,11 @@ namespace OpenRA.Graphics
|
|||||||
{
|
{
|
||||||
Game.Renderer.LineRenderer.DrawLine(start,end,startColor,endColor);
|
Game.Renderer.LineRenderer.DrawLine(start,end,startColor,endColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetPaletteIndex(string name)
|
|
||||||
{
|
|
||||||
return palette.GetPaletteIndex(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Palette GetPalette(string name)
|
public int GetPaletteIndex(string name) { return palette.GetPaletteIndex(name); }
|
||||||
{
|
public Palette GetPalette(string name) { return palette.GetPalette(name); }
|
||||||
return palette.GetPalette(name);
|
public void AddPalette(string name, Palette pal) { palette.AddPalette(name, pal); }
|
||||||
}
|
public void UpdatePalette(string name, Palette pal) { palette.UpdatePalette(name, pal); }
|
||||||
|
|
||||||
public void AddPalette(string name, Palette pal)
|
|
||||||
{
|
|
||||||
palette.AddPalette(name, pal);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdatePalette(string name, Palette pal)
|
|
||||||
{
|
|
||||||
palette.UpdatePalette(name, pal);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawSpriteList(IEnumerable<Renderable> images)
|
void DrawSpriteList(IEnumerable<Renderable> images)
|
||||||
{
|
{
|
||||||
@@ -369,7 +354,7 @@ namespace OpenRA.Graphics
|
|||||||
var prev = location + Game.CellSize * range * float2.FromAngle(0);
|
var prev = location + Game.CellSize * range * float2.FromAngle(0);
|
||||||
for (var i = 1; i <= 32; i++)
|
for (var i = 1; i <= 32; i++)
|
||||||
{
|
{
|
||||||
var pos = location + Game.CellSize * range * float2.FromAngle((float)(Math.PI * i) / 8);
|
var pos = location + Game.CellSize * range * float2.FromAngle((float)(Math.PI * i) / 16);
|
||||||
Game.Renderer.LineRenderer.DrawLine(prev, pos, c, c);
|
Game.Renderer.LineRenderer.DrawLine(prev, pos, c, c);
|
||||||
prev = pos;
|
prev = pos;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -81,7 +81,6 @@
|
|||||||
<Compile Include="Orders\GenericSelectTarget.cs" />
|
<Compile Include="Orders\GenericSelectTarget.cs" />
|
||||||
<Compile Include="Server\ProtocolVersion.cs" />
|
<Compile Include="Server\ProtocolVersion.cs" />
|
||||||
<Compile Include="Traits\BaseBuilding.cs" />
|
<Compile Include="Traits\BaseBuilding.cs" />
|
||||||
<Compile Include="Traits\DetectCloaked.cs" />
|
|
||||||
<Compile Include="Traits\LintAttributes.cs" />
|
<Compile Include="Traits\LintAttributes.cs" />
|
||||||
<Compile Include="Traits\Modifiers\FrozenUnderFog.cs" />
|
<Compile Include="Traits\Modifiers\FrozenUnderFog.cs" />
|
||||||
<Compile Include="Traits\Player\PlayerResources.cs" />
|
<Compile Include="Traits\Player\PlayerResources.cs" />
|
||||||
|
|||||||
@@ -41,15 +41,8 @@ namespace OpenRA.Orders
|
|||||||
{
|
{
|
||||||
world.WorldRenderer.DrawSelectionBox(a, Color.White, true);
|
world.WorldRenderer.DrawSelectionBox(a, Color.White, true);
|
||||||
if (a.Owner == world.LocalPlayer)
|
if (a.Owner == world.LocalPlayer)
|
||||||
{
|
foreach (var t in a.traits.WithInterface<IRenderSelection>())
|
||||||
//if (a.traits.Contains<RenderRangeCircle>())
|
t.Render(a);
|
||||||
// world.WorldRenderer.DrawRangeCircle(Color.FromArgb(128, Color.Yellow),
|
|
||||||
// a.CenterLocation, (int)a.GetPrimaryWeapon().Range);
|
|
||||||
|
|
||||||
if (a.traits.Contains<DetectCloaked>())
|
|
||||||
world.WorldRenderer.DrawRangeCircle(Color.FromArgb(128, Color.LimeGreen),
|
|
||||||
a.CenterLocation, a.Info.Traits.Get<DetectCloakedInfo>().Range);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,6 +166,8 @@ namespace OpenRA.Traits
|
|||||||
public interface IVictoryConditions { }
|
public interface IVictoryConditions { }
|
||||||
public interface IBlocksBullets { }
|
public interface IBlocksBullets { }
|
||||||
|
|
||||||
|
public interface IRenderSelection { void Render(Actor self); }
|
||||||
|
|
||||||
public struct Target // a target: either an actor, or a fixed location.
|
public struct Target // a target: either an actor, or a fixed location.
|
||||||
{
|
{
|
||||||
Actor actor;
|
Actor actor;
|
||||||
|
|||||||
@@ -9,8 +9,9 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class DetectCloakedInfo : TraitInfo<DetectCloaked>
|
class DetectCloakedInfo : TraitInfo<DetectCloaked>
|
||||||
{
|
{
|
||||||
@@ -22,7 +23,8 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
class DetectCloaked : ITick
|
class DetectCloaked : ITick
|
||||||
{
|
{
|
||||||
[Sync] int ticks;
|
[Sync]
|
||||||
|
int ticks;
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
@@ -42,7 +44,4 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderRangeCircleInfo : TraitInfo<RenderRangeCircle> { }
|
|
||||||
class RenderRangeCircle { }
|
|
||||||
}
|
}
|
||||||
@@ -80,6 +80,7 @@
|
|||||||
<Compile Include="AttackBase.cs" />
|
<Compile Include="AttackBase.cs" />
|
||||||
<Compile Include="Combat.cs" />
|
<Compile Include="Combat.cs" />
|
||||||
<Compile Include="ConstructionYard.cs" />
|
<Compile Include="ConstructionYard.cs" />
|
||||||
|
<Compile Include="DetectCloaked.cs" />
|
||||||
<Compile Include="Effects\Bullet.cs" />
|
<Compile Include="Effects\Bullet.cs" />
|
||||||
<Compile Include="Effects\Explosion.cs" />
|
<Compile Include="Effects\Explosion.cs" />
|
||||||
<Compile Include="Effects\GravityBomb.cs" />
|
<Compile Include="Effects\GravityBomb.cs" />
|
||||||
@@ -91,6 +92,8 @@
|
|||||||
<Compile Include="LimitedAmmo.cs" />
|
<Compile Include="LimitedAmmo.cs" />
|
||||||
<Compile Include="Player\ActorGroupProxy.cs" />
|
<Compile Include="Player\ActorGroupProxy.cs" />
|
||||||
<Compile Include="Aircraft.cs" />
|
<Compile Include="Aircraft.cs" />
|
||||||
|
<Compile Include="RenderDetectionCircle.cs" />
|
||||||
|
<Compile Include="RenderRangeCircle.cs" />
|
||||||
<Compile Include="Render\RenderBuilding.cs" />
|
<Compile Include="Render\RenderBuilding.cs" />
|
||||||
<Compile Include="Render\RenderBuildingTurreted.cs" />
|
<Compile Include="Render\RenderBuildingTurreted.cs" />
|
||||||
<Compile Include="Render\RenderUnit.cs" />
|
<Compile Include="Render\RenderUnit.cs" />
|
||||||
@@ -232,6 +235,9 @@
|
|||||||
<Name>OpenRA.Game</Name>
|
<Name>OpenRA.Game</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Chrome\" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
@@ -246,8 +252,4 @@ copy "$(TargetPath)" "$(SolutionDir)mods/ra/"
|
|||||||
cd "$(SolutionDir)"
|
cd "$(SolutionDir)"
|
||||||
ralint ra</PostBuildEvent>
|
ralint ra</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Widgets\" />
|
|
||||||
<Folder Include="Widgets\Delegates\" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
26
OpenRA.Mods.RA/RenderDetectionCircle.cs
Normal file
26
OpenRA.Mods.RA/RenderDetectionCircle.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see LICENSE.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
class RenderDetectionCircleInfo : TraitInfo<RenderDetectionCircle> { }
|
||||||
|
class RenderDetectionCircle : IRenderSelection
|
||||||
|
{
|
||||||
|
public void Render(Actor self)
|
||||||
|
{
|
||||||
|
self.World.WorldRenderer.DrawRangeCircle(
|
||||||
|
Color.FromArgb(128, Color.LimeGreen),
|
||||||
|
self.CenterLocation, self.Info.Traits.Get<DetectCloakedInfo>().Range);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
OpenRA.Mods.RA/RenderRangeCircle.cs
Normal file
26
OpenRA.Mods.RA/RenderRangeCircle.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see LICENSE.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
class RenderRangeCircleInfo : TraitInfo<RenderRangeCircle> { }
|
||||||
|
class RenderRangeCircle : IRenderSelection
|
||||||
|
{
|
||||||
|
public void Render(Actor self)
|
||||||
|
{
|
||||||
|
self.World.WorldRenderer.DrawRangeCircle(
|
||||||
|
Color.FromArgb(128, Color.Yellow),
|
||||||
|
self.CenterLocation, (int)self.GetPrimaryWeapon().Range);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user