Added: ISelectionColorModifier
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
@@ -30,13 +31,20 @@ namespace OpenRA.Traits
|
|||||||
public void RenderAfterWorld (WorldRenderer wr, Actor self)
|
public void RenderAfterWorld (WorldRenderer wr, Actor self)
|
||||||
{
|
{
|
||||||
var bounds = self.GetBounds(true);
|
var bounds = self.GetBounds(true);
|
||||||
|
Color selectionColor = Color.White;
|
||||||
|
|
||||||
var xy = new float2(bounds.Left, bounds.Top);
|
var xy = new float2(bounds.Left, bounds.Top);
|
||||||
var Xy = new float2(bounds.Right, bounds.Top);
|
var Xy = new float2(bounds.Right, bounds.Top);
|
||||||
var xY = new float2(bounds.Left, bounds.Bottom);
|
var xY = new float2(bounds.Left, bounds.Bottom);
|
||||||
var XY = new float2(bounds.Right, bounds.Bottom);
|
var XY = new float2(bounds.Right, bounds.Bottom);
|
||||||
|
|
||||||
DrawSelectionBox(self, xy, Xy, xY, XY, Color.White);
|
var colorResults = self.TraitsImplementing<ISelectionColorModifier>().Select(t => t.GetSelectionColorModifier(self, selectionColor)).Where(
|
||||||
|
c => c.ToArgb() != selectionColor.ToArgb());
|
||||||
|
|
||||||
|
if (colorResults.Any())
|
||||||
|
selectionColor = colorResults.First();
|
||||||
|
|
||||||
|
DrawSelectionBox(self, xy, Xy, xY, XY, selectionColor);
|
||||||
DrawHealthBar(self, xy, Xy);
|
DrawHealthBar(self, xy, Xy);
|
||||||
DrawControlGroup(wr, self, xy);
|
DrawControlGroup(wr, self, xy);
|
||||||
DrawPips(wr, self, xY);
|
DrawPips(wr, self, xY);
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ namespace OpenRA.Traits
|
|||||||
public interface IDamageModifier { float GetDamageModifier(Actor attacker, WarheadInfo warhead); }
|
public interface IDamageModifier { float GetDamageModifier(Actor attacker, WarheadInfo warhead); }
|
||||||
public interface ISpeedModifier { decimal GetSpeedModifier(); }
|
public interface ISpeedModifier { decimal GetSpeedModifier(); }
|
||||||
public interface IFirepowerModifier { float GetFirepowerModifier(); }
|
public interface IFirepowerModifier { float GetFirepowerModifier(); }
|
||||||
|
public interface ISelectionColorModifier { Color GetSelectionColorModifier(Actor self, Color defaultColor); }
|
||||||
public interface IPalette { void InitPalette( WorldRenderer wr ); }
|
public interface IPalette { void InitPalette( WorldRenderer wr ); }
|
||||||
public interface IPaletteModifier { void AdjustPalette(Dictionary<string,Palette> b); }
|
public interface IPaletteModifier { void AdjustPalette(Dictionary<string,Palette> b); }
|
||||||
public interface IPips { IEnumerable<PipType> GetPips(Actor self); }
|
public interface IPips { IEnumerable<PipType> GetPips(Actor self); }
|
||||||
|
|||||||
Reference in New Issue
Block a user