Remove HSLColor.

This commit is contained in:
Paul Chote
2018-12-31 08:41:23 +00:00
parent ab4a7e3558
commit 3e404f6ac2
76 changed files with 256 additions and 416 deletions

View File

@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Traits
{
var temp = currentDisplayValue;
if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, self.Owner.Color.RGB, FloatingText.FormatCashTick(temp), 30)));
self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, self.Owner.Color, FloatingText.FormatCashTick(temp), 30)));
currentDisplayTick = info.TickRate;
currentDisplayValue = 0;
}

View File

@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
void AddCashTick(Actor self, int amount)
{
self.World.AddFrameEndTask(w => w.Add(
new FloatingText(self.CenterPosition, self.Owner.Color.RGB, FloatingText.FormatCashTick(amount), info.DisplayDuration)));
new FloatingText(self.CenterPosition, self.Owner.Color, FloatingText.FormatCashTick(amount), info.DisplayDuration)));
}
void ModifyCash(Actor self, Player newOwner, int amount)

View File

@@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Traits
var maxHP = healthInfo.MaxHP > 0 ? healthInfo.MaxHP : 1;
var damageText = "{0} ({1}%)".F(-e.Damage.Value, e.Damage.Value * 100 / maxHP);
self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, e.Attacker.Owner.Color.RGB, damageText, 30)));
self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, e.Attacker.Owner.Color, damageText, 30)));
}
}
}

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
var amount = collector.Owner.PlayerActor.Trait<PlayerResources>().ChangeCash(info.Amount);
if (info.UseCashTick)
w.Add(new FloatingText(collector.CenterPosition, collector.Owner.Color.RGB, FloatingText.FormatCashTick(amount), 30));
w.Add(new FloatingText(collector.CenterPosition, collector.Owner.Color, FloatingText.FormatCashTick(amount), 30));
});
base.Activate(collector);

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits
{
foreach (var exitCell in exitCells)
{
var color = self.Owner.Color.RGB;
var color = self.Owner.Color;
var vec = exitCell - self.Location;
var center = wr.World.Map.CenterOfCell(exitCell);
new TextRenderable(manager.Font, center, 0, color, vec.ToString()).Render(wr);
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Traits
continue;
var exitCellCenter = self.World.Map.CenterOfCell(exitCells[i]);
rgbaRenderer.DrawLine(wr.Screen3DPosition(spawnPos), wr.Screen3DPosition(exitCellCenter), 1f, self.Owner.Color.RGB);
rgbaRenderer.DrawLine(wr.Screen3DPosition(spawnPos), wr.Screen3DPosition(exitCellCenter), 1f, self.Owner.Color);
}
}
}

View File

@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits
var displayedBounty = GetDisplayedBountyValue(self);
if (Info.ShowBounty && self.IsInWorld && displayedBounty != 0 && e.Attacker.Owner.IsAlliedWith(self.World.RenderPlayer))
e.Attacker.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, e.Attacker.Owner.Color.RGB, FloatingText.FormatCashTick(displayedBounty), 30)));
e.Attacker.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, e.Attacker.Owner.Color, FloatingText.FormatCashTick(displayedBounty), 30)));
e.Attacker.Owner.PlayerActor.Trait<PlayerResources>().ChangeCash(GetBountyValue(self));
}

View File

@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
return;
self.World.AddFrameEndTask(w => w.Add(
new FloatingText(self.CenterPosition, self.Owner.Color.RGB, FloatingText.FormatCashTick(amount), info.DisplayDuration)));
new FloatingText(self.CenterPosition, self.Owner.Color, FloatingText.FormatCashTick(amount), info.DisplayDuration)));
}
}
}

View File

@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Traits
playerRadarPing = radarPings.Add(
() => self.Owner.IsAlliedWith(self.World.RenderPlayer),
order.Target.CenterPosition,
self.Owner.Color.RGB,
self.Owner.Color,
info.Duration);
}
});

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits.Radar
if (IsTraitDisabled || (viewer != null && !Info.ValidStances.HasStance(self.Owner.Stances[viewer])))
return;
var color = Game.Settings.Game.UsePlayerStanceColors ? self.Owner.PlayerStanceColor(self) : self.Owner.Color.RGB;
var color = Game.Settings.Game.UsePlayerStanceColors ? self.Owner.PlayerStanceColor(self) : self.Owner.Color;
if (modifier != null)
color = modifier.RadarColorOverride(self, color);

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits.Render
Color GetColor()
{
return self.EffectiveOwner != null && self.EffectiveOwner.Disguised ? self.EffectiveOwner.Owner.Color.RGB : self.Owner.Color.RGB;
return self.EffectiveOwner != null && self.EffectiveOwner.Disguised ? self.EffectiveOwner.Owner.Color : self.Owner.Color;
}
IEnumerable<IRenderable> IRenderAboveShroudWhenSelected.RenderAboveShroud(Actor self, WorldRenderer wr)

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public RenderNameTag(Actor self, RenderNameTagInfo info)
{
font = Game.Renderer.Fonts[info.Font];
color = self.Owner.Color.RGB;
color = self.Owner.Color;
if (self.Owner.PlayerName.Length > info.MaxLength)
name = self.Owner.PlayerName.Substring(0, info.MaxLength);

View File

@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits.Render
self.CenterPosition,
Info.Range,
0,
Info.UsePlayerColor ? self.Owner.Color.RGB : Info.Color,
Info.UsePlayerColor ? self.Owner.Color : Info.Color,
Color.FromArgb(96, Color.Black));
yield break;
@@ -107,7 +107,7 @@ namespace OpenRA.Mods.Common.Traits.Render
self.CenterPosition,
Info.Range,
1,
Info.UsePlayerColor ? self.Owner.Color.RGB : Info.Color,
Info.UsePlayerColor ? self.Owner.Color : Info.Color,
3,
Color.FromArgb(96, Color.Black));
}

View File

@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits.Render
throw new YamlException("Font '{0}' is not listed in the mod.yaml's Fonts section".F(info.Font));
decorationBounds = self.TraitsImplementing<IDecorationBounds>().ToArray();
color = info.UsePlayerColor ? self.Owner.Color.RGB : info.Color;
color = info.UsePlayerColor ? self.Owner.Color : info.Color;
}
IEnumerable<IRenderable> IRenderAboveShroudWhenSelected.RenderAboveShroud(Actor self, WorldRenderer wr)
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.Traits.Render
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{
if (info.UsePlayerColor)
color = newOwner.Color.RGB;
color = newOwner.Color;
}
}
}

View File

@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits.Render
{
font = Game.Renderer.Fonts[info.Font];
decorationBounds = self.TraitsImplementing<IDecorationBounds>().ToArray();
color = Info.UsePlayerColor ? self.Owner.Color.RGB : Info.Color;
color = Info.UsePlayerColor ? self.Owner.Color : Info.Color;
}
public virtual bool ShouldRender(Actor self) { return true; }
@@ -137,7 +137,7 @@ namespace OpenRA.Mods.Common.Traits.Render
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{
if (Info.UsePlayerColor)
color = newOwner.Color.RGB;
color = newOwner.Color;
}
}
}

View File

@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Traits
ping = manager.RadarPings.Value.Add(
() => order.Player.IsAlliedWith(self.World.RenderPlayer),
order.Target.CenterPosition,
order.Player.Color.RGB,
order.Player.Color,
Info.RadarPingDuration);
}
}

View File

@@ -280,7 +280,7 @@ namespace OpenRA.Mods.Common.Traits
{
foreach (var previewsForCell in cellMap)
foreach (var preview in previewsForCell.Value)
destinationBuffer.Add(Pair.New(previewsForCell.Key, preview.Owner.Color.RGB));
destinationBuffer.Add(Pair.New(previewsForCell.Key, preview.Owner.Color));
}
public EditorActorPreview this[string id]

View File

@@ -10,6 +10,7 @@
#endregion
using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
@@ -43,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
public PaletteFromPlayerPaletteWithAlpha(PaletteFromPlayerPaletteWithAlphaInfo info) { this.info = info; }
public void LoadPlayerPalettes(WorldRenderer wr, string playerName, HSLColor color, bool replaceExisting)
public void LoadPlayerPalettes(WorldRenderer wr, string playerName, Color color, bool replaceExisting)
{
var remap = new AlphaPaletteRemap(info.Alpha, info.Premultiply);
var pal = new ImmutablePalette(wr.Palette(info.BasePalette + playerName).Palette, remap);