Browse Source

[unity] Minor cleanup.

pharan 7 years ago
parent
commit
b4707e4441
1 changed files with 6 additions and 4 deletions
  1. 6 4
      spine-unity/Assets/spine-unity/Modules/Ghost/SkeletonGhost.cs

+ 6 - 4
spine-unity/Assets/spine-unity/Modules/Ghost/SkeletonGhost.cs

@@ -166,16 +166,18 @@ namespace Spine.Unity.Modules {
 
 		//based on UnifyWiki  http://wiki.unity3d.com/index.php?title=HexConverter
 		static Color32 HexToColor (string hex) {
+			const System.Globalization.NumberStyles HexStyle = System.Globalization.NumberStyles.HexNumber;
+
 			if (hex.Length < 6)
 				return Color.magenta;
 
 			hex = hex.Replace("#", "");
-			byte r = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
-			byte g = byte.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
-			byte b = byte.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
+			byte r = byte.Parse(hex.Substring(0, 2), HexStyle);
+			byte g = byte.Parse(hex.Substring(2, 2), HexStyle);
+			byte b = byte.Parse(hex.Substring(4, 2), HexStyle);
 			byte a = 0xFF;
 			if (hex.Length == 8)
-				a = byte.Parse(hex.Substring(6, 2), System.Globalization.NumberStyles.HexNumber);
+				a = byte.Parse(hex.Substring(6, 2), HexStyle);
 
 			return new Color32(r, g, b, a);
 		}