initial setup for decorating the PlaceBuilding OG
This commit is contained in:
@@ -12,7 +12,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Effects;
|
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.RA.Buildings;
|
using OpenRA.Mods.RA.Buildings;
|
||||||
using OpenRA.Traits;
|
|
||||||
using OpenRA.Mods.RA.Render;
|
using OpenRA.Mods.RA.Render;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA.Orders
|
namespace OpenRA.Mods.RA.Orders
|
||||||
{
|
{
|
||||||
@@ -70,6 +70,10 @@ namespace OpenRA.Mods.RA.Orders
|
|||||||
{
|
{
|
||||||
var position = Game.viewport.ViewToWorld(Viewport.LastMousePos).ToInt2();
|
var position = Game.viewport.ViewToWorld(Viewport.LastMousePos).ToInt2();
|
||||||
var topLeft = position - FootprintUtils.AdjustForBuildingSize( BuildingInfo );
|
var topLeft = position - FootprintUtils.AdjustForBuildingSize( BuildingInfo );
|
||||||
|
|
||||||
|
var actorInfo = Rules.Info[Building];
|
||||||
|
foreach (var dec in actorInfo.Traits.WithInterface<IPlaceBuildingDecoration>())
|
||||||
|
dec.Render(wr, world, actorInfo, Traits.Util.CenterOfCell(position)); /* hack hack */
|
||||||
|
|
||||||
var cells = new Dictionary<int2, bool>();
|
var cells = new Dictionary<int2, bool>();
|
||||||
// Linebuild for walls.
|
// Linebuild for walls.
|
||||||
|
|||||||
@@ -14,7 +14,23 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class RenderRangeCircleInfo : TraitInfo<RenderRangeCircle> { }
|
public interface IPlaceBuildingDecoration
|
||||||
|
{
|
||||||
|
void Render(WorldRenderer wr, World w, ActorInfo ai, int2 centerLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
class RenderRangeCircleInfo : TraitInfo<RenderRangeCircle>, IPlaceBuildingDecoration
|
||||||
|
{
|
||||||
|
public readonly string RangeCircleType;
|
||||||
|
|
||||||
|
public void Render(WorldRenderer wr, World w, ActorInfo ai, int2 centerLocation)
|
||||||
|
{
|
||||||
|
wr.DrawRangeCircle(
|
||||||
|
Color.FromArgb(128, Color.Yellow),
|
||||||
|
centerLocation, 3 /* hack: get this from the ActorInfo, but it's nontrivial currently */);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class RenderRangeCircle : IPreRenderSelection
|
class RenderRangeCircle : IPreRenderSelection
|
||||||
{
|
{
|
||||||
public void RenderBeforeWorld(WorldRenderer wr, Actor self)
|
public void RenderBeforeWorld(WorldRenderer wr, Actor self)
|
||||||
|
|||||||
Reference in New Issue
Block a user