[unity] Fix Spine json detection.

This commit is contained in:
John 2016-10-11 22:30:16 +08:00 committed by GitHub
parent 32b022d0bc
commit 41fcd084e9

View File

@ -1157,10 +1157,14 @@ namespace Spine.Unity.Editor {
return false; return false;
} }
bool isSpineJson = root.ContainsKey("skeleton");
// Version warning // Version warning
{ if (isSpineJson) {
var skeletonInfo = (Dictionary<string, object>)root["skeleton"]; var skeletonInfo = (Dictionary<string, object>)root["skeleton"];
string jsonVersion = (string)skeletonInfo["spine"]; object jv;
skeletonInfo.TryGetValue("spine", out jv);
string jsonVersion = (jv == null) ? (string)jv : null;
if (!string.IsNullOrEmpty(jsonVersion)) { if (!string.IsNullOrEmpty(jsonVersion)) {
string[] jsonVersionSplit = jsonVersion.Split('.'); string[] jsonVersionSplit = jsonVersion.Split('.');
bool match = false; bool match = false;
@ -1181,13 +1185,12 @@ namespace Spine.Unity.Editor {
string runtimeVersion = compatibleVersions[0][0] + "." + compatibleVersions[0][1]; string runtimeVersion = compatibleVersions[0][0] + "." + compatibleVersions[0][1];
Debug.LogWarning(string.Format("Skeleton '{0}' (exported with Spine {1}) may be incompatible with your runtime version: spine-unity v{2}", asset.name, jsonVersion, runtimeVersion)); Debug.LogWarning(string.Format("Skeleton '{0}' (exported with Spine {1}) may be incompatible with your runtime version: spine-unity v{2}", asset.name, jsonVersion, runtimeVersion));
} }
} else {
isSpineJson = false;
} }
} }
return isSpineJson;
return root.ContainsKey("skeleton");
} }
#endregion #endregion