Merge pull request #9324 from atlimit8/ColorSpacePrefixes
Hex Color Parsing
This commit is contained in:
@@ -543,6 +543,7 @@
|
||||
<Compile Include="UtilityCommands\UpgradeMapCommand.cs" />
|
||||
<Compile Include="UtilityCommands\UpgradeModCommand.cs" />
|
||||
<Compile Include="UtilityCommands\UpgradeRules.cs" />
|
||||
<Compile Include="UtilityCommands\Rgba2Hex.cs" />
|
||||
<Compile Include="Warheads\CreateEffectWarhead.cs" />
|
||||
<Compile Include="Warheads\CreateResourceWarhead.cs" />
|
||||
<Compile Include="Warheads\DamageWarhead.cs" />
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using Eluant;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Scripting;
|
||||
|
||||
@@ -30,11 +31,59 @@ namespace OpenRA.Mods.Common.Scripting.Global
|
||||
return new HSLColor(h, s, l);
|
||||
}
|
||||
|
||||
public HSLColor White { get { return HSLColor.FromRGB(Color.White.R, Color.White.G, Color.White.B); } }
|
||||
public HSLColor Black { get { return HSLColor.FromRGB(Color.Black.R, Color.Black.G, Color.Black.B); } }
|
||||
public HSLColor Blue { get { return HSLColor.FromRGB(Color.Blue.R, Color.Blue.G, Color.Blue.B); } }
|
||||
public HSLColor Red { get { return HSLColor.FromRGB(Color.Red.R, Color.Red.G, Color.Red.B); } }
|
||||
public HSLColor Yellow { get { return HSLColor.FromRGB(Color.Yellow.R, Color.Yellow.G, Color.Yellow.B); } }
|
||||
public HSLColor Green { get { return HSLColor.FromRGB(Color.Green.R, Color.Green.G, Color.Green.B); } }
|
||||
[Desc("Create a new HSL color with the specified red/green/blue/[alpha] values.")]
|
||||
public HSLColor FromRGB(int red, int green, int blue, int alpha = 255)
|
||||
{
|
||||
return new HSLColor(
|
||||
Color.FromArgb(
|
||||
alpha.Clamp(0, 255), red.Clamp(0, 255), green.Clamp(0, 255), blue.Clamp(0, 255)));
|
||||
}
|
||||
|
||||
[Desc("Create a new HSL color with the specified red/green/blue/[alpha] hex string (rrggbb[aa]).")]
|
||||
public HSLColor FromHex(string value)
|
||||
{
|
||||
Color rgb;
|
||||
if (HSLColor.TryParseRGB(value, out rgb))
|
||||
return new HSLColor(rgb);
|
||||
|
||||
throw new LuaException("Invalid rrggbb[aa] hex string.");
|
||||
}
|
||||
|
||||
public HSLColor Aqua { get { return new HSLColor(Color.Aqua); } }
|
||||
public HSLColor Black { get { return new HSLColor(Color.Black); } }
|
||||
public HSLColor Blue { get { return new HSLColor(Color.Blue); } }
|
||||
public HSLColor Brown { get { return new HSLColor(Color.Brown); } }
|
||||
public HSLColor Cyan { get { return new HSLColor(Color.Cyan); } }
|
||||
public HSLColor DarkBlue { get { return new HSLColor(Color.DarkBlue); } }
|
||||
public HSLColor DarkCyan { get { return new HSLColor(Color.DarkCyan); } }
|
||||
public HSLColor DarkGray { get { return new HSLColor(Color.DarkGray); } }
|
||||
public HSLColor DarkGreen { get { return new HSLColor(Color.DarkGreen); } }
|
||||
public HSLColor DarkOrange { get { return new HSLColor(Color.DarkOrange); } }
|
||||
public HSLColor DarkRed { get { return new HSLColor(Color.DarkRed); } }
|
||||
public HSLColor Fuchsia { get { return new HSLColor(Color.Fuchsia); } }
|
||||
public HSLColor Gold { get { return new HSLColor(Color.Gold); } }
|
||||
public HSLColor Gray { get { return new HSLColor(Color.Gray); } }
|
||||
public HSLColor Green { get { return new HSLColor(Color.Green); } }
|
||||
public HSLColor LawnGreen { get { return new HSLColor(Color.LawnGreen); } }
|
||||
public HSLColor LightBlue { get { return new HSLColor(Color.LightBlue); } }
|
||||
public HSLColor LightCyan { get { return new HSLColor(Color.LightCyan); } }
|
||||
public HSLColor LightGray { get { return new HSLColor(Color.LightGray); } }
|
||||
public HSLColor LightGreen { get { return new HSLColor(Color.LightGreen); } }
|
||||
public HSLColor LightYellow { get { return new HSLColor(Color.LightYellow); } }
|
||||
public HSLColor Lime { get { return new HSLColor(Color.Lime); } }
|
||||
public HSLColor LimeGreen { get { return new HSLColor(Color.LimeGreen); } }
|
||||
public HSLColor Magenta { get { return new HSLColor(Color.Magenta); } }
|
||||
public HSLColor Maroon { get { return new HSLColor(Color.Maroon); } }
|
||||
public HSLColor Navy { get { return new HSLColor(Color.Navy); } }
|
||||
public HSLColor Olive { get { return new HSLColor(Color.Olive); } }
|
||||
public HSLColor Orange { get { return new HSLColor(Color.Orange); } }
|
||||
public HSLColor OrangeRed { get { return new HSLColor(Color.OrangeRed); } }
|
||||
public HSLColor Purple { get { return new HSLColor(Color.Purple); } }
|
||||
public HSLColor Red { get { return new HSLColor(Color.Red); } }
|
||||
public HSLColor Salmon { get { return new HSLColor(Color.Salmon); } }
|
||||
public HSLColor SkyBlue { get { return new HSLColor(Color.SkyBlue); } }
|
||||
public HSLColor Teal { get { return new HSLColor(Color.Teal); } }
|
||||
public HSLColor Yellow { get { return new HSLColor(Color.Yellow); } }
|
||||
public HSLColor White { get { return new HSLColor(Color.White); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace OpenRA.Mods.Common.Server
|
||||
return false;
|
||||
}
|
||||
|
||||
var mapPlayerColors = server.MapPlayers.Players.Values.Select(p => p.ColorRamp.RGB);
|
||||
var mapPlayerColors = server.MapPlayers.Players.Values.Select(p => p.Color.RGB);
|
||||
|
||||
if (!ValidateColorAgainstForbidden(askedColor, mapPlayerColors, out forbiddenColor))
|
||||
{
|
||||
|
||||
@@ -56,12 +56,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("The value range that can be swung to the left or right. SwingAmplitude min. and max. value in px/tick.")]
|
||||
public readonly float[] SwingAmplitude = { 1.0f, 1.5f };
|
||||
|
||||
[Desc("The randomly selected ArgbColors for the particles. Use this order: a,r,g,b, a,r,g,b, a,...")]
|
||||
[Desc("The randomly selected rgb(a) hex colors for the particles. Use this order: rrggbb[aa], rrggbb[aa], ...")]
|
||||
public readonly Color[] ParticleColors = {
|
||||
Color.FromArgb(255, 236, 236, 236),
|
||||
Color.FromArgb(255, 228, 228, 228),
|
||||
Color.FromArgb(255, 208, 208, 208),
|
||||
Color.FromArgb(255, 188, 188, 188)
|
||||
Color.FromArgb(236, 236, 236),
|
||||
Color.FromArgb(228, 228, 228),
|
||||
Color.FromArgb(208, 208, 208),
|
||||
Color.FromArgb(188, 188, 188)
|
||||
};
|
||||
|
||||
[Desc("Works only with line enabled and can get used to fade out the tail of the line like a contrail.")]
|
||||
|
||||
@@ -12,6 +12,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.UtilityCommands
|
||||
@@ -164,6 +165,9 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
if (t == typeof(WVec))
|
||||
return "3D World Vector";
|
||||
|
||||
if (t == typeof(HSLColor))
|
||||
return "Color";
|
||||
|
||||
return t.Name;
|
||||
}
|
||||
}
|
||||
|
||||
209
OpenRA.Mods.Common/UtilityCommands/Rgba2Hex.cs
Normal file
209
OpenRA.Mods.Common/UtilityCommands/Rgba2Hex.cs
Normal file
@@ -0,0 +1,209 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2015 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 COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
class Rgba2Hex : IUtilityCommand
|
||||
{
|
||||
public string Name { get { return "--rgba2hex"; } }
|
||||
|
||||
static readonly char[] Comma = new char[] { ',' };
|
||||
|
||||
public bool ValidateArguments(string[] args)
|
||||
{
|
||||
if (args.Length <= 1)
|
||||
return PrintUsage();
|
||||
|
||||
var invalid = false;
|
||||
byte component;
|
||||
for (int i = 1; i < args.Length; i++)
|
||||
{
|
||||
var parts = args[i].Split(Comma, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length != 3 && parts.Length != 4)
|
||||
{
|
||||
invalid = true;
|
||||
Console.WriteLine("Invalid color (argument " + i + "): " + args[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var part in parts)
|
||||
{
|
||||
if (!byte.TryParse(part, out component))
|
||||
{
|
||||
invalid = true;
|
||||
Console.WriteLine("Invalid component in color (argument " + i + "): [" + part + "]: " + args[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !invalid || PrintUsage();
|
||||
}
|
||||
|
||||
bool PrintUsage()
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Usage:");
|
||||
Console.WriteLine("\tOpenRA.Utility.exe [MOD] --rgba2hex r1,g1,b1");
|
||||
Console.WriteLine("\tOpenRA.Utility.exe [MOD] --rgba2hex r1,g1,b1,a1");
|
||||
Console.WriteLine("\tOpenRA.Utility.exe [MOD] --rgba2hex r1,g1,b1 r2,g2,b2,a2");
|
||||
Console.WriteLine("\tOpenRA.Utility.exe [MOD] --rgba2hex r1,g1,b1,a1 r2,g2,b2 ...");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("\tNo spaces between the color components (red,green,blue[,alpha]).");
|
||||
Console.WriteLine("\tSpaces between colors for a list; each argument is a color.");
|
||||
Console.WriteLine("\tExtra commas are ignored.");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Where:");
|
||||
Console.WriteLine("\tr# is a red component value (0-255)");
|
||||
Console.WriteLine("\tg# is a green component value (0-255)");
|
||||
Console.WriteLine("\tb# is a blue component value (0-255)");
|
||||
Console.WriteLine("\ta# is an optional alpha component value (0-255)");
|
||||
|
||||
Console.WriteLine("");
|
||||
return false;
|
||||
}
|
||||
|
||||
[Desc("Convert r,g,b[,a] triples/quads into hex colors")]
|
||||
public void Run(ModData modData, string[] args)
|
||||
{
|
||||
for (int i = 1; i < args.Length;)
|
||||
{
|
||||
var parts = args[i].Split(Comma, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length == 3)
|
||||
{
|
||||
foreach (var c in parts)
|
||||
Console.Write(byte.Parse(c).ToString("X2"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Write(byte.Parse(parts[0]).ToString("X2"));
|
||||
Console.Write(byte.Parse(parts[1]).ToString("X2"));
|
||||
Console.Write(byte.Parse(parts[2]).ToString("X2"));
|
||||
var alpha = byte.Parse(parts[3]);
|
||||
if (alpha < 255)
|
||||
Console.Write(alpha.ToString("X2"));
|
||||
}
|
||||
|
||||
if (++i != args.Length)
|
||||
Console.Write(", ");
|
||||
else
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Argb2Hex : IUtilityCommand
|
||||
{
|
||||
public string Name { get { return "--argb2hex"; } }
|
||||
|
||||
static readonly char[] Comma = new char[] { ',' };
|
||||
|
||||
public bool ValidateArguments(string[] args)
|
||||
{
|
||||
if (args.Length <= 1)
|
||||
return PrintUsage();
|
||||
|
||||
var invalid = false;
|
||||
byte component;
|
||||
for (int i = 1; i < args.Length; i++)
|
||||
{
|
||||
var parts = args[i].Split(Comma, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length != 3 && parts.Length != 4)
|
||||
{
|
||||
invalid = true;
|
||||
Console.WriteLine("Invalid color (argument " + i + "): " + args[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var part in parts)
|
||||
{
|
||||
if (!byte.TryParse(part, out component))
|
||||
{
|
||||
invalid = true;
|
||||
Console.WriteLine("Invalid component in color (argument " + i + "): [" + part + "]: " + args[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !invalid || PrintUsage();
|
||||
}
|
||||
|
||||
bool PrintUsage()
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Usage:");
|
||||
Console.WriteLine("\tOpenRA.Utility.exe [MOD] --argb2hex a1,r1,g1,b1");
|
||||
Console.WriteLine("\tOpenRA.Utility.exe [MOD] --argb2hex r1,g1,b1");
|
||||
Console.WriteLine("\tOpenRA.Utility.exe [MOD] --argb2hex a1,r1,g1,b1 a2,r2,g2,b2");
|
||||
Console.WriteLine("\tOpenRA.Utility.exe [MOD] --argb2hex a1,r1,g1,b1, a2,r2,g2,b2");
|
||||
Console.WriteLine("\tOpenRA.Utility.exe [MOD] --argb2hex a1,r1,g1,b1 a2,r2,g2,b2 ...");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("\tNo spaces between color components ([alpha,]red,green,blue).");
|
||||
Console.WriteLine("\tSpaces between colors for a list; each argument is a color.");
|
||||
Console.WriteLine("\tExtra commas are ignored; useful for pasting legacy color lists to the command line.");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Where:");
|
||||
Console.WriteLine("\ta# is an optional alpha component value (0-255)");
|
||||
Console.WriteLine("\tr# is a red component value (0-255)");
|
||||
Console.WriteLine("\tg# is a green component value (0-255)");
|
||||
Console.WriteLine("\tb# is a blue component value (0-255)");
|
||||
Console.WriteLine("\t[MOD] is any valid mod such as \"all\"");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Converting legacy color lists:");
|
||||
Console.WriteLine("\tType into command line: OpenRA.Utility.exe all --argb2hex ");
|
||||
Console.WriteLine("\tFollow with a space.");
|
||||
Console.WriteLine("\tCopy legacy color list and paste into command line");
|
||||
Console.WriteLine("\t1.) Copying from command line terminal:");
|
||||
Console.WriteLine("\t\tPress Enter in command line terminal.");
|
||||
Console.WriteLine("\t\tCopy hex color list from command line terminal.");
|
||||
Console.WriteLine("\t2.) Append to file");
|
||||
Console.WriteLine("\t\tSave any unsaved changes to file.");
|
||||
Console.WriteLine("\t\tEnter \">>\" into command line terminal without the quotes.");
|
||||
Console.WriteLine("\t\tEnter relative or absolute path follow by a \"/\" to file directory if it is not the current directory.");
|
||||
Console.WriteLine("\t\tEnter full filename with extension.");
|
||||
Console.WriteLine("\t\tPress Enter.");
|
||||
Console.WriteLine("\t\tOpen/reload file");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
return false;
|
||||
}
|
||||
|
||||
[Desc("Convert a,r,g,b legacy colors into hex colors")]
|
||||
public void Run(ModData modData, string[] args)
|
||||
{
|
||||
for (int i = 1; i < args.Length;)
|
||||
{
|
||||
var parts = args[i].Split(Comma, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length == 3)
|
||||
{
|
||||
foreach (var c in parts)
|
||||
Console.Write(byte.Parse(c).ToString("X2"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Write(byte.Parse(parts[1]).ToString("X2"));
|
||||
Console.Write(byte.Parse(parts[2]).ToString("X2"));
|
||||
Console.Write(byte.Parse(parts[3]).ToString("X2"));
|
||||
var alpha = byte.Parse(parts[0]);
|
||||
if (alpha < 255)
|
||||
Console.Write(alpha.ToString("X2"));
|
||||
}
|
||||
|
||||
if (++i != args.Length)
|
||||
Console.Write(", ");
|
||||
else
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,28 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
file.WriteLine(yaml.WriteToString());
|
||||
}
|
||||
|
||||
Console.WriteLine("Processing Chrome Metrics:");
|
||||
foreach (var filename in Game.ModData.Manifest.ChromeMetrics)
|
||||
{
|
||||
Console.WriteLine("\t" + filename);
|
||||
var yaml = MiniYaml.FromFile(filename);
|
||||
UpgradeRules.UpgradeChromeMetrics(engineDate, ref yaml, null, 0);
|
||||
|
||||
using (var file = new StreamWriter(filename))
|
||||
file.WriteLine(yaml.WriteToString());
|
||||
}
|
||||
|
||||
Console.WriteLine("Processing Chrome Layout:");
|
||||
foreach (var filename in Game.ModData.Manifest.ChromeLayout)
|
||||
{
|
||||
Console.WriteLine("\t" + filename);
|
||||
var yaml = MiniYaml.FromFile(filename);
|
||||
UpgradeRules.UpgradeChromeLayout(engineDate, ref yaml, null, 0);
|
||||
|
||||
using (var file = new StreamWriter(filename))
|
||||
file.WriteLine(yaml.WriteToString());
|
||||
}
|
||||
|
||||
Console.WriteLine("Processing Maps:");
|
||||
var maps = Game.ModData.MapCache
|
||||
.Where(m => m.Status == MapStatus.Available)
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
@@ -148,6 +150,72 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
internal static void TryUpdateColor(ref string value)
|
||||
{
|
||||
if (value.Length == 0)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
var parts = value.Split(',');
|
||||
if (parts.Length == 3)
|
||||
value = FieldSaver.FormatValue(Color.FromArgb(
|
||||
Exts.ParseIntegerInvariant(parts[0]).Clamp(0, 255),
|
||||
Exts.ParseIntegerInvariant(parts[1]).Clamp(0, 255),
|
||||
Exts.ParseIntegerInvariant(parts[2]).Clamp(0, 255)));
|
||||
else if (parts.Length == 4)
|
||||
value = FieldSaver.FormatValue(Color.FromArgb(
|
||||
Exts.ParseIntegerInvariant(parts[0]).Clamp(0, 255),
|
||||
Exts.ParseIntegerInvariant(parts[1]).Clamp(0, 255),
|
||||
Exts.ParseIntegerInvariant(parts[2]).Clamp(0, 255),
|
||||
Exts.ParseIntegerInvariant(parts[3]).Clamp(0, 255)));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
internal static void TryUpdateColors(ref string value)
|
||||
{
|
||||
if (value.Length == 0)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
var parts = value.Split(',');
|
||||
if (parts.Length % 4 != 0)
|
||||
return;
|
||||
|
||||
var colors = new Color[parts.Length / 4];
|
||||
for (var i = 0; i < colors.Length; i++)
|
||||
{
|
||||
colors[i] = Color.FromArgb(
|
||||
Exts.ParseIntegerInvariant(parts[4 * i]).Clamp(0, 255),
|
||||
Exts.ParseIntegerInvariant(parts[4 * i + 1]).Clamp(0, 255),
|
||||
Exts.ParseIntegerInvariant(parts[4 * i + 2]).Clamp(0, 255),
|
||||
Exts.ParseIntegerInvariant(parts[4 * i + 3]).Clamp(0, 255));
|
||||
}
|
||||
|
||||
value = FieldSaver.FormatValue(colors);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
internal static void TryUpdateHSLColor(ref string value)
|
||||
{
|
||||
if (value.Length == 0)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
var parts = value.Split(',');
|
||||
if (parts.Length == 3 || parts.Length == 4)
|
||||
value = FieldSaver.FormatValue(new HSLColor(
|
||||
(byte)Exts.ParseIntegerInvariant(parts[0]).Clamp(0, 255),
|
||||
(byte)Exts.ParseIntegerInvariant(parts[1]).Clamp(0, 255),
|
||||
(byte)Exts.ParseIntegerInvariant(parts[2]).Clamp(0, 255)));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
internal static void UpgradeActorRules(int engineVersion, ref List<MiniYamlNode> nodes, MiniYamlNode parent, int depth)
|
||||
{
|
||||
var parentKey = parent != null ? parent.Key.Split('@').First() : null;
|
||||
@@ -2277,6 +2345,21 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
if (engineVersion < 20151027 && depth == 2)
|
||||
{
|
||||
if (node.Key == "Color")
|
||||
{
|
||||
if (parent.Key.StartsWith("FixedColorPalette"))
|
||||
TryUpdateHSLColor(ref node.Value.Value);
|
||||
else
|
||||
TryUpdateColor(ref node.Value.Value);
|
||||
}
|
||||
else if (node.Key == "RadarPingColor" || node.Key == "SelectionBoxColor" || node.Key == "BarColor")
|
||||
TryUpdateColor(ref node.Value.Value);
|
||||
else if (node.Key == "Fog" || node.Key == "Shroud" || node.Key == "ParticleColors")
|
||||
TryUpdateColors(ref node.Value.Value);
|
||||
}
|
||||
|
||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
}
|
||||
@@ -2764,6 +2847,12 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
node.Key = "TrailImage";
|
||||
}
|
||||
|
||||
if (engineVersion < 20151027)
|
||||
{
|
||||
if (node.Key == "Color" || node.Key == "ContrailColor")
|
||||
TryUpdateColor(ref node.Value.Value);
|
||||
}
|
||||
|
||||
UpgradeWeaponRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
}
|
||||
@@ -2785,6 +2874,14 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
if (depth == 2 && node.Key == "Image")
|
||||
node.Key = "Images";
|
||||
|
||||
if (engineVersion < 20151027)
|
||||
{
|
||||
if (node.Key == "LeftColor" || node.Key == "RightColor" || node.Key == "Color")
|
||||
TryUpdateColor(ref node.Value.Value);
|
||||
else if (node.Key == "HeightDebugColors")
|
||||
TryUpdateColors(ref node.Value.Value);
|
||||
}
|
||||
|
||||
UpgradeTileset(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
|
||||
@@ -2829,10 +2926,49 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
lockRace.Key = "LockFaction";
|
||||
}
|
||||
|
||||
if (engineVersion < 20151027 && node.Key == "ColorRamp")
|
||||
{
|
||||
TryUpdateHSLColor(ref node.Value.Value);
|
||||
node.Key = "Color";
|
||||
}
|
||||
|
||||
UpgradePlayers(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void UpgradeChromeMetrics(int engineVersion, ref List<MiniYamlNode> nodes, MiniYamlNode parent, int depth)
|
||||
{
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
if (engineVersion < 20151027)
|
||||
{
|
||||
if (node.Key.EndsWith("Color") || node.Key.EndsWith("ColorDisabled") || node.Key.EndsWith("ColorInvalid"))
|
||||
TryUpdateColor(ref node.Value.Value);
|
||||
}
|
||||
|
||||
UpgradeChromeMetrics(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void UpgradeChromeLayout(int engineVersion, ref List<MiniYamlNode> nodes, MiniYamlNode parent, int depth)
|
||||
{
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
if (engineVersion < 20151027)
|
||||
{
|
||||
if (node.Key == "Color" || node.Key == "ReadyTextAltColor" || node.Key == "TextColor" || node.Key == "TextColorDisabled")
|
||||
{
|
||||
if (parent.Key.StartsWith("MapPreview@"))
|
||||
TryUpdateHSLColor(ref node.Value.Value);
|
||||
else
|
||||
TryUpdateColor(ref node.Value.Value);
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeChromeLayout(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void UpgradeActors(int engineVersion, ref List<MiniYamlNode> nodes, MiniYamlNode parent, int depth)
|
||||
{
|
||||
foreach (var node in nodes)
|
||||
|
||||
Reference in New Issue
Block a user