1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 17:26:02 +08:00

Added color32 support for NodeTint

This commit is contained in:
Thor Kramer Brigsted 2017-11-14 16:50:28 +01:00
parent 5267ac1a30
commit d68d926a2d

View File

@ -178,9 +178,9 @@ namespace XNode {
public class NodeTint : Attribute { public class NodeTint : Attribute {
public Color color; public Color color;
/// <summary> Specify a color for this node type </summary> /// <summary> Specify a color for this node type </summary>
/// <param name="r"> Red [0..1] </param> /// <param name="r"> Red [0.0f .. 1.0f] </param>
/// <param name="g"> Green [0..1] </param> /// <param name="g"> Green [0.0f .. 1.0f] </param>
/// <param name="b"> Blue [0..1] </param> /// <param name="b"> Blue [0.0f .. 1.0f] </param>
public NodeTint(float r, float g, float b) { public NodeTint(float r, float g, float b) {
color = new Color(r, g, b); color = new Color(r, g, b);
} }
@ -190,6 +190,14 @@ namespace XNode {
public NodeTint(string hex) { public NodeTint(string hex) {
ColorUtility.TryParseHtmlString(hex, out color); ColorUtility.TryParseHtmlString(hex, out color);
} }
/// <summary> Specify a color for this node type </summary>
/// <param name="r"> Red [0 .. 255] </param>
/// <param name="g"> Green [0 .. 255] </param>
/// <param name="b"> Blue [0 .. 255] </param>
public NodeTint(byte r, byte g, byte b) {
color = new Color32(r, g, b, byte.MaxValue);
}
} }
[Serializable] private class NodePortDictionary : Dictionary<string, NodePort>, ISerializationCallbackReceiver { [Serializable] private class NodePortDictionary : Dictionary<string, NodePort>, ISerializationCallbackReceiver {